email: Start servers during re-setup if they are not running

- This helps during distribution upgrade from dovecot 2.3 to 2.4. Dovecot will
stop running due to dovecot server 2.4 not understanding version 2.3
configuration files. When setup is re-run, starting the daemons again is the
right thing to do.

Tests:

- With email app installed, upgrade from bookworm to trixie. Dovecot is stopped
during distribution upgrade but after freedombox service runs, it recovers and
starts running again.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2025-07-18 13:33:27 -07:00 committed by James Valleroy
parent c5ec10d9cb
commit e5eaaacb60
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -222,9 +222,10 @@ class EmailApp(plinth.app.App):
privileged.setup_spam()
# Restart daemons
service_privileged.try_restart('postfix')
service_privileged.try_restart('dovecot')
service_privileged.try_restart('rspamd')
if self.is_enabled():
service_privileged.restart('postfix')
service_privileged.restart('dovecot')
service_privileged.restart('rspamd')
# Expose to public internet
if old_version == 0: