email: fix fresh installation issue

The changes introduced in https://salsa.debian.org/freedombox-team/freedombox/-/merge_requests/2616
make the email app installation fail if it's installed for the first
time.
This patch ensures that 95-freedombox-sieve.conf is present and that
dovecot is restarted before privileged.setup_spam() is run. This way,
the sievec command can run.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Benedek Nagy 2025-01-30 19:26:19 +01:00 committed by James Valleroy
parent e8f8e69143
commit 1ab78fb9da
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -109,7 +109,6 @@ class EmailApp(plinth.app.App):
'/etc/dovecot/conf.d/90-freedombox-mailboxes.conf',
'/etc/dovecot/conf.d/90-freedombox-master.conf',
'/etc/dovecot/conf.d/90-freedombox-tls.conf',
'/etc/dovecot/conf.d/95-freedombox-sieve.conf',
'/etc/dovecot/conf.d/freedombox-ldap.conf.ext',
'/etc/fail2ban/jail.d/dovecot-freedombox.conf',
'/etc/postfix/freedombox-aliases.cf',
@ -123,6 +122,7 @@ class EmailApp(plinth.app.App):
'/etc/dovecot/freedombox-sieve/learn-ham.sieve',
'/etc/dovecot/freedombox-sieve/learn-spam.sieve',
'/etc/dovecot/freedombox-sieve-after/sort-spam.sieve',
'/etc/dovecot/conf.d/95-freedombox-sieve.conf'
])
self.add(dropin_configs_sieve)
@ -212,6 +212,7 @@ class EmailApp(plinth.app.App):
# Enable drop-in configuration files component for sieve (temporarily)
# to ensure that sievec can compile.
self.get_component('dropin-configs-email-sieve').enable()
service_privileged.try_restart('dovecot')
privileged.setup_spam()
# Restart daemons