Add option of updating packages db before perfoming package operations.
This commit is contained in:
parent
f43c600adc
commit
d4bdef0be3
@ -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)
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user