From 72bc0bd9a9825cd4fd77bd5a0410535501c0aafc Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 12 Mar 2015 03:52:31 -0700 Subject: [PATCH] Support alternate (non bleeding edge) ubuntu PPAs. --- bootstrap-salt.sh | 49 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 00daf99..abf268d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -224,12 +224,14 @@ usage() { Installation types: - stable (default) + - stable [version] (ubuntu specific) - daily (ubuntu specific) - git Examples: - ${__ScriptName} - ${__ScriptName} stable + - ${__ScriptName} stable 2014.7 - ${__ScriptName} daily - ${__ScriptName} git - ${__ScriptName} git develop @@ -410,6 +412,20 @@ if [ "$ITYPE" = "git" ]; then GIT_REV="$1" shift fi +# If doing stable install, check if version specified +elif [ "$ITYPE" = "stable" ]; then + if [ "$#" -eq 0 ];then + STABLE_REV="latest" + else + __check_unparsed_options "$*" + if [ "$(echo "$1" | egrep '(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.2)')" = "" ]; then + STABLE_REV="$1" + shift + else + echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.2, latest)" + exit 1 + fi + fi fi # Check for any unparsed arguments. Should be an error. @@ -1103,6 +1119,9 @@ fi if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 +elif ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$STABLE_REV" != "latest" ]); then + echoerror "${DISTRO_NAME} does have major version pegged packages support" + exit 1 fi # Only RedHat based distros have testing support @@ -1698,15 +1717,6 @@ install_ubuntu_deps() { __enable_universe_repository || return 1 - if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then - # Above Ubuntu 11.04 add a -y flag - add-apt-repository -y ppa:saltstack/salt || return 1 - else - add-apt-repository ppa:saltstack/salt || return 1 - fi - - apt-get update - # Minimal systems might not have upstart installed, install it __apt_get_install_noinput upstart @@ -1757,6 +1767,27 @@ install_ubuntu_deps() { return 0 } +install_ubuntu_stable_deps() { + install_ubuntu_deps || return 1 + + STABLE_PPA="saltstack/salt" + # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 + if [ "$(echo "$STABLE_REV" | egrep '(1\.6|1\.7))')" = "" ]; then + STABLE_PPA="$STABLE_PPA$(echo "$STABLE_REV" | tr -d .)" + elif [ "$(echo "$STABLE_REV" | egrep '(2014\.1|2014\.7|2015\.2)')" = "" ]; then + STABLE_PPA="$STABLE_PPA$(echo "$1" | tr . -)" + fi + + if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then + # Above Ubuntu 11.04 add a -y flag + add-apt-repository -y "ppa:$STABLE_PPA" || return 1 + else + add-apt-repository "ppa:$STABLE_PPA" || return 1 + fi + + apt-get update +} + install_ubuntu_daily_deps() { install_ubuntu_deps || return 1 if [ "$DISTRO_MAJOR_VERSION" -ge 12 ]; then