diff --git a/plinth/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py index 763528641..c0fc801de 100644 --- a/plinth/modules/firewall/__init__.py +++ b/plinth/modules/firewall/__init__.py @@ -26,7 +26,7 @@ import plinth.service as service_module from plinth import actions, cfg from plinth.menu import main_menu from plinth.signals import service_enabled -from plinth.utils import format_lazy +from plinth.utils import Version, format_lazy from .manifest import backup @@ -65,6 +65,21 @@ def setup(helper, old_version=None): _run(['setup'], superuser=True) +def force_upgrade(helper, packages): + """Force upgrade firewalld to resolve conffile prompts.""" + if 'firewalld' not in packages: + return + + # firewalld 0.4.4.6-2 -> 0.6.x + package = packages['firewalld'] + if Version(package['current_version']) >= Version('0.6') or \ + Version(package['new_version']) < Version('0.6'): + return + + helper.install(['firewalld'], force_configuration='new') + _run(['setup'], superuser=True) + + def get_enabled_status(): """Return whether firewall is enabled""" output = _run(['get-status'], superuser=True)