mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
infinoted: Completely uninstall app
Remove DATA_DIR, KEY_DIR, CONF_PATH and SYSTEMD_SERVICE_PATH during the uninstall process. I manually ran apt-get --purge autoremove infinoted and these files did not get deleted. Tests: 1. Compare the output of tree -ra /etc/infinoted/ /etc/infinoted/ before and after reinstalling the app: all the files get reinstalled properly 2. Functional tests: passed Signed-off-by: nbenedek <contact@nbenedek.me> [sunil: Update docstrings] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
99dfe9fe1e
commit
7e960e7491
@ -78,3 +78,8 @@ class InfinotedApp(app_module.App):
|
|||||||
super().setup(old_version)
|
super().setup(old_version)
|
||||||
privileged.setup()
|
privileged.setup()
|
||||||
self.enable()
|
self.enable()
|
||||||
|
|
||||||
|
def uninstall(self):
|
||||||
|
"""De-configure and uninstall the app."""
|
||||||
|
super().uninstall()
|
||||||
|
privileged.uninstall()
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import grp
|
import grp
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import pwd
|
import pwd
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -167,3 +168,13 @@ def setup():
|
|||||||
group='infinoted')
|
group='infinoted')
|
||||||
|
|
||||||
action_utils.service_enable('infinoted')
|
action_utils.service_enable('infinoted')
|
||||||
|
|
||||||
|
|
||||||
|
@privileged
|
||||||
|
def uninstall():
|
||||||
|
"""Remove data, certs, config and systemd unit files."""
|
||||||
|
for directory in DATA_DIR, KEY_DIR:
|
||||||
|
shutil.rmtree(directory, ignore_errors=True)
|
||||||
|
|
||||||
|
for file_ in CONF_PATH, SYSTEMD_SERVICE_PATH:
|
||||||
|
pathlib.Path(file_).unlink(missing_ok=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user