From f9499b3b925b4c8a31b91edc933f7af6bcaecc73 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Mon, 27 Feb 2017 18:31:33 +0100 Subject: [PATCH 1/3] Remove bashism from install_amazon_linux_ami_deps for all systems not so bashily endowed --- bootstrap-salt.sh | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f535570..230c00e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4383,29 +4383,14 @@ install_amazon_linux_ami_deps() { # Shim to figure out if we're using old (rhel) or new (aws) rpms. _USEAWS=$BS_FALSE - # See if STABLE_REV is set, if not, then we're a testing, which we'll just default to old way for now. - if [ "$ITYPE" = "stable" ]; then - repo_rev="$STABLE_REV" - else - repo_rev="latest" - fi - # Remove "archive/" from the version - # shellcheck disable=SC2034,SC2039 - IFS='.' read -r MAJOR MINOR PATCH <<< "$repo_rev" - # shellcheck disable=SC2034,SC2039 - if [[ "$MAJOR" == *"archive/"** ]]; then - # shellcheck disable=SC2034,SC2039 - IFS='/' read -r JUNK MAJOR <<< "$MAJOR" - fi - - # Do we have versions new enough to use the aws built packages? or default back to rhel/centos 6. - # shellcheck disable=SC2034,SC2039 - if [ "$repo_rev" == "latest" ]; then + repo_rev="$(echo ${GIT_REV:-$STABLE_REV}| sed 's|.*\/||g')" + if $(echo "$repo_rev" | egrep -q '^(latest|2016\.11)$'); then _USEAWS=$BS_TRUE - elif [[ ("$MAJOR" -ge "2016" && "$MINOR" -ge "11") || "$MAJOR" -gt "2016" ]]; then + elif $(echo "$repo_rev" | egrep -q '^[0-9]+$') && [ $(echo "$repo_rev" | cut -c1-4) -gt 2016 ]; then _USEAWS=$BS_TRUE fi + # We need to install yum-utils before doing anything else when installing on # Amazon Linux ECS-optimized images. See issue #974. yum -y install yum-utils From 2103dd64ec7ea1c23de6514693b650932c87eec9 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 3 Mar 2017 22:22:37 +0100 Subject: [PATCH 2/3] spellchecker fixes --- bootstrap-salt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 230c00e..99e61e4 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4384,9 +4384,11 @@ install_amazon_linux_ami_deps() { # Shim to figure out if we're using old (rhel) or new (aws) rpms. _USEAWS=$BS_FALSE - repo_rev="$(echo ${GIT_REV:-$STABLE_REV}| sed 's|.*\/||g')" + repo_rev="$(echo "${GIT_REV:-$STABLE_REV}" | sed 's|.*\/||g')" + # shellcheck disable=SC2091 if $(echo "$repo_rev" | egrep -q '^(latest|2016\.11)$'); then _USEAWS=$BS_TRUE + # shellcheck disable=SC2091 elif $(echo "$repo_rev" | egrep -q '^[0-9]+$') && [ $(echo "$repo_rev" | cut -c1-4) -gt 2016 ]; then _USEAWS=$BS_TRUE fi From 83b16e162f1aeaf360b6f8d7cba08441f0d6d5ee Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Thu, 9 Mar 2017 15:43:25 +0100 Subject: [PATCH 3/3] ShellCheck fixes p2 --- bootstrap-salt.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 99e61e4..71a5788 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4385,11 +4385,10 @@ install_amazon_linux_ami_deps() { _USEAWS=$BS_FALSE repo_rev="$(echo "${GIT_REV:-$STABLE_REV}" | sed 's|.*\/||g')" - # shellcheck disable=SC2091 - if $(echo "$repo_rev" | egrep -q '^(latest|2016\.11)$'); then + + if echo "$repo_rev" | egrep -q '^(latest|2016\.11)$'; then _USEAWS=$BS_TRUE - # shellcheck disable=SC2091 - elif $(echo "$repo_rev" | egrep -q '^[0-9]+$') && [ $(echo "$repo_rev" | cut -c1-4) -gt 2016 ]; then + elif echo "$repo_rev" | egrep -q '^[0-9]+$' && [ "$(echo "$repo_rev" | cut -c1-4)" -gt 2016 ]; then _USEAWS=$BS_TRUE fi