39 lines
886 B
Bash
Executable File
39 lines
886 B
Bash
Executable File
#!/bin/sh
|
|
|
|
: ${MBSE_ROOT=/opt/mbse}
|
|
|
|
PATH=${MBSE_ROOT}/bin:$PATH
|
|
export PATH
|
|
|
|
if [ ! -d "${MBSE_ROOT}/etc" ]; then
|
|
echo "* Installing MBSE data files into ${MBSE_ROOT}/data"
|
|
cp -a ${MBSE_ROOT}/template/* ${MBSE_ROOT}/data
|
|
fi
|
|
|
|
if [ -f "${MBSE_ROOT}/data/etc/users.data" ]; then
|
|
echo "* Restoring passwords"
|
|
mbse-pwfix
|
|
fi
|
|
|
|
for keytype in rsa ecdsa ed25519; do
|
|
if [ ! -f /etc/ssh/ssh_host_${keytype}_key ]; then
|
|
echo "* Generating ${keytype} ssh key"
|
|
/usr/libexec/openssh/sshd-keygen ${keytype}
|
|
fi
|
|
done
|
|
|
|
# clear out state and lockfiles from previous instance
|
|
rm -f ${MBSE_ROOT}/data/var/sema/*
|
|
rm -f ${MBSE_ROOT}/data/var/run/*
|
|
rm -f ${MBSE_ROOT}/data/tmp/*
|
|
|
|
chown -R mbse:bbs ${MBSE_ROOT}/data
|
|
|
|
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
|
|
|
|
exec "$@"
|