opensuse: Support pkg removal in install-packages

Add "-e" option to remove packages. This is needed for
elements/package-installs/bin/package-uninstalls which calls
"install-packages -e".

Change-Id: I673942f505d5278e6015324950f6e1455ba50805
This commit is contained in:
Thomas Bechtold 2014-09-11 10:48:05 +02:00
parent 9fb2c1425a
commit 80b1f49f77

View File

@ -19,6 +19,7 @@ set -o pipefail
EXTRA_ARGS="" EXTRA_ARGS=""
MAP_ELEMENT="" MAP_ELEMENT=""
ACTION=install
SCRIPTNAME=$(basename $0) SCRIPTNAME=$(basename $0)
function show_options () { function show_options () {
@ -26,6 +27,7 @@ function show_options () {
echo echo
echo "Options:" echo "Options:"
echo " -u -- update all packages" echo " -u -- update all packages"
echo " -e -- erase/remove packages"
echo " -d -- download the packages only" echo " -d -- download the packages only"
echo " -m -- use custom element package map (Example: -m nova)" echo " -m -- use custom element package map (Example: -m nova)"
exit 0 exit 0
@ -43,6 +45,7 @@ eval set -- "$TEMP"
while true ; do while true ; do
case "$1" in case "$1" in
-u) run_zypper dist-upgrade; exit 0;; -u) run_zypper dist-upgrade; exit 0;;
-e) ACTION="remove"; shift;;
-d) EXTRA_ARGS="--download-only"; shift;; -d) EXTRA_ARGS="--download-only"; shift;;
-m) MAP_ELEMENT=$2; shift 2;; -m) MAP_ELEMENT=$2; shift 2;;
-h) show_options;; -h) show_options;;
@ -84,6 +87,6 @@ if [ -n "$WHITELIST" ]; then
if [ -z "${PKGS}" ]; then if [ -z "${PKGS}" ]; then
echo 'No packages need to be installed' echo 'No packages need to be installed'
else else
run_zypper install $EXTRA_ARGS $PKGS run_zypper $ACTION $EXTRA_ARGS $PKGS
fi fi
fi fi