shadowsocks: Completely uninstall app

Test: Functional tests passed

Signed-off-by: nbenedek <contact@nbenedek.me>
[sunil: Update docstrings, make uninstall fail-safe]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
nbenedek 2023-04-07 03:14:10 +02:00 committed by Sunil Mohan Adapa
parent 6ab0be6f9a
commit 95e370a1bf
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 12 additions and 0 deletions

View File

@ -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()

View File

@ -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)