From e02dbd717b5c9b657c701cd351b37154d34bb548 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 22 May 2014 19:05:28 +1000 Subject: [PATCH] Stop using bash arrays for whitelisting in yum Using -n for bash arrays was a little bit bad, and also resulted in errors when running under set -u. Wean the yum element off the array and switch to a straight string. Change-Id: Ifd61fce7dadd5820022e9b2ab42020ba0cb71ce6 --- elements/yum/bin/install-packages | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elements/yum/bin/install-packages b/elements/yum/bin/install-packages index 11ca0995..b38fe65a 100755 --- a/elements/yum/bin/install-packages +++ b/elements/yum/bin/install-packages @@ -34,16 +34,16 @@ fi # Packages that aren't available in the distro but requested for installation # can be ignored by adding them to the exclude list BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "") -WHITELIST=() +WHITELIST= for i in "$@" do if [[ ! ${BLACKLIST[*]} =~ $i ]]; then - WHITELIST+="$i " + WHITELIST="$WHITELIST $i" else echo "The package $i is not available and will not be installed" fi done -if [ ${#WHITELIST[@]} -eq 0 ]; then +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