email: Fix issue with install caused by missing drop-in config file

During installation of email app, sievec is run on
/etc/dovecot/freedombox-sieve-after/sort-spam.sieve file to produce a binary
version of the file. However, this file is not available until after the app is
enabled. This is due to the newly introduced drop-in configuration mechanism. To
fix this, during setup, enable the drop-in configuration component responsible
for this file. The component is newly split from the component that deals with
all drop-in components so that not all the drop-in configuration files are
symlinked.

There is no change needed to the app when the drop-in configuration component is
split into multiple components. This is true for all three state of the app;
not-installed, installed-enabled, and installed-disabled.

Tests:

- Install latest code with ./setup.py install. Install the app and it works.

- Uninstall the app and reinstall. It works. There are no warnings that config
file have been replaced with symlinks.

- /etc/dovecot/freedombox-sieve-after has the sort-span.svbin binary sievec
compiled file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2023-09-26 10:26:00 -07:00 committed by James Valleroy
parent 577358b7dd
commit 9cfd8a2e55
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -113,7 +113,6 @@ class EmailApp(plinth.app.App):
'/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/dovecot/freedombox-sieve-after/sort-spam.sieve',
'/etc/fail2ban/jail.d/dovecot-freedombox.conf',
'/etc/postfix/freedombox-aliases.cf',
'/etc/rspamd/local.d/freedombox-logging.inc',
@ -121,6 +120,10 @@ class EmailApp(plinth.app.App):
'/etc/rspamd/local.d/freedombox-redis.conf',
])
self.add(dropin_configs)
dropin_configs_sieve = DropinConfigs(
'dropin-configs-email-sieve',
['/etc/dovecot/freedombox-sieve-after/sort-spam.sieve'])
self.add(dropin_configs_sieve)
listen_ports = [(25, 'tcp4'), (25, 'tcp6'), (465, 'tcp4'),
(465, 'tcp6'), (587, 'tcp4'), (587, 'tcp6')]
@ -204,6 +207,10 @@ class EmailApp(plinth.app.App):
aliases.first_setup()
privileged.setup_postfix()
aliases.setup_common_aliases(_get_first_admin())
# Enable drop-in configuration files component for sieve (temporarily)
# to ensure that sievec can compile.
self.get_component('dropin-configs-email-sieve').enable()
privileged.setup_spam()
# Restart daemons