From a96aecc5af1414046ce5fc5c0881eef9ef7546b0 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 4 Aug 2014 15:42:36 +0100 Subject: [PATCH 01/15] Don't shallow clone on git versions lower than 1.7.10 Fixes #443 --- bootstrap-salt.sh | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7bf85c5..ce7db80 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1110,6 +1110,9 @@ __function_defined() { # specific revision. #---------------------------------------------------------------------------------------------------------------------- __git_clone_and_checkout() { + + echodebug "Installed git version: $(git --version | awk '{ print $3 }')" + SALT_GIT_CHECKOUT_DIR=/tmp/git/salt [ -d /tmp/git ] || mkdir /tmp/git cd /tmp/git @@ -1147,20 +1150,23 @@ __git_clone_and_checkout() { git pull --rebase || return 1 fi else - # Let's try shallow cloning to speed up - echoinfo "Attempting to shallow clone Salt's repository from ${_SALT_REPO_URL}" - git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" + __SHALLOW_CLONE="${BS_FALSE}" + # Let's try shallow cloning to speed up. + # Although unnecessary since "--depth 1" is passed, "--single-branch" is also passed because that option was + # introduced in git 1.7.10, the minimal version of git where the shallow cloning we need actually works + echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" + git clone --depth 1 --branch "$GIT_REV" --single-branch "$_SALT_REPO_URL" 2> /dev/null if [ $? -eq 0 ]; then cd "$SALT_GIT_CHECKOUT_DIR" - return 0 + __SHALLOW_CLONE="${BS_TRUE}" + else + # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. + echowarn "Failed to shallow clone." + echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" + git clone "$_SALT_REPO_URL" || return 1 + cd "$SALT_GIT_CHECKOUT_DIR" fi - # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. - echowarn "Failed to shallow clone." - echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" - git clone "$_SALT_REPO_URL" || return 1 - cd "$SALT_GIT_CHECKOUT_DIR" - if [ "$_SALT_REPO_URL" != "$_SALTSTACK_REPO_URL" ]; then # We need to add the saltstack repository as a remote and fetch tags for proper versioning echoinfo "Adding SaltStack's Salt repository as a remote" @@ -1169,8 +1175,10 @@ __git_clone_and_checkout() { git fetch --tags upstream fi - echodebug "Checking out $GIT_REV" - git checkout "$GIT_REV" || return 1 + if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then + echodebug "Checking out $GIT_REV" + git checkout "$GIT_REV" || return 1 + fi fi echoinfo "Cloning Salt's git repository succeeded" From 619b0ccc3c6283a56d4c380ee36938e62166e905 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 4 Aug 2014 15:43:21 +0100 Subject: [PATCH 02/15] Update changes log --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 30f145a..a2406b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ Version 2014.xx.xx: * Avoid redirect breakage when installing EPEL with rpm on RHEL 5 * Ensure python-apt is installed by the bootstrap script for Debian & Ubuntu minions. Thanks @garethgreenaway. + * Don't shallow clone on git versions lower than 1.7.10 * Distro Support Fixed: * Fixed the URL to download EPEL for Cent 5 * Use the full path to the `chkconfig` binary when checking for services in SysV init From 5f61298453160874a793ca4c43b9f06e4dd882f5 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 4 Aug 2014 16:14:48 +0100 Subject: [PATCH 03/15] Tests for `--single-branch` support separately. --- bootstrap-salt.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ce7db80..a8bdda8 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1152,17 +1152,25 @@ __git_clone_and_checkout() { else __SHALLOW_CLONE="${BS_FALSE}" # Let's try shallow cloning to speed up. - # Although unnecessary since "--depth 1" is passed, "--single-branch" is also passed because that option was - # introduced in git 1.7.10, the minimal version of git where the shallow cloning we need actually works - echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" - git clone --depth 1 --branch "$GIT_REV" --single-branch "$_SALT_REPO_URL" 2> /dev/null + # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow + # cloning we need actually works + git clone --single-branch 2>&1 /dev/null if [ $? -eq 0 ]; then - cd "$SALT_GIT_CHECKOUT_DIR" - __SHALLOW_CLONE="${BS_TRUE}" + # The "--single-branch" option is supported, attempt shallow cloning + echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" + git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" + if [ $? -eq 0 ]; then + cd "$SALT_GIT_CHECKOUT_DIR" + __SHALLOW_CLONE="${BS_TRUE}" + else + # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. + echowarn "Failed to shallow clone." + echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" + git clone "$_SALT_REPO_URL" || return 1 + cd "$SALT_GIT_CHECKOUT_DIR" + fi else - # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. - echowarn "Failed to shallow clone." - echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" + echodebug "Shallow cloning not possible. Required git version not met." git clone "$_SALT_REPO_URL" || return 1 cd "$SALT_GIT_CHECKOUT_DIR" fi From 0b7fac14c3f8ec4a3e80b66ff63693b8b3a4c2f9 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 11 Aug 2014 10:53:32 -0700 Subject: [PATCH 04/15] fix typo: DEAMON => DAEMON --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a8bdda8..7875c0c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4741,7 +4741,7 @@ if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; th [ ! -f /var/log/salt/$fname ] && echodebug "/var/log/salt/$fname does not exist. Can't cat its contents!" && continue - echodebug "DEAMON LOGS for $fname:" + echodebug "DAEMON LOGS for $fname:" echodebug "$(cat /var/log/salt/$fname)" echo done From 13778c8530b9b0f8a4c7ee7862d407e6c8e55625 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Aug 2014 02:24:42 +0100 Subject: [PATCH 05/15] Fix output redirect --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7875c0c..54b418c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1154,7 +1154,7 @@ __git_clone_and_checkout() { # Let's try shallow cloning to speed up. # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow # cloning we need actually works - git clone --single-branch 2>&1 /dev/null + git clone --single-branch > /dev/null 2>&1 if [ $? -eq 0 ]; then # The "--single-branch" option is supported, attempt shallow cloning echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" From 59ddc18e05bee18dd99367cbff8a086accb005ea Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Aug 2014 03:37:14 +0100 Subject: [PATCH 06/15] Configurable git checkout directory. --- bootstrap-salt.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 54b418c..a9bf3d4 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -32,6 +32,7 @@ __ScriptName="bootstrap-salt.sh" # * BS_UPGRADE_SYS: If 1 and an option, upgrade system. Default 0. # * BS_GENTOO_USE_BINHOST: If 1 add `--getbinpkg` to gentoo's emerge # * BS__SALT_MASTER_ADDRESS: The IP or DNS name of the salt-master the minion should connect to +# * BS_SALT_GIT_CHECKOUT_DIR: The directory where to clone Salt on git installations #====================================================================================================================== @@ -273,6 +274,7 @@ __SIMPLIFY_VERSION=$BS_TRUE _LIBCLOUD_MIN_VERSION="0.14.0" _EXTRA_PACKAGES="" _HTTP_PROXY="" +__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} while getopts ":hvnDc:g:k:MSNXCPFUKIA:i:Lp:H:" opt do @@ -457,11 +459,11 @@ echowarn "Running the unstable version of ${__ScriptName}" __exit_cleanup() { EXIT_CODE=$? - if [ "$ITYPE" = "git" ] && [ -d /tmp/git/salt ]; then + if [ "$ITYPE" = "git" ] && [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then if [ $_KEEP_TEMP_FILES -eq $BS_FALSE ]; then - # Clean up the checked out repositry + # Clean up the checked out repository echodebug "Cleaning up the Salt Temporary Git Repository" - rm -rf /tmp/git/salt + rm -rf "${__SALT_GIT_CHECKOUT_DIR}" else echowarn "Not cleaning up the Salt Temporary git repository on request" echowarn "Note that if you intend to re-run this script using the git approach, you might encounter some issues" @@ -1113,12 +1115,12 @@ __git_clone_and_checkout() { echodebug "Installed git version: $(git --version | awk '{ print $3 }')" - SALT_GIT_CHECKOUT_DIR=/tmp/git/salt - [ -d /tmp/git ] || mkdir /tmp/git - cd /tmp/git - if [ -d $SALT_GIT_CHECKOUT_DIR ]; then + __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}") + [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}" + cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" + if [ -d "${SALT_GIT_CHECKOUT_DIR}" ]; then echodebug "Found a checked out Salt repository" - cd $SALT_GIT_CHECKOUT_DIR + cd "${SALT_GIT_CHECKOUT_DIR}" echodebug "Fetching git changes" git fetch || return 1 # Tags are needed because of salt's versioning, also fetch that From 44ad9aea7bac1100cc3848a4b6e60f73dd2dd3de Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Aug 2014 03:39:38 +0100 Subject: [PATCH 07/15] Update changes log --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index a2406b1..cd0e9f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Version 2014.xx.xx: * Ensure python-apt is installed by the bootstrap script for Debian & Ubuntu minions. Thanks @garethgreenaway. * Don't shallow clone on git versions lower than 1.7.10 + * Configurable Salt repository clone directory for git based installations * Distro Support Fixed: * Fixed the URL to download EPEL for Cent 5 * Use the full path to the `chkconfig` binary when checking for services in SysV init From 4c1c6c625e16f0aa8132dca3620b64079b0cb62f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Aug 2014 03:39:43 +0100 Subject: [PATCH 08/15] Fix git `--single-branch` detection --- bootstrap-salt.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a9bf3d4..d113216 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1156,8 +1156,7 @@ __git_clone_and_checkout() { # Let's try shallow cloning to speed up. # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow # cloning we need actually works - git clone --single-branch > /dev/null 2>&1 - if [ $? -eq 0 ]; then + if [ "$(git clone --help | grep 'single-branch')" != "" ]; then # The "--single-branch" option is supported, attempt shallow cloning echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" From 3065bdcdcab81372307c2a5f77d2bca3913b899f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 14 Aug 2014 06:11:59 +0100 Subject: [PATCH 09/15] Fix SC2086. Double quote to prevent globbing and word splitting --- bootstrap-salt.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d113216..d53ccf9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1784,7 +1784,7 @@ install_ubuntu_daily() { } install_ubuntu_git() { - if [ -f ${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py ]; then + if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python setup.py install --install-layout=deb || return 1 @@ -1809,13 +1809,13 @@ install_ubuntu_git_post() { # upstart does not know about our service, let's copy the proper file echowarn "Upstart does not appear to know about salt-$fname" echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart to $_upstart_conf" - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart $_upstart_conf + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.upstart" $_upstart_conf fi # No upstart support in Ubuntu!? - elif [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then + elif [ -f "${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" ]; then echodebug "There's NO upstart support!?" - echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init to /etc/init.d/salt-$fname" - copyfile ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname + echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init to /etc/init.d/salt-$fname" + copyfile "${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname update-rc.d salt-$fname defaults else @@ -2246,7 +2246,7 @@ install_debian_git() { easy_install -U pyzmq || return 1 fi - if [ -f ${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py ]; then + if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python setup.py install --install-layout=deb || return 1 @@ -2409,7 +2409,7 @@ install_fedora_git_post() { [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) sleep 0.1 @@ -2616,7 +2616,7 @@ install_centos_git() { else _PYEXE=python2 fi - if [ -f ${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py ]; then + if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then $_PYEXE setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1 else $_PYEXE setup.py install || return 1 @@ -2634,7 +2634,7 @@ install_centos_git_post() { # While the RPM's use init.d, so will we. if [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname} /etc/init.d/ + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d/ chmod +x /etc/init.d/salt-${fname} /sbin/chkconfig salt-${fname} on fi @@ -3306,7 +3306,7 @@ install_arch_linux_stable() { } install_arch_linux_git() { - if [ -f ${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py ]; then + if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python2 setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python2 setup.py install || return 1 @@ -3357,11 +3357,11 @@ install_arch_linux_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /usr/bin/systemctl ]; then - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" - /usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || ( - /usr/bin/systemctl preset salt-$fname.service > /dev/null 2>&1 && - /usr/bin/systemctl enable salt-$fname.service > /dev/null 2>&1 + /usr/bin/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || ( + /usr/bin/systemctl preset salt-${fname}.service > /dev/null 2>&1 && + /usr/bin/systemctl enable salt-${fname}.service > /dev/null 2>&1 ) sleep 0.1 /usr/bin/systemctl daemon-reload @@ -3369,7 +3369,7 @@ install_arch_linux_git_post() { fi # SysV init!? - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/rc.d/init.d/salt-$fname + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/rc.d/init.d/salt-$fname" chmod +x /etc/rc.d/init.d/salt-$fname done } @@ -3918,11 +3918,11 @@ install_opensuse_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.service /lib/systemd/system/salt-$fname.service + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" continue fi - copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/init.d/salt-$fname + copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname done From 6638ce4ddca282435fb388c457cb43ed46c77a96 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 17 Aug 2014 00:58:55 +0100 Subject: [PATCH 10/15] Only shallow clone on version tags. Fix missed references of `SALT_GIT_CHECKOUT_DIR` to `__SALT_GIT_CHECKOUT_DIR` Fixes saltstack/salt#14855 --- bootstrap-salt.sh | 109 ++++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 51 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d53ccf9..098dd77 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1118,9 +1118,9 @@ __git_clone_and_checkout() { __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}") [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}" cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" - if [ -d "${SALT_GIT_CHECKOUT_DIR}" ]; then + if [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then echodebug "Found a checked out Salt repository" - cd "${SALT_GIT_CHECKOUT_DIR}" + cd "${__SALT_GIT_CHECKOUT_DIR}" echodebug "Fetching git changes" git fetch || return 1 # Tags are needed because of salt's versioning, also fetch that @@ -1153,27 +1153,34 @@ __git_clone_and_checkout() { fi else __SHALLOW_CLONE="${BS_FALSE}" - # Let's try shallow cloning to speed up. - # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow - # cloning we need actually works - if [ "$(git clone --help | grep 'single-branch')" != "" ]; then - # The "--single-branch" option is supported, attempt shallow cloning - echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" - git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" - if [ $? -eq 0 ]; then - cd "$SALT_GIT_CHECKOUT_DIR" - __SHALLOW_CLONE="${BS_TRUE}" + if [ "$(echo "$GIT_REV" | sed 's/^.*\(v[[:digit:]]\{1,4\}\.[[:digit:]]\{1,2\}\.[[:digit:]]\{1,2\}\).*$/MATCH/')" = "MATCH" ]; then + echoinfo "Git revision matches a Salt version tag" + # Let's try shallow cloning to speed up. + # Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow + # cloning we need actually works + if [ "$(git clone --help | grep 'single-branch')" != "" ]; then + # The "--single-branch" option is supported, attempt shallow cloning + echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" + git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" || return 1 + if [ $? -eq 0 ]; then + cd "${__SALT_GIT_CHECKOUT_DIR}" + __SHALLOW_CLONE="${BS_TRUE}" + else + # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. + echowarn "Failed to shallow clone." + echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" + git clone "$_SALT_REPO_URL" || return 1 + cd "${__SALT_GIT_CHECKOUT_DIR}" + fi else - # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. - echowarn "Failed to shallow clone." - echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" + echodebug "Shallow cloning not possible. Required git version not met." git clone "$_SALT_REPO_URL" || return 1 - cd "$SALT_GIT_CHECKOUT_DIR" + cd "${__SALT_GIT_CHECKOUT_DIR}" fi else - echodebug "Shallow cloning not possible. Required git version not met." + echowarn "The git revision being installed does not match a Salt version tag. Shallow cloning disabled" git clone "$_SALT_REPO_URL" || return 1 - cd "$SALT_GIT_CHECKOUT_DIR" + cd "${__SALT_GIT_CHECKOUT_DIR}" fi if [ "$_SALT_REPO_URL" != "$_SALTSTACK_REPO_URL" ]; then @@ -1755,7 +1762,7 @@ install_ubuntu_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -1784,7 +1791,7 @@ install_ubuntu_daily() { } install_ubuntu_git() { - if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python setup.py install --install-layout=deb || return 1 @@ -1808,14 +1815,14 @@ install_ubuntu_git_post() { if [ ! -f $_upstart_conf ]; then # upstart does not know about our service, let's copy the proper file echowarn "Upstart does not appear to know about salt-$fname" - echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart to $_upstart_conf" - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.upstart" $_upstart_conf + echodebug "Copying ${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart to $_upstart_conf" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.upstart" $_upstart_conf fi # No upstart support in Ubuntu!? - elif [ -f "${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" ]; then + elif [ -f "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" ]; then echodebug "There's NO upstart support!?" - echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init to /etc/init.d/salt-$fname" - copyfile "${SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/etc/init.d/salt-$fname" + echodebug "Copying ${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init to /etc/init.d/salt-$fname" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname update-rc.d salt-$fname defaults else @@ -2138,7 +2145,7 @@ install_debian_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -2171,7 +2178,7 @@ install_debian_6_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi else @@ -2246,7 +2253,7 @@ install_debian_git() { easy_install -U pyzmq || return 1 fi - if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python setup.py install --install-layout=deb || return 1 @@ -2277,8 +2284,8 @@ install_debian_git_post() { [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f "${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" ]; then - copyfile "${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" "/etc/init.d/salt-$fname" + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" ]; then + copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" "/etc/init.d/salt-$fname" fi if [ ! -f "/etc/init.d/salt-$fname" ]; then echowarn "The init script for salt-$fname was not found, skipping it..." @@ -2384,7 +2391,7 @@ install_fedora_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -2392,7 +2399,7 @@ install_fedora_git_deps() { } install_fedora_git() { - if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python setup.py install || return 1 @@ -2409,7 +2416,7 @@ install_fedora_git_post() { [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) sleep 0.1 @@ -2603,7 +2610,7 @@ install_centos_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -2616,7 +2623,7 @@ install_centos_git() { else _PYEXE=python2 fi - if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then $_PYEXE setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1 else $_PYEXE setup.py install || return 1 @@ -2634,7 +2641,7 @@ install_centos_git_post() { # While the RPM's use init.d, so will we. if [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d/ + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d/ chmod +x /etc/init.d/salt-${fname} /sbin/chkconfig salt-${fname} on fi @@ -2644,11 +2651,11 @@ install_centos_git_post() { # /sbin/initctl status salt-$fname > /dev/null 2>&1 # if [ $? -eq 1 ]; then # # upstart does not know about our service, let's copy the proper file - # copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart /etc/init/salt-$fname.conf + # copyfile ${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart /etc/init/salt-$fname.conf # fi ## Still in SysV init?! #elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - # copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname} /etc/init.d/ + # copyfile ${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname} /etc/init.d/ # chmod +x /etc/init.d/salt-${fname} # /sbin/chkconfig salt-${fname} on #fi @@ -3203,7 +3210,7 @@ install_amazon_linux_ami_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -3286,7 +3293,7 @@ install_arch_linux_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -3306,7 +3313,7 @@ install_arch_linux_stable() { } install_arch_linux_git() { - if [ -f "${SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python2 setup.py install --salt-config-dir="$_SALT_ETC_DIR" || return 1 else python2 setup.py install || return 1 @@ -3357,7 +3364,7 @@ install_arch_linux_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /usr/bin/systemctl ]; then - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" /usr/bin/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || ( /usr/bin/systemctl preset salt-${fname}.service > /dev/null 2>&1 && @@ -3369,7 +3376,7 @@ install_arch_linux_git_post() { fi # SysV init!? - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/rc.d/init.d/salt-$fname" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/rc.d/init.d/salt-$fname" chmod +x /etc/rc.d/init.d/salt-$fname done } @@ -3550,7 +3557,7 @@ install_freebsd_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -3702,7 +3709,7 @@ install_smartos_git_deps() { __git_clone_and_checkout || return 1 # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -3764,13 +3771,13 @@ install_smartos_git_post() { svcs "network/salt-$fname" > /dev/null 2>&1 if [ $? -eq 1 ]; then - svccfg import "${SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml" + svccfg import "${__SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml" if [ "${VIRTUAL_TYPE}" = "global" ]; then if [ ! -d $smf_dir ]; then mkdir -p "$smf_dir" fi if [ ! -f "$smf_dir/salt-$fname.xml" ]; then - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml" "$smf_dir/" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/smartos/salt-$fname.xml" "$smf_dir/" fi fi fi @@ -3858,7 +3865,7 @@ install_opensuse_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -3918,11 +3925,11 @@ install_opensuse_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" continue fi - copyfile "${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/init.d/salt-$fname" + copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname done @@ -4076,7 +4083,7 @@ install_suse_11_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/" + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi From 7e317613055dcc2a0bd7c6774ead9b3f11505e9c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 17 Aug 2014 01:04:31 +0100 Subject: [PATCH 11/15] Update changes log --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index cd0e9f2..efd7c26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Version 2014.xx.xx: * Ensure python-apt is installed by the bootstrap script for Debian & Ubuntu minions. Thanks @garethgreenaway. * Don't shallow clone on git versions lower than 1.7.10 + * Only shallow clone on git tag based installations * Configurable Salt repository clone directory for git based installations * Distro Support Fixed: * Fixed the URL to download EPEL for Cent 5 From 4abbc61e8a6e7ed000c40ed1838000e58a3639b3 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 19 Aug 2014 18:39:24 +0100 Subject: [PATCH 12/15] This is not the place to stop execution! --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 098dd77..ac86136 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1161,7 +1161,7 @@ __git_clone_and_checkout() { if [ "$(git clone --help | grep 'single-branch')" != "" ]; then # The "--single-branch" option is supported, attempt shallow cloning echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" - git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" || return 1 + git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" if [ $? -eq 0 ]; then cd "${__SALT_GIT_CHECKOUT_DIR}" __SHALLOW_CLONE="${BS_TRUE}" From 10354034ee7056417649d41a35af86ffcdf1022a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 19 Aug 2014 19:13:58 +0100 Subject: [PATCH 13/15] Match against the supported clone protocols --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ac86136..524e429 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1183,12 +1183,12 @@ __git_clone_and_checkout() { cd "${__SALT_GIT_CHECKOUT_DIR}" fi - if [ "$_SALT_REPO_URL" != "$_SALTSTACK_REPO_URL" ]; then + if [ "$(echo "$_SALT_REPO_URL" | sed 's/^\(\(git\|https\)\:\/\/github\.com\/saltstack\/salt\.git\|git@github.com\:saltstack\/salt\.git\)$/MATCH/')" != "MATCH" ]; then # We need to add the saltstack repository as a remote and fetch tags for proper versioning echoinfo "Adding SaltStack's Salt repository as a remote" - git remote add upstream "$_SALTSTACK_REPO_URL" + git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 echodebug "Fetching upstream(SaltStack's Salt repository) git tags" - git fetch --tags upstream + git fetch --tags upstream || return 1 fi if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then From 94380222f828c827d9cdfd1d76c1304435a55d70 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 21 Aug 2014 00:52:23 +0100 Subject: [PATCH 14/15] Move usage lower to make use of `_SALT_ETC_DIR` --- bootstrap-salt.sh | 78 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 524e429..16a76ac 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -175,6 +175,43 @@ __check_config_dir() { } +#---------------------------------------------------------------------------------------------------------------------- +# Handle command line arguments +#---------------------------------------------------------------------------------------------------------------------- +_KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE} +_TEMP_CONFIG_DIR="null" +_SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git" +_SALT_REPO_URL=${_SALTSTACK_REPO_URL} +_TEMP_KEYS_DIR="null" +_INSTALL_MASTER=$BS_FALSE +_INSTALL_SYNDIC=$BS_FALSE +_INSTALL_MINION=$BS_TRUE +_INSTALL_CLOUD=$BS_FALSE +_START_DAEMONS=$BS_TRUE +_ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE} +_CONFIG_ONLY=$BS_FALSE +_PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE} +_SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt} +_PKI_DIR=${_SALT_ETC_DIR}/pki +_FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE} +_GENTOO_USE_BINHOST=${BS_GENTOO_USE_BINHOST:-$BS_FALSE} +_EPEL_REPO=${BS_EPEL_REPO:-epel} +__EPEL_REPOS_INSTALLED=${BS_FALSE} +_UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE} +_INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE} +_WGET_ARGS=${BS_WGET_ARGS:-} +_CURL_ARGS=${BS_CURL_ARGS:-} +_FETCH_ARGS=${BS_FETCH_ARGS:-} +_SALT_MASTER_ADDRESS=${BS_SALT_MASTER_ADDRESS:-null} +_SALT_MINION_ID="null" +# __SIMPLIFY_VERSION is mostly used in Solaris based distributions +__SIMPLIFY_VERSION=$BS_TRUE +_LIBCLOUD_MIN_VERSION="0.14.0" +_EXTRA_PACKAGES="" +_HTTP_PROXY="" +__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: usage # DESCRIPTION: Display usage information. @@ -227,9 +264,9 @@ usage() { -I If set, allow insecure connections while downloading any files. For example, pass '--no-check-certificate' to 'wget' or '--insecure' to 'curl' -A Pass the salt-master DNS name or IP. This will be stored under - \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf + \${_SALT_ETC_DIR}/minion.d/99-master-address.conf -i Pass the salt-minion id. This will be stored under - \${BS_SALT_ETC_DIR}/minion_id + \${_SALT_ETC_DIR}/minion_id -L Install the Apache Libcloud package if possible(required for salt-cloud) -p Extra-package to install while installing salt dependencies. One package per -p flag. You're responsible for providing the proper package name. @@ -239,43 +276,6 @@ EOT } # ---------- end of function usage ---------- - -#---------------------------------------------------------------------------------------------------------------------- -# Handle command line arguments -#---------------------------------------------------------------------------------------------------------------------- -_KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE} -_TEMP_CONFIG_DIR="null" -_SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git" -_SALT_REPO_URL=${_SALTSTACK_REPO_URL} -_TEMP_KEYS_DIR="null" -_INSTALL_MASTER=$BS_FALSE -_INSTALL_SYNDIC=$BS_FALSE -_INSTALL_MINION=$BS_TRUE -_INSTALL_CLOUD=$BS_FALSE -_START_DAEMONS=$BS_TRUE -_ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE} -_CONFIG_ONLY=$BS_FALSE -_PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE} -_SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt} -_PKI_DIR=${_SALT_ETC_DIR}/pki -_FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE} -_GENTOO_USE_BINHOST=${BS_GENTOO_USE_BINHOST:-$BS_FALSE} -_EPEL_REPO=${BS_EPEL_REPO:-epel} -__EPEL_REPOS_INSTALLED=${BS_FALSE} -_UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE} -_INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE} -_WGET_ARGS=${BS_WGET_ARGS:-} -_CURL_ARGS=${BS_CURL_ARGS:-} -_FETCH_ARGS=${BS_FETCH_ARGS:-} -_SALT_MASTER_ADDRESS=${BS_SALT_MASTER_ADDRESS:-null} -_SALT_MINION_ID="null" -# __SIMPLIFY_VERSION is mostly used in Solaris based distributions -__SIMPLIFY_VERSION=$BS_TRUE -_LIBCLOUD_MIN_VERSION="0.14.0" -_EXTRA_PACKAGES="" -_HTTP_PROXY="" -__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} - while getopts ":hvnDc:g:k:MSNXCPFUKIA:i:Lp:H:" opt do case "${opt}" in From 1dee68dc1d01c0b88553168b89e544879e942687 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 21 Aug 2014 00:58:16 +0100 Subject: [PATCH 15/15] The evaluated value --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 16a76ac..1f869ba 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -264,9 +264,9 @@ usage() { -I If set, allow insecure connections while downloading any files. For example, pass '--no-check-certificate' to 'wget' or '--insecure' to 'curl' -A Pass the salt-master DNS name or IP. This will be stored under - \${_SALT_ETC_DIR}/minion.d/99-master-address.conf + ${_SALT_ETC_DIR}/minion.d/99-master-address.conf -i Pass the salt-minion id. This will be stored under - \${_SALT_ETC_DIR}/minion_id + ${_SALT_ETC_DIR}/minion_id -L Install the Apache Libcloud package if possible(required for salt-cloud) -p Extra-package to install while installing salt dependencies. One package per -p flag. You're responsible for providing the proper package name.