Add package uninstall support

Adds the ability to uninstall packages to our install-packages scripts.

Change-Id: I72e0252968a151d71176aa479c7233f6df0a10ac
This commit is contained in:
James Slagle 2014-04-24 16:50:36 -04:00
parent 6b2a78f3ab
commit 6824181354
2 changed files with 8 additions and 1 deletions

View file

@ -29,6 +29,9 @@ install_deb_packages () {
if [ "$1" = "-u" ] ; then if [ "$1" = "-u" ] ; then
install_deb_packages dist-upgrade install_deb_packages dist-upgrade
exit 0 exit 0
elif [ "$1" = "-e" ]; then
install_deb_packages remove $@
shift
else else
install_deb_packages install $@ install_deb_packages install $@
fi fi

View file

@ -18,6 +18,7 @@
set -e set -e
EXTRA_ARGS= EXTRA_ARGS=
ACTION=install
if [ "$1" = "-u" ] ; then if [ "$1" = "-u" ] ; then
yum -y update yum -y update
@ -25,6 +26,9 @@ if [ "$1" = "-u" ] ; then
elif [ "$1" = "-d" ] ; then elif [ "$1" = "-d" ] ; then
EXTRA_ARGS="--downloadonly" EXTRA_ARGS="--downloadonly"
shift shift
elif [ "$1" = "-e" ]; then
ACTION=erase
shift
fi fi
# Packages that aren't available in the distro but requested for installation # 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 if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ]; then
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
fi fi
yum -y install $EXTRA_ARGS $(map-packages $WHITELIST) yum -y $ACTION $EXTRA_ARGS $(map-packages $WHITELIST)
for pkg in "$@"; do for pkg in "$@"; do
if [ "$pkg" = "python-pip" ] ; then if [ "$pkg" = "python-pip" ] ; then
alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10 alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10