diff --git a/plinth/package.py b/plinth/package.py index a7dbcb734..c03223eb4 100644 --- a/plinth/package.py +++ b/plinth/package.py @@ -9,6 +9,7 @@ import logging import pathlib import subprocess import threading +import time from typing import Optional, Union import apt.cache @@ -403,6 +404,13 @@ def install(package_names, skip_recommends=False, force_configuration=None, return + start_time = time.time() + while is_package_manager_busy(): + if time.time() - start_time >= 24 * 3600: # One day + raise PackageException(_('Timeout waiting for package manager')) + + time.sleep(3) # seconds + logger.info('Running install for app - %s, packages - %s', operation.app_id, package_names) diff --git a/plinth/setup.py b/plinth/setup.py index 718127465..510ea8591 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -176,10 +176,6 @@ def _run_first_setup(): def _run_regular_setup(): """Run setup on all apps also installing required packages.""" - # TODO show notification that upgrades are running - if package.is_package_manager_busy(): - raise Exception('Package manager is busy.') - app_ids = _get_apps_for_regular_setup() run_setup_on_apps(app_ids, allow_install=True) diff --git a/plinth/templates/setup.html b/plinth/templates/setup.html index 6895ddfa6..77501a018 100644 --- a/plinth/templates/setup.html +++ b/plinth/templates/setup.html @@ -34,14 +34,7 @@