From 7470ee26e03e484c807e7b49a1ae6ad21242c3a2 Mon Sep 17 00:00:00 2001 From: K Jonathan Harker Date: Fri, 3 Nov 2017 10:14:30 -0700 Subject: [PATCH] zypper: fix package removal zypper only supports the --no-recommends option during installs, giving the option during removals results in an error. When setting ACTION=remove, remove --no-recommends from EXTRA_ARGS, and set --clean-deps to also remove no-longer-needed dependencies. Rename EXTRA_ARGS to ACTION_ARGS for increased readability. Change-Id: Ifbd168992b1a20658b6b4a99ba175234f6c78f6d --- diskimage_builder/elements/zypper/bin/install-packages | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diskimage_builder/elements/zypper/bin/install-packages b/diskimage_builder/elements/zypper/bin/install-packages index 6d61d616..aa56c8db 100755 --- a/diskimage_builder/elements/zypper/bin/install-packages +++ b/diskimage_builder/elements/zypper/bin/install-packages @@ -20,9 +20,9 @@ fi set -eu set -o pipefail -EXTRA_ARGS="--no-recommends" MAP_ELEMENT= ACTION=install +ACTION_ARGS="--no-recommends" SCRIPTNAME=$(basename $0) function show_options () { @@ -48,8 +48,8 @@ eval set -- "$TEMP" while true ; do case "$1" in -u) run_zypper dist-upgrade --no-recommends; exit 0;; - -e) ACTION="remove"; shift;; - -d) EXTRA_ARGS="--download-only"; shift;; + -e) ACTION="remove"; ACTION_ARGS="--clean-deps"; shift;; + -d) ACTION_ARGS="${ACTION_ARGS} --download-only"; shift;; -m) MAP_ELEMENT=$2; shift 2;; -h) show_options;; --) shift; break ;; @@ -68,5 +68,5 @@ fi if [ -z "${PKGS}" ]; then echo "Not running install-packages $ACTION with empty packages list" else - run_zypper $ACTION $EXTRA_ARGS $PKGS + run_zypper $ACTION $ACTION_ARGS $PKGS fi