diff --git a/plinth/modules/roundcube/__init__.py b/plinth/modules/roundcube/__init__.py index 86e6ee0c2..214b087e7 100644 --- a/plinth/modules/roundcube/__init__.py +++ b/plinth/modules/roundcube/__init__.py @@ -95,6 +95,11 @@ class RoundcubeApp(app_module.App): privileged.set_config(local_only=True) self.enable() + def uninstall(self): + """De-configure and uninstall the app.""" + super().uninstall() + privileged.uninstall() + def force_upgrade(self, packages): """Force upgrade package to resolve conffile prompts.""" if 'roundcube-core' not in packages: diff --git a/plinth/modules/roundcube/manifest.py b/plinth/modules/roundcube/manifest.py index ee3219da3..314d6740c 100644 --- a/plinth/modules/roundcube/manifest.py +++ b/plinth/modules/roundcube/manifest.py @@ -10,4 +10,9 @@ clients = [{ }] }] -backup = {} +backup = { + 'data': { + 'files': ['/etc/roundcube/freedombox-config.php', + '/var/lib/dbconfig-common/sqlite3/roundcube/roundcube'] + } +} diff --git a/plinth/modules/roundcube/privileged.py b/plinth/modules/roundcube/privileged.py index 1fd6591ba..403e1e591 100644 --- a/plinth/modules/roundcube/privileged.py +++ b/plinth/modules/roundcube/privileged.py @@ -8,6 +8,8 @@ from plinth import action_utils from plinth.actions import privileged _config_file = pathlib.Path('/etc/roundcube/freedombox-config.php') +_rc_db_file = pathlib.Path('/var/lib/dbconfig-common/sqlite3/' + 'roundcube/roundcube') @privileged @@ -68,3 +70,10 @@ $config['smtp_helo_host'] = 'localhost'; ''' _config_file.write_text(config, encoding='utf-8') + + +@privileged +def uninstall(): + """Remove config file and database.""" + for item in _config_file, _rc_db_file: + item.unlink(missing_ok=True)