Updates and now enabled using daemon mode

This commit is contained in:
Deon George 2020-06-21 14:01:30 +10:00
parent 6ce8e626f1
commit e7e4b3eec8
5 changed files with 54 additions and 7 deletions

View File

@ -36,7 +36,7 @@ RUN apt-get update \
# Build SBBS
RUN apt-get update \
&& apt-get install -yqq build-essential libnspr4-dev libncurses5-dev libmozjs185-dev cvs wget pkgconf sudo \
&& apt-get install -yqq build-essential libnspr4-dev libncurses5-dev libncursesw5-dev libmozjs185-dev cvs wget pkgconf libcap2-bin sudo \
&& mkdir /opt/sbbs && cd /tmp \
&& wget http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/install/GNUmakefile \
&& make RELEASE=1 USE_DOSEMU=1 NO_X=1 JSINCLUDE=/usr/include/js JSLIB=mozjs185 SBBSDIR=/opt/sbbs install \
@ -50,7 +50,7 @@ RUN apt-get update \
&& ln -sf nodes/node4 /opt/sbbs/ \
&& ln -sf nodes/node5 /opt/sbbs/ \
&& find /opt/sbbs -name CVS -type d -exec rm -rf {} + \
&& SUDO_FORCE_REMOVE=yes apt-get -y purge build-essential libnspr4-dev libncurses5-dev libmozjs185-dev cvs wget pkgconf sudo \
&& SUDO_FORCE_REMOVE=yes apt-get -y purge build-essential libnspr4-dev libncurses5-dev libncursesw5-dev libmozjs185-dev cvs wget pkgconf libcap2-bin sudo \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@ -60,6 +60,8 @@ ENV SBBSCTRL=/opt/sbbs/ctrl
ENV SBBSEXEC=/opt/sbbs/exec
ENV PATH=$PATH:${SBBSEXEC}
COPY start.sh ${SBBSEXEC}/
VOLUME [ "/var/lib/zerotier-one" ]
VOLUME [ "/opt/sbbs/data","/opt/sbbs/ctrl","/opt/sbbs/nodes","/opt/sbbs/fido","/opt/sbbs/text" ]
@ -69,4 +71,3 @@ COPY supervisord.d /etc/supervisor/conf.d/
COPY init /sbin/init
ENTRYPOINT [ "/sbin/init" ]
CMD ["sbbs"]

12
init
View File

@ -26,7 +26,11 @@ if [ -x /usr/sbin/zerotier-one -a -n "${ENABLE_ZT}" ]; then
/usr/sbin/zerotier-one -d
fi
# Start Supervisord
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
exec "$@"
if [ -n "$1" ]; then
echo "* Starting [$@]"
exec "$@"
else
# Start Supervisord
echo "* Starting supervisord"
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
fi

View File

@ -7,4 +7,6 @@
missingok
createolddir 775 root root
notifempty
copytruncate
dateyesterday
}

37
start.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
export SBBSCTRL=/opt/sbbs/ctrl
PIDFILE=/run/sbbs.pid
# Proxy signals
function kill_app(){
kill $(cat ${SBBS_PID})
exit 0 # exit okay
}
trap "kill_app" SIGINT SIGTERM
sbbs -d
sleep 5
SBBS_PID=$(cat ${PIDFILE})
echo "* SBBS PID [${SBBS_PID}]"
if [ -n ${SBBS_PID} ]; then
while [ -d /proc/${SBBS_PID} ]; do
NAME=$(cat /proc/${SBBS_PID}/cmdline |awk -F\00 '{print $1}')
#echo "* SBBS NAME [${NAME}]"
if [ ${NAME} != 'sbbs' ]; then
echo "! Name not matching? [${NAME}]"
break;
fi
sleep 15
done
echo "? SBBS stopped"
else
echo "? NO SBBS PID?"
fi
exit 1

3
supervisord.d/sbbs.conf Normal file
View File

@ -0,0 +1,3 @@
[program:sbbs]
command=/opt/sbbs/exec/start.sh
stopwaitsecs=60