1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-12 17:07:23 +01:00

Fixes #17: start services after unattended upgrades

This commit is contained in:
downtownallday
2022-12-02 15:09:29 -05:00
parent 36b5a31e82
commit e0a237c857
6 changed files with 81 additions and 26 deletions

View File

@@ -50,3 +50,12 @@ is_mounted() {
return 1
fi
}
system_installed_with_encryption_at_rest() {
# must be mounted!
if [ -e "$EHDD_IMG" -a ! -z "$STORAGE_ROOT" -a \
-e "$STORAGE_ROOT/ssl/ssl_private_key.pem" ]; then
return 0
fi
return 1
}

View File

@@ -11,28 +11,25 @@
. "ehdd/ehdd_funcs.sh" || exit 1
if [ -e "$EHDD_IMG" ]; then
if [ -s /etc/mailinabox.conf ]; then
echo ""
echo "** Disabling system services **"
systemctl disable --quiet postfix
systemctl disable --quiet dovecot
systemctl disable --quiet postgrey
systemctl disable --quiet cron
systemctl disable --quiet nginx
systemctl disable --quiet php8.0-fpm
systemctl disable --quiet mailinabox
systemctl disable --quiet fail2ban
systemctl disable --quiet miabldap-capture
#systemctl disable nsd
[ -x /usr/sbin/slapd ] && systemctl disable --quiet slapd
if system_installed_with_encryption_at_rest; then
echo ""
echo "** Disabling system services that require encrypted HDD to be mounted **"
systemctl disable --quiet postfix
systemctl disable --quiet dovecot
systemctl disable --quiet postgrey
systemctl disable --quiet cron
systemctl disable --quiet nginx
systemctl disable --quiet php8.0-fpm
systemctl disable --quiet mailinabox
systemctl disable --quiet fail2ban
systemctl disable --quiet miabldap-capture
#systemctl disable nsd
[ -x /usr/sbin/slapd ] && systemctl disable --quiet slapd
echo ""
echo "IMPORTANT:"
echo " Services have been disabled at startup because the encrypted HDD will"
echo " be unavailable. Run ehdd/run-this-after-reboot.sh after a reboot."
fi
echo ""
echo "IMPORTANT:"
echo " Services have been disabled at startup because the encrypted HDD will"
echo " be unavailable. Run ehdd/run-this-after-reboot.sh after a reboot."
fi

View File

@@ -8,21 +8,25 @@
##### details.
#####
ehdd/mount.sh || exit 1
if [ "${1:-}" != "--no-mount" ]; then
ehdd/mount.sh || exit 1
fi
if [ -s /etc/mailinabox.conf ]; then
. ehdd/ehdd_funcs.sh || exit 1
if system_installed_with_encryption_at_rest; then
[ -x /usr/sbin/slapd ] && systemctl start slapd
systemctl start php8.0-fpm
systemctl start dovecot
systemctl start postfix
# postgrey's main database and local client whitelist are in user-data
systemctl restart postgrey
systemctl start postgrey
systemctl start nginx
systemctl start cron
#systemctl start nsd
systemctl link -f $(pwd)/conf/mailinabox.service
systemctl link -q -f /lib/systemd/system/mailinabox.service
systemctl start fail2ban
systemctl restart mailinabox
systemctl start mailinabox
systemctl start miabldap-capture
fi