mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
Closes: #1447 Find and rerun setup for apps after a dpkg operation is completed. This is needed in a couple of situations: 1) Some Debian packages don't manage the database used by the package. When these packages are updated, their database schema is left at an older version and service might become unavailable. FreedomBox can perform the database schema upgrade. However, FreedomBox needs to know when a package has been updated so that database schema can be upgraded. 2) A package is installed but FreedomBox has not modified its configuration. Newer version of package becomes available with a new configuration file. Since the original configuration file has not changed at all, the new configuration file overwrites the old one and unattended-upgrades deals with this case. Now, say, the configuration file modifies some defaults that FreedomBox expects things might break. In this case, FreedomBox can apply the require configuration changes but it needs to notified as soon as the package has been updated. When apt runs dpkg, after the operation is completed it triggers commands listed under the configuration 'Dpkg::Post-Invoke'. This in turn calls this class via a DBus notification. Here, we iterate through all the apps. If an app is currently installed and interested in rerunning setup after dpkg operations, then its setup is rerun. Interest is expressed using the 'rerun_setup_on_upgrade' flag on the Package() component. If all packages of the app have not be upgraded since the last check, we skip the operation. Tests: - When an app is installed from FreedomBox, the trigger is not run. - When a package is installed from command line with apt, the trigger is run. It does nothing. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>