#!/bin/bash ROOT=/fido function mp() { set +e mountpoint -q $1 local mp=$? set -e echo ${mp} } mp=$(mp ${ROOT}) #echo "? DEBUG: mp is ${mp}" if [ ! -d ${ROOT} -o ${mp} -eq 1 ]; then echo "! ERROR: Refusing to start, ${ROOT} doesnt exist or is not external" exit 1 fi # Make our outbound dirs for i in \ mailer/box mailer/out mailer/in mailer/in.loc mailer/in.unsecure mailer/in.tmp mailer/out.tmp \ dupes filepass files nodelist magic msgbase semafore; do [ ! -d ${ROOT}/$i ] && mkdir -p ${ROOT}/$i; done [ ! -d /var/log/fido ] && mkdir /var/log/fido if [ ! -e "/etc/binkd/binkd.conf" ]; then echo "* Installing BINKD config files into [/etc/binkd]" cp -nRa /etc/binkd.orig/* /etc/binkd fi if [ ! -e "/etc/jamnntpd/config" ]; then echo "* Installing JAMNNTPD config files into [/etc/jamnntpd]" cp -nRa /etc/jamnntpd.orig/* /etc/jamnntpd fi if [ ! -e "/etc/ftn/config" ]; then echo "* Installing HUSKY config files into [/etc/ftn]" cp -nRa /etc/ftn.orig/* /etc/ftn fi if [ ! -e "/etc/qico/qico.conf" ]; then echo "* Installing QICO config files into [/etc/qico]" cp -nRa /etc/qico.orig/* /etc/qico fi if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then echo "* Starting ZeroTier" mkdir /dev/net && mknod /dev/net/tun -m 666 c 10 200 /usr/sbin/zerotier-one -d fi echo "* Ready..." exec "$@"