Merge "Add YUM variable to for Fedora >= 22"

This commit is contained in:
Jenkins 2015-07-17 23:44:14 +00:00 committed by Gerrit Code Review
commit 148a5fc40a
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,8 @@
# since f22, dnf is the yum replacement. Mostly it drops in
# unmodified, so while we transision KISS and use this to choose
if [ $DIB_RELEASE -ge 22 ]; then
export YUM=dnf
else
export YUM=yum
fi

View File

@ -24,6 +24,9 @@ EXTRA_ARGS=
ACTION=install ACTION=install
MAP_ELEMENT= MAP_ELEMENT=
# allow override for dnf, as shipped by default with >=F22
YUM=${YUM:-yum}
SCRIPTNAME=$(basename $0) SCRIPTNAME=$(basename $0)
function show_options () { function show_options () {
echo "Usage: $SCRIPTNAME [package ...]" echo "Usage: $SCRIPTNAME [package ...]"
@ -42,7 +45,7 @@ eval set -- "$TEMP"
while true ; do while true ; do
case "$1" in case "$1" in
-u) yum -y update; exit 0;; -u) ${YUM} -y update; exit 0;;
-d) EXTRA_ARGS="--downloadonly"; shift;; -d) EXTRA_ARGS="--downloadonly"; shift;;
-e) ACTION="erase"; shift;; -e) ACTION="erase"; shift;;
-m) MAP_ELEMENT=$2; shift 2;; -m) MAP_ELEMENT=$2; shift 2;;
@ -52,6 +55,7 @@ while true ; do
esac esac
done done
# Packages that aren't available in the distro but requested for installation # Packages that aren't available in the distro but requested for installation
# can be ignored by adding them to the exclude list # can be ignored by adding them to the exclude list
BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "") BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "")
@ -87,7 +91,7 @@ if [ -n "$WHITELIST" ]; then
echo "Not running install-packages $ACTION with empty packages list" echo "Not running install-packages $ACTION with empty packages list"
else else
echo "Running install-packages ${ACTION}. Package list: $PKGS" echo "Running install-packages ${ACTION}. Package list: $PKGS"
yum -y $ACTION $EXTRA_ARGS $PKGS ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS
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