diff --git a/plinth/modules/email_server/__init__.py b/plinth/modules/email_server/__init__.py index 83311b4fa..ec8e14160 100644 --- a/plinth/modules/email_server/__init__.py +++ b/plinth/modules/email_server/__init__.py @@ -14,19 +14,12 @@ from plinth.modules.apache.components import Webserver from plinth.modules.config import get_domainname from plinth.modules.firewall.components import Firewall from plinth.modules.letsencrypt.components import LetsEncrypt -from plinth.package import Packages, packages_installed, remove +from plinth.package import Packages, remove from . import audit, manifest version = 1 -# Other likely install conflicts have been discarded: -# - msmtp, nullmailer, sendmail don't cause install faults. -# - qmail and smail are missing in Bullseye (Not tested, -# but less likely due to that). -package_conflicts = ('exim4-base', 'exim4-config', 'exim4-daemon-light') -package_conflicts_action = 'ignore' - clamav_packages = ['clamav', 'clamav-daemon'] clamav_daemons = ['clamav-daemon', 'clamav-freshclam'] @@ -56,10 +49,17 @@ class EmailServerApp(plinth.app.App): super().__init__() self._add_ui_components() - packages = Packages('packages-email-server', [ - 'postfix-ldap', 'postfix-sqlite', 'dovecot-pop3d', 'dovecot-imapd', - 'dovecot-ldap', 'dovecot-lmtpd', 'dovecot-managesieved' - ]) + # Other likely install conflicts have been discarded: + # - msmtp, nullmailer, sendmail don't cause install faults. + # - qmail and smail are missing in Bullseye (Not tested, + # but less likely due to that). + packages = Packages( + 'packages-email-server', [ + 'postfix-ldap', 'postfix-sqlite', 'dovecot-pop3d', + 'dovecot-imapd', 'dovecot-ldap', 'dovecot-lmtpd', + 'dovecot-managesieved' + ], conflicts=['exim4-base', 'exim4-config', 'exim4-daemon-light'], + conflicts_action=Packages.ConflictsAction.IGNORE) self.add(packages) packages = Packages('packages-email-server-skip-rec', ['rspamd'], @@ -147,7 +147,8 @@ def setup(helper, old_version=None): """Installs and configures module""" def _clear_conflicts(): - packages_to_remove = packages_installed(package_conflicts) + component = app.get_component('packages-email-server') + packages_to_remove = component.find_conflicts() if packages_to_remove: logger.info('Removing conflicting packages: %s', packages_to_remove) diff --git a/plinth/setup.py b/plinth/setup.py index 9e3d23dd1..ac436eaf6 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -13,7 +13,7 @@ from collections import defaultdict import apt import plinth -from plinth.package import Packages, packages_installed +from plinth.package import Packages from plinth.signals import post_setup from . import package @@ -187,15 +187,6 @@ class Helper(object): if pkg_name not in cache) return any(unavailable_pkgs) - def get_package_conflicts(self): - """Report list of conflicting packages for the user.""" - package_conflicts, package_conflicts_action = \ - _get_module_package_conflicts(self.module) - if package_conflicts: - package_conflicts = packages_installed(package_conflicts) - - return package_conflicts, package_conflicts_action - def init(module_name, module): """Create a setup helper for a module for later use.""" @@ -317,12 +308,6 @@ def _is_module_essential(module): return getattr(module, 'is_essential', False) -def _get_module_package_conflicts(module): - """Return list of packages that conflict with packages of a module.""" - return (getattr(module, 'package_conflicts', - None), getattr(module, 'package_conflicts_action', None)) - - def _module_state_matches(module, state): """Return if the current setup state of a module matches given state.""" return module.setup_helper.get_state() == state diff --git a/plinth/templates/setup.html b/plinth/templates/setup.html index 3d9d78bbf..0555d04bd 100644 --- a/plinth/templates/setup.html +++ b/plinth/templates/setup.html @@ -50,7 +50,7 @@ {% trans "Check again" %} - {% elif package_conflicts and package_conflicts_action != 'ignore' %} + {% elif package_conflicts and package_conflicts_action.value != 'ignore' %}