sbbs/init
2021-01-16 23:56:28 +11:00

44 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
NAME="Synchronet BBS"
export PATH=$PATH:${SBBSEXEC}
if [ ! -e "${SBBSCTRL}/sbbs.ini" ]; then
echo "* Installing SBBS ctrl files into ${SBBSCTRL}"
cp -Ras ${SBBSCTRL}.orig/* ${SBBSCTRL}
fi
if [ ! -d "${SBBSCTRL}/../nodes/node1" ]; then
[ ! -d "${SBBSCTRL}/../nodes" ] && mkdir ${SBBSCTRL}/../nodes
echo "* Installing SBBS nodes files into ${SBBSCTRL}/../nodes"
cp -Ra ${SBBSCTRL}/../nodes.orig/* ${SBBSCTRL}/../nodes/
fi
if [ ! -e "${SBBSCTRL}/../text/answer.msg" ]; then
echo "* Installing SBBS text files into ${SBBSCTRL}/../text"
cp -Ras ${SBBSCTRL}/../text.orig/* ${SBBSCTRL}/../text/
fi
if [ ! -d "${SBBSCTRL}/../xtrn" -o $((ls -1 ${SBBSCTRL}/../xtrn 2>/dev/null|wc -l)||echo 0) -eq 0 ]; then
echo "* Installing SBBS xtrn files into ${SBBSCTRL}/../xtrn"
[ ! -d ${SBBSCTRL}/../xtrn ] && mkdir ${SBBSCTRL}/../xtrn
cp -Ras ${SBBSCTRL}/../xtrn.orig/* ${SBBSCTRL}/../xtrn
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
if [ -n "$1" ]; then
echo "* Starting [$@]"
exec "$@"
else
# Start Supervisord
echo "* Starting supervisord"
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
fi