From be7fd45393c54704fc5532d881b92e29f41c16c1 Mon Sep 17 00:00:00 2001 From: nbenedek Date: Fri, 7 Apr 2023 02:56:28 +0200 Subject: [PATCH] searx: Completely uninstall app * If only the SETTINGS_FILE gets removed, the setup process fails afterwards * Don't remove the public access file since the setup process will remove it anyway 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/searx/__init__.py | 5 +++++ plinth/modules/searx/privileged.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/plinth/modules/searx/__init__.py b/plinth/modules/searx/__init__.py index f0b0fafc9..f367629f8 100644 --- a/plinth/modules/searx/__init__.py +++ b/plinth/modules/searx/__init__.py @@ -100,6 +100,11 @@ class SearxApp(app_module.App): self.enable() self.set_shortcut_login_required(True) + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.unininstall() + class SearxWebserverAuth(Webserver): """Component to handle Searx authentication webserver configuration.""" diff --git a/plinth/modules/searx/privileged.py b/plinth/modules/searx/privileged.py index fd5c35997..78f6d574e 100644 --- a/plinth/modules/searx/privileged.py +++ b/plinth/modules/searx/privileged.py @@ -153,3 +153,10 @@ def disable_public_access(): """Disable public access to the SearX application.""" if os.path.exists(PUBLIC_ACCESS_SETTING_FILE): os.remove(PUBLIC_ACCESS_SETTING_FILE) + + +@privileged +def unininstall(): + """Remove configuration uWSGI file.""" + shutil.rmtree('/etc/searx', ignore_errors=True) + pathlib.Path(UWSGI_FILE).unlink(missing_ok=True)