fix some bugs

This commit is contained in:
2019-12-09 05:11:52 -08:00
parent 53f3538cda
commit 2862faf676
4 changed files with 37 additions and 10 deletions

View File

@@ -9,19 +9,18 @@ if [[ ! -d /state/envdir ]]; then
chown mastodon:mastodon /state/envdir
fi
if [[ ! -e /state/envdir/WEB_DOMAIN ]]; then
if [[ -n "$WEB_DOMAIN" ]]; then
echo "$WEB_DOMAIN" > /state/envdir/WEB_DOMAIN
else
hostname --fqdn > /state/envdir/WEB_DOMAIN
fi
chown mastodon:mastodon /state/envdir/*
if [[ -z "$WEB_DOMAIN" ]]; then
WEB_DOMAIN="$(hostname --fqdn)"
fi
cat /etc/postfix/main.cf | grep -v '^myhostname' > /etc/postfix/main.new
if [[ -e /state/envdir/WEB_DOMAIN ]]; then
WEB_DOMAIN="$(cat /state/envdir/WEB_DOMAIN)"
fi
cat /etc/postfix/main.cf | grep -v '^myhostname' | grep -v '^myorigin' > /etc/postfix/main.new
rm /etc/postfix/main.cf
echo "myhostname = $(cat /state/envdir/WEB_DOMAIN)" >> /etc/postfix/main.cf
echo "myorigin = $(cat /state/envdir/WEB_DOMAIN)" >> /etc/postfix/main.cf
echo "myhostname = $WEB_DOMAIN" >> /etc/postfix/main.cf
echo "myorigin = $WEB_DOMAIN" >> /etc/postfix/main.cf
cat /etc/postfix/main.new >> /etc/postfix/main.cf
rm /etc/postfix/main.new

View File

@@ -24,6 +24,14 @@ if [[ ! -d /state/db ]]; then
chmod go-rwx /state/db/data
fi
function shutdown()
{
echo "Shutting down PostgreSQL"
pkill postgres
}
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP
exec \
chpst -u mastodon:mastodon \
/usr/lib/postgresql/10/bin/postmaster -D /state/db 2>&1