main: Run package operations immediately after startup

- When service is started, check if there are any configuration file prompts
pending and perform package updates.

- When service is started, check if there are any package version updates that
require app re-run.

- These operations are done in the same thread that does app version upgrade.
All three operations don't race against each other for apt lock. On the
downside, some operations may get delayed if previous operation fails
temporarily.

Tests:

- After service starts, after 'Setup completed' message we can see messages
'Attempting to perform post-dpkg operations', 'Completed post-dpkg operations',
'Attempting to perform upgrade', and 'Completed upgrade'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-04-07 14:05:40 -07:00 committed by James Valleroy
parent 2ceb80607a
commit bc116e028a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -102,8 +102,17 @@ def run_post_init_and_setup():
"""Run post-init operations on the apps and setup operations."""
app_module.apps_post_init()
frontpage.add_custom_shortcuts()
# Handle app version updates.
setup.run_setup_on_startup() # Long running, retrying
# Handle packages that have been updated else where that need a re-run of
# setup.
setup.on_dpkg_invoked()
# Handle packages that have a pending configuration file prompt.
setup.on_package_cache_updated()
def main():
"""Initialize and start the application"""