diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 943b032cc..1f9253ae8 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -91,6 +91,22 @@ class PackageManager: elif self.backend == "entropy": check_target_env_call(["equo", "rm"] + pkgs) + def update_db(self): + if self.backend == "packagekit": + check_target_env_call(["pkcon", "refresh"]) + elif self.backend == "zypp": + check_target_env_call(["zypper", "update"]) + elif self.backend == "urpmi": + check_target_env_call(["urpmi.update", "-a"]) + elif self.backend == "apt": + check_target_env_call(["apt-get", "update"]) + elif self.backend == "pacman": + check_target_env_call(["pacman", "-Sy"]) + elif self.backend == "portage": + check_target_env_call(["emerge", "--sync"]) + elif self.backend == "entropy": + check_target_env_call(["equo", "update"]) + def run_operations(pkgman, entry): """ Call package manager with given parameters. @@ -121,6 +137,10 @@ def run(): pkgman = PackageManager(backend) operations = libcalamares.job.configuration.get("operations", []) + update_db = libcalamares.job.configuration.get("update_db", False) + if update_db and libcalamares.globalstorage.value("hasInternet"): + pkgman.update_db() + for entry in operations: run_operations(pkgman, entry) diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index e72763731..8dd06d52f 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -12,6 +12,9 @@ # - entropy - Sabayon package manager # backend: packagekit + +update_db: true + # # List of maps with package operations such as install or remove. # Distro developers can provide a list of packages to remove @@ -38,7 +41,7 @@ backend: packagekit # - remove: # - pkg2 # - pkg1 -# install: +# - install: # - pkgs6 # - pkg7 # - localInstall: