From 9cfd8a2e55a691aeba8c0bec0f221891bbcb360c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 26 Sep 2023 10:26:00 -0700 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/modules/email/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plinth/modules/email/__init__.py b/plinth/modules/email/__init__.py index 4f8d88bc6..666dee9f4 100644 --- a/plinth/modules/email/__init__.py +++ b/plinth/modules/email/__init__.py @@ -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