From 95e370a1bf5608145e800f205e5e8f074cd685da Mon Sep 17 00:00:00 2001 From: nbenedek Date: Fri, 7 Apr 2023 03:14:10 +0200 Subject: [PATCH] shadowsocks: Completely uninstall app Test: Functional tests passed Signed-off-by: nbenedek [sunil: Update docstrings, make uninstall fail-safe] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/shadowsocks/__init__.py | 5 +++++ plinth/modules/shadowsocks/privileged.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/plinth/modules/shadowsocks/__init__.py b/plinth/modules/shadowsocks/__init__.py index c0d45df36..e8c7b75a7 100644 --- a/plinth/modules/shadowsocks/__init__.py +++ b/plinth/modules/shadowsocks/__init__.py @@ -84,3 +84,8 @@ class ShadowsocksApp(app_module.App): super().setup(old_version) privileged.setup() self.enable() + + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.uninstall() diff --git a/plinth/modules/shadowsocks/privileged.py b/plinth/modules/shadowsocks/privileged.py index 39cdbe6b4..88d0509a1 100644 --- a/plinth/modules/shadowsocks/privileged.py +++ b/plinth/modules/shadowsocks/privileged.py @@ -95,3 +95,10 @@ def merge_config(config: dict[str, Union[int, str]]): from . import ShadowsocksApp if action_utils.service_is_enabled(ShadowsocksApp.DAEMON): action_utils.service_restart(ShadowsocksApp.DAEMON) + + +@privileged +def uninstall(): + """Remove configuration files.""" + for path in SHADOWSOCKS_CONFIG_SYMLINK, SHADOWSOCKS_CONFIG_ACTUAL: + pathlib.Path(path).unlink(missing_ok=True)