mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 02:45:37 -04:00
Some more PEP
This commit is contained in:
parent
db7577b9f8
commit
bc66502fda
5 changed files with 58 additions and 55 deletions
|
@ -34,26 +34,29 @@ class PackageManager:
|
|||
""" Installs packages.
|
||||
|
||||
:param pkgs:
|
||||
:param from_local:
|
||||
"""
|
||||
if self.backend == "packagekit":
|
||||
for pkg in pkgs:
|
||||
check_chroot_call(["pkcon", "-py", "install", pkg])
|
||||
elif self.backend == "zypp":
|
||||
check_chroot_call(
|
||||
["zypper", "--non-interactive", "--quiet-install", "install",
|
||||
"--auto-agree-with-licenses", "install"] + pkgs)
|
||||
check_chroot_call(["zypper", "--non-interactive", "--quiet-install", "install",
|
||||
"--auto-agree-with-licenses", "install"] + pkgs)
|
||||
elif self.backend == "yum":
|
||||
check_chroot_call(["yum", "install", "-y"] + pkgs)
|
||||
elif self.backend == "dnf":
|
||||
check_chroot_call(["dnf", "install", "-y"] + pkgs)
|
||||
elif self.backend == "urpmi":
|
||||
check_chroot_call(
|
||||
["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
|
||||
"--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
|
||||
check_chroot_call(["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
|
||||
"--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
|
||||
elif self.backend == "apt":
|
||||
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
|
||||
elif self.backend == "pacman":
|
||||
pacman_flags = "-U" if from_local else "-Sy"
|
||||
if from_local:
|
||||
pacman_flags = "-U"
|
||||
else:
|
||||
pacman_flags = "-Sy"
|
||||
|
||||
check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs)
|
||||
elif self.backend == "portage":
|
||||
check_chroot_call(["emerge", "-v"] + pkgs)
|
||||
|
@ -110,17 +113,19 @@ def run():
|
|||
:return:
|
||||
"""
|
||||
backend = libcalamares.job.configuration.get("backend")
|
||||
|
||||
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman", "portage", "entropy"):
|
||||
return ("Bad backend", "backend=\"{}\"".format(backend))
|
||||
return "Bad backend", "backend=\"{}\"".format(backend)
|
||||
|
||||
pkgman = PackageManager(backend)
|
||||
|
||||
operations = libcalamares.job.configuration.get("operations", [])
|
||||
|
||||
for entry in operations:
|
||||
run_operations(pkgman, entry)
|
||||
|
||||
if libcalamares.globalstorage.contains("packageOperations"):
|
||||
operations = libcalamares.globalstorage.value("packageOperations")
|
||||
|
||||
for entry in operations:
|
||||
run_operations(pkgman, entry)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue