mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
calibre: Remove libraries during uninstallation
Test: 1. Install Calibre, add a few books and libraries 2. Uninstall, then install Calibre 3. The default Library is present and empty Signed-off-by: nbenedek <contact@nbenedek.me> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
b21d88419c
commit
a5283771e0
@ -16,7 +16,7 @@ from plinth.modules.users.components import UsersAndGroups
|
||||
from plinth.package import Packages
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
from . import manifest
|
||||
from . import manifest, privileged
|
||||
|
||||
_description = [
|
||||
format_lazy(
|
||||
@ -106,6 +106,11 @@ class CalibreApp(app_module.App):
|
||||
if not old_version:
|
||||
self.enable()
|
||||
|
||||
def uninstall(self):
|
||||
"""De-configure and uninstall the app."""
|
||||
super().uninstall()
|
||||
privileged.uninstall()
|
||||
|
||||
|
||||
def validate_library_name(library_name):
|
||||
"""Raise exception if library name does not fit the accepted pattern."""
|
||||
|
||||
@ -45,3 +45,9 @@ def delete_library(name: str):
|
||||
library = LIBRARIES_PATH / name
|
||||
shutil.rmtree(library)
|
||||
action_utils.service_try_restart(calibre.CalibreApp.DAEMON)
|
||||
|
||||
|
||||
@privileged
|
||||
def uninstall():
|
||||
"""Remove all libraries during uninstall."""
|
||||
shutil.rmtree(LIBRARIES_PATH)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user