From 5c6a302112cee89476c6846129dfbb64b1cb6079 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 19 Jan 2015 03:06:12 +0100 Subject: [PATCH] packages: Ignore error code for "dnf remove". Unfortunately, dnf treats it as an error if we try to remove a package that already did not exist. This means that, e.g., if we try to remove calamares itself, but calamares was not installed on the base image, only in the overlay, we will fail with an error. So, as long as we do not have a better solution, we ignore the exit code of "dnf remove" entirely. (yum does not show this behavior, it returns success when the package to remove is already not installed.) --- src/modules/packages/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 709930ccc..4f4fa74a8 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -18,7 +18,7 @@ # along with Calamares. If not, see . import libcalamares -from libcalamares.utils import check_chroot_call +from libcalamares.utils import check_chroot_call, chroot_call class PackageManager: def __init__(self, backend): @@ -50,7 +50,8 @@ class PackageManager: elif self.backend == "yum": check_chroot_call(["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs) elif self.backend == "dnf": - check_chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] + pkgs) + # ignore the error code for now because dnf thinks removing a nonexistent package is an error + chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] + pkgs) elif self.backend == "urpmi": check_chroot_call(["urpme"] + pkgs) elif self.backend == "apt":