From 6824181354f05a1941b8d74e53abce20fa6bbabc Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 24 Apr 2014 16:50:36 -0400 Subject: [PATCH] Add package uninstall support Adds the ability to uninstall packages to our install-packages scripts. Change-Id: I72e0252968a151d71176aa479c7233f6df0a10ac --- elements/dpkg/bin/install-packages | 3 +++ elements/yum/bin/install-packages | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/elements/dpkg/bin/install-packages b/elements/dpkg/bin/install-packages index fb62429b..d1d925fe 100755 --- a/elements/dpkg/bin/install-packages +++ b/elements/dpkg/bin/install-packages @@ -29,6 +29,9 @@ install_deb_packages () { if [ "$1" = "-u" ] ; then install_deb_packages dist-upgrade exit 0 +elif [ "$1" = "-e" ]; then + install_deb_packages remove $@ + shift else install_deb_packages install $@ fi diff --git a/elements/yum/bin/install-packages b/elements/yum/bin/install-packages index 956cc235..dbd1c4c2 100755 --- a/elements/yum/bin/install-packages +++ b/elements/yum/bin/install-packages @@ -18,6 +18,7 @@ set -e EXTRA_ARGS= +ACTION=install if [ "$1" = "-u" ] ; then yum -y update @@ -25,6 +26,9 @@ if [ "$1" = "-u" ] ; then elif [ "$1" = "-d" ] ; then EXTRA_ARGS="--downloadonly" shift +elif [ "$1" = "-e" ]; then + ACTION=erase + shift fi # Packages that aren't available in the distro but requested for installation @@ -43,7 +47,7 @@ if [ -n "$WHITELIST" ]; then if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ]; then rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release fi - yum -y install $EXTRA_ARGS $(map-packages $WHITELIST) + yum -y $ACTION $EXTRA_ARGS $(map-packages $WHITELIST) for pkg in "$@"; do if [ "$pkg" = "python-pip" ] ; then alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10