Browse code

Add default for YUM

This allows tools/* to use install_packages, etc, without having to
pull in stackrc for the $YUM definition. Alternative to
Ief944af1ab177638bf818624a216751821e6330b

Change-Id: I7fe37079240e8cabbdffdcae5ad9d21e122e43c2

Ian Wienand authored on 2015/02/04 08:29:31
Showing 1 changed files
... ...
@@ -1208,7 +1208,7 @@ function uninstall_package {
1208 1208
     if is_ubuntu; then
1209 1209
         apt_get purge "$@"
1210 1210
     elif is_fedora; then
1211
-        sudo $YUM remove -y "$@" ||:
1211
+        sudo ${YUM:-yum} remove -y "$@" ||:
1212 1212
     elif is_suse; then
1213 1213
         sudo zypper rm "$@"
1214 1214
     else
... ...
@@ -1229,7 +1229,7 @@ function yum_install {
1229 1229
     # https://bugzilla.redhat.com/show_bug.cgi?id=965567
1230 1230
     $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
1231 1231
         no_proxy=$no_proxy \
1232
-        $YUM install -y "$@" 2>&1 | \
1232
+        ${YUM:-yum} install -y "$@" 2>&1 | \
1233 1233
         awk '
1234 1234
             BEGIN { fail=0 }
1235 1235
             /No package/ { fail=1 }
... ...
@@ -1239,7 +1239,7 @@ function yum_install {
1239 1239
 
1240 1240
     # also ensure we catch a yum failure
1241 1241
     if [[ ${PIPESTATUS[0]} != 0 ]]; then
1242
-        die $LINENO "$YUM install failure"
1242
+        die $LINENO "${YUM:-yum} install failure"
1243 1243
     fi
1244 1244
 }
1245 1245