lwb5-in-2025/game/run-lwb5.sh

44 lines
956 B
Bash
Executable file

#!/bin/bash
(
cat <<EOF
defaults
tls $SMTP_TLS
tls_trust_file /etc/ssl/certs/ca-certificates.crt
syslog on
account account
host $SMTP_HOST
port $SMTP_PORT
auth $SMTP_AUTH
from $LW_MAIL_FROM
EOF
if [ "$SMTP_AUTH" = "on" ]; then
echo "user $SMTP_USER"
echo 'passwordeval "cat /run/secrets/smtp_password"'
fi
cat <<EOF
account default : account
aliases /etc/aliases
EOF
) > /etc/msmtprc
socat -u \
UNIX-LISTEN:/dev/log,reuseaddr,mode=666,fork \
SYSTEM:"(sed -z 's/$/\\\\n/'; /bin/echo)" \
&
perl /opt/lwb5/scripts/control.pl --start
: "${APACHE_CONFDIR:=/etc/apache2}"
: "${APACHE_RUN_DIR:=/run/apache2}"
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
: "${APACHE_LOG_DIR:=/var/log/apache2}"
: "${APACHE_RUN_USER:=www-data}"
: "${APACHE_RUN_GROUP:=www-data}"
rm -f "$APACHE_PID_FILE"
export APACHE_CONFDIR APACHE_RUN_DIR APACHE_PID_FILE \
APACHE_LOG_DIR APACHE_RUN_USER APACHE_RUN_GROUP
exec /usr/sbin/apache2 -DFOREGROUND "$@"