mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
bepasty: Completely uninstall app
During the uninstall process: * Remove bepasty data directory * Remove freedombox config file * Remove bepasty user (and group) Test: * Manually test if data is indeed removed * Run functional tests Signed-off-by: nbenedek <contact@nbenedek.me> [sunil: Update docstrings, make uninstall fail-safe] [sunil: Remove bapasty group as well] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
a6e728fc0f
commit
3d71869211
@ -99,3 +99,8 @@ class BepastyApp(app_module.App):
|
||||
# Upgrade to a better default only if user hasn't changed the
|
||||
# value.
|
||||
privileged.set_default(['read'])
|
||||
|
||||
def uninstall(self):
|
||||
"""De-configure and uninstall the app."""
|
||||
super().uninstall()
|
||||
privileged.uninstall()
|
||||
|
||||
@ -168,3 +168,12 @@ def _generate_password():
|
||||
"""Generate a random password."""
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
return ''.join(secrets.choice(alphabet) for _ in range(PASSWORD_LENGTH))
|
||||
|
||||
|
||||
@privileged
|
||||
def uninstall():
|
||||
"""Remove bepasty user, group and data."""
|
||||
shutil.rmtree(DATA_DIR, ignore_errors=True)
|
||||
CONF_FILE.unlink(missing_ok=True)
|
||||
subprocess.run(['deluser', 'bepasty'], check=False)
|
||||
subprocess.run(['delgroup', 'bepasty'], check=False)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user