From 9da8cc2407f65237d8242826e4b2c15d849d6b80 Mon Sep 17 00:00:00 2001 From: "C. R. Oldham" Date: Thu, 5 Feb 2015 14:49:12 -0700 Subject: [PATCH 001/156] If bootstrap is passed -C to config only, make sure that keys and config are overwritten --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 567967f..155b792 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4468,24 +4468,24 @@ config_salt() { CONFIGURED_ANYTHING=$BS_TRUE fi - if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then + if [ "$_INSTALL_MINION" -eq "$BS_TRUE" ] || [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then # Create the PKI directory [ -d "$_PKI_DIR/minion" ] || (mkdir -p "$_PKI_DIR/minion" && chmod 700 "$_PKI_DIR/minion") || return 1 # Copy the minions configuration if found if [ -f "$_TEMP_CONFIG_DIR/minion" ]; then - movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" || return 1 + movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$BS_TRUE" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi # Copy the minion's keys if found if [ -f "$_TEMP_CONFIG_DIR/minion.pem" ]; then - movefile "$_TEMP_CONFIG_DIR/minion.pem" "$_PKI_DIR/minion/" || return 1 + movefile "$_TEMP_CONFIG_DIR/minion.pem" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 chmod 400 "$_PKI_DIR/minion/minion.pem" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi if [ -f "$_TEMP_CONFIG_DIR/minion.pub" ]; then - movefile "$_TEMP_CONFIG_DIR/minion.pub" "$_PKI_DIR/minion/" || return 1 + movefile "$_TEMP_CONFIG_DIR/minion.pub" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 chmod 664 "$_PKI_DIR/minion/minion.pub" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi From ebe11ffc4a73aa5dba3a7496d5ea3043bf99000d Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Tue, 31 Mar 2015 23:39:23 +0200 Subject: [PATCH 002/156] Fix when using upstream tags When the need arises for upstream tag fetching, the branch can only be checked out using `upstream/`. This is the actual error FreeBSD runs into in #550. This is on Ubuntu 14.04, git version 1.9.1: ``` * INFO: Adding SaltStack's Salt repository as a remote + git remote add upstream https://github.com/saltstack/salt.git + echodebug Fetching upstream(SaltStack's Salt repository) git tags + [ 1 -eq 1 ] + printf \033[1;34m * DEBUG\033[0m: %s\n Fetching upstream(SaltStack's Salt repository) git tags * DEBUG: Fetching upstream(SaltStack's Salt repository) git tags + git fetch --tags upstream From https://github.com/saltstack/salt * [new branch] 0.11 -> upstream/0.11 * [new branch] 0.12 -> upstream/0.12 * [new branch] 0.13 -> upstream/0.13 * [new branch] 0.14 -> upstream/0.14 * [new branch] 0.15 -> upstream/0.15 * [new branch] 0.16 -> upstream/0.16 * [new branch] 0.17 -> upstream/0.17 * [new branch] 2014.1 -> upstream/2014.1 * [new branch] 2014.7 -> upstream/2014.7 * [new branch] 2015.2 -> upstream/2015.2 * [new branch] develop -> upstream/develop + [ 0 -eq 0 ] + echodebug Checking out 2015.2 + [ 1 -eq 1 ] + printf \033[1;34m * DEBUG\033[0m: %s\n Checking out 2015.2 * DEBUG: Checking out 2015.2 + git checkout 2015.2 error: pathspec '2015.2' did not match any file(s) known to git. + return 1 + return 1 + [ 1 -ne 0 ] + echoerror Failed to run install_ubuntu_git_deps()!!! + printf \033[1;31m * ERROR\033[0m: %s\n Failed to run install_ubuntu_git_deps()!!! * ERROR: Failed to run install_ubuntu_git_deps()!!! + exit 1 ``` --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 00daf99..4f0dc5e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1217,6 +1217,7 @@ __git_clone_and_checkout() { git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 echodebug "Fetching upstream(SaltStack's Salt repository) git tags" git fetch --tags upstream || return 1 + GIT_REV="upstream/$GIT_REV" fi if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then From 0b5d73dba93b773b7f40965a302dc99d96400a5c Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Sat, 4 Apr 2015 15:34:55 +0200 Subject: [PATCH 003/156] Change 'upstream' to 'origin'; fetch origin/$GIT_REV on alternate repos --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4f0dc5e..d36ee55 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1217,7 +1217,7 @@ __git_clone_and_checkout() { git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 echodebug "Fetching upstream(SaltStack's Salt repository) git tags" git fetch --tags upstream || return 1 - GIT_REV="upstream/$GIT_REV" + GIT_REV="origin/$GIT_REV" fi if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then From 5c0c89f8b342b690ed08679f19034561b6369466 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 4 Nov 2015 18:52:57 +0100 Subject: [PATCH 004/156] Add support for pegged versions on YUM based OS'ses through repo.saltstack.com --- bootstrap-salt.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index cb6d88b..58c9160 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1205,7 +1205,7 @@ __ubuntu_codename_translation if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 -elif ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then +elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat|scientific|oracle|amazon|fedora)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi @@ -2940,6 +2940,11 @@ gpgkey=https://repo.saltstack.com/yum/rhel5/SALTSTACK-EL5-GPG-KEY.pub enabled=1 enabled_metadata=1 _eof + if [ "$STABLE_REV" != "latest" ]; then + cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" +includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* +_eof + fi __fetch_url /tmp/repo-saltstack-el5.pub "https://repo.saltstack.com/yum/rhel5/SALTSTACK-EL5-GPG-KEY.pub" || return 1 rpm --import /tmp/repo-saltstack-el5.pub || return 1 @@ -2960,6 +2965,11 @@ gpgkey=https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/SALTSTACK-GPG- enabled=1 enabled_metadata=1 _eof + if [ "$STABLE_REV" != "latest" ]; then + cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" +includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* +_eof + fi __fetch_url /tmp/repo-saltstack.pub "https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/SALTSTACK-GPG-KEY.pub" || return 1 rpm --import /tmp/repo-saltstack.pub || return 1 From 8c65b7439a32d877480a9ee4bf62bfcebe572cb3 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Thu, 5 Nov 2015 13:37:22 +0100 Subject: [PATCH 005/156] fix for git installs not having STABLE_REV --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 58c9160..9e0d976 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2940,7 +2940,7 @@ gpgkey=https://repo.saltstack.com/yum/rhel5/SALTSTACK-EL5-GPG-KEY.pub enabled=1 enabled_metadata=1 _eof - if [ "$STABLE_REV" != "latest" ]; then + if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* _eof @@ -2965,7 +2965,7 @@ gpgkey=https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/SALTSTACK-GPG- enabled=1 enabled_metadata=1 _eof - if [ "$STABLE_REV" != "latest" ]; then + if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* _eof From bc089167b4f547339c16f7c00409faab823e6144 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 6 Nov 2015 15:47:55 +0100 Subject: [PATCH 006/156] CentOS/RHEL 6 don't test for '^[' to determine whether to us glob matching; widen glob somewhat to fix --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9e0d976..f16e5bd 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2942,7 +2942,7 @@ enabled_metadata=1 _eof if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" -includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* +includepkgs=?:[!s][!a][!l][!t]* salt*${STABLE_REV}* _eof fi @@ -2967,7 +2967,7 @@ enabled_metadata=1 _eof if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" -includepkgs=[0-9]:[!s][!a][!l][!t]* salt*${STABLE_REV}* +includepkgs=?:[!s][!a][!l][!t]* salt*${STABLE_REV}* _eof fi From 791866c298491791bde1a5185be9cf05b0475b7c Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 6 Nov 2015 18:23:04 +0100 Subject: [PATCH 007/156] Ubuntu should use HTTPS for key & pkg retrieval as well --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f16e5bd..527b6b5 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1877,12 +1877,12 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb https://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV $DISTRO_CODENAME main" >> \ /etc/apt/sources.list.d/saltstack.list fi # shellcheck disable=SC2086 - wget $_WGET_ARGS -q http://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 From 440d1215346933dcea3a17e1ad16c678123b2237 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 6 Nov 2015 18:26:40 +0100 Subject: [PATCH 008/156] Ubuntu should use HTTPS for key retrieval; pkgs apparently can't be done --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 527b6b5..4309a18 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1877,7 +1877,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb https://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb http://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV $DISTRO_CODENAME main" >> \ /etc/apt/sources.list.d/saltstack.list fi From efede7d75b905cfa4e44c683d33166402426ada0 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Wed, 18 Nov 2015 14:32:04 +0800 Subject: [PATCH 009/156] Process -s (default sleep for service restarts) in bootstrap-salt.sh An -s option for the 'default sleep' time in bootstrap-salt.sh is documented in the usage instructions, but not implemented. This commit lets bootstrap-salt.sh recognise and use the -s option. --- bootstrap-salt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 28dee15..50ab0f9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -291,7 +291,7 @@ EOT } # ---------- end of function usage ---------- -while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zb" opt +while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbs:" opt do case "${opt}" in @@ -326,6 +326,7 @@ do exit 1 fi ;; + s ) __DEFAULT_SLEEP="$OPTARG" ;; M ) _INSTALL_MASTER=$BS_TRUE ;; S ) _INSTALL_SYNDIC=$BS_TRUE ;; N ) _INSTALL_MINION=$BS_FALSE ;; From 7f834d56269341e5f3749d3841edc2e49ccf424b Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Thu, 19 Nov 2015 14:02:17 +0300 Subject: [PATCH 010/156] support openSUSE Leap 42.1 --- bootstrap-salt.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 28dee15..4faee75 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4544,7 +4544,11 @@ __zypper_install() { } install_opensuse_stable_deps() { - DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" + if [ ${DISTRO_MAJOR_VERSION} -ge 42 ]; then + DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" + else + DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" + fi # Is the repository already known __zypper repos | grep devel_languages_python >/dev/null 2>&1 @@ -4572,9 +4576,17 @@ install_opensuse_stable_deps() { # Salt needs python-zypp installed in order to use the zypper module __PACKAGES="python-zypp" - __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-M2Crypto python-PyYAML python-requests" + __PACKAGES="${__PACKAGES} python python-Jinja2 python-M2Crypto python-PyYAML python-requests" __PACKAGES="${__PACKAGES} python-msgpack-python python-pycrypto python-pyzmq python-xml" + if [ "$DISTRO_MAJOR_VERSION" -lt 13 ]; then + __PACKAGES="${__PACKAGES} libzmq3" + elif [ "$DISTRO_MAJOR_VERSION" -eq 13 ]; then + __PACKAGES="${__PACKAGES} libzmq4" + elif [ "$DISTRO_MAJOR_VERSION" -gt 13 ]; then + __PACKAGES="${__PACKAGES} libzmq5" + fi + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then __PACKAGES="${__PACKAGES} python-apache-libcloud" fi From 27b8611e5884118aec544be3fc291fea56b87ae1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 19 Nov 2015 12:00:15 +0000 Subject: [PATCH 011/156] Double quote to prevent globing and word spliting --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4faee75..ad99bec 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4544,7 +4544,7 @@ __zypper_install() { } install_opensuse_stable_deps() { - if [ ${DISTRO_MAJOR_VERSION} -ge 42 ]; then + if [ "${DISTRO_MAJOR_VERSION}" -ge 42 ]; then DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" else DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" From 9347fbd2f8850b39914c4fb6bd620e1ef9fcc8e6 Mon Sep 17 00:00:00 2001 From: Steve Groesz Date: Thu, 3 Dec 2015 23:59:12 -0600 Subject: [PATCH 012/156] Update bootstrap-salt.sh Some cleanup for Debian Deps, especially for Debian 8 where some Dep packages may not have been installed --- bootstrap-salt.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ad99bec..045028b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2149,7 +2149,6 @@ install_debian_deps() { # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 6 # need to be installed using pip check_pip_allowed "You need to allow pip based installations (-P) in order to install the python 'requests' package" - # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} python-pip" # shellcheck disable=SC2089 __PIP_PACKAGES="${__PIP_PACKAGES} 'requests>=$_PY_REQUESTS_MIN_VERSION'" @@ -2328,7 +2327,7 @@ install_debian_7_deps() { apt-get update || return 1 __apt_get_install_noinput -t wheezy-backports libzmq3 libzmq3-dev python-zmq python-apt || return 1 - # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + # Install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="procps pciutils" # Also install python-requests __PACKAGES="${__PACKAGES} python-requests" @@ -2391,8 +2390,8 @@ install_debian_8_deps() { apt-get update || return 1 __PACKAGES="libzmq3 libzmq3-dev python-zmq python-requests python-apt" - # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 - __PACKAGES="procps pciutils" + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" # Also install python-requests __PACKAGES="${__PACKAGES} python-requests" From 592e75a27fb99cbd63a65cf8832d6a0af23c6710 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Dec 2015 11:43:13 +0000 Subject: [PATCH 013/156] Update changes log --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index ff7ccb1..4adc5b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Version 2015.xx.xx: + * Add support for openSUSE Leap. Thanks Roman Inflianskas(rominf). #693 + * Fix missing deps installation on Debian. Thanks Steve Groesz(wolfpackmars2). #699 + + Version 2015.11.09 * Make sure that wget is installed. #868 From 7671ae5631e43a8041f4e32e77e17ec4abd13442 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Dec 2015 11:43:54 +0000 Subject: [PATCH 014/156] Add Steve Groesz(@wolfpackmars2) to AUTHORS --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index aa19bcb..8dc01f2 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -75,6 +75,7 @@ Roman Inflianskas rominf infroma@gmail.com Ronald van Zantvoort The-Loeki ronald@pcextreme.nl Skyler Berg skylerberg skylertheberg@gmail.com Stanislav B stanislavb +Steve Groesz wolfpackmars2 Tate Eskew tateeskew Thomas S. Hatch thatch45 thatch45@saltstack.com Tony Narlock tony From 573091b4cd71c93a7545908ae37e09f4bb821816 Mon Sep 17 00:00:00 2001 From: Steve Groesz Date: Mon, 7 Dec 2015 03:59:32 -0600 Subject: [PATCH 015/156] Remove redundant lines The referenced package was included in a previous line. This is merely a cleanup change to prevent future problems and increase maintainability of the code. --- bootstrap-salt.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 045028b..3820862 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2392,8 +2392,6 @@ install_debian_8_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" - # Also install python-requests - __PACKAGES="${__PACKAGES} python-requests" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Install python-libcloud if asked to From 05f344c596af9efd7b13b4e31f3e6366140409f3 Mon Sep 17 00:00:00 2001 From: Brandon Clifford Date: Thu, 17 Dec 2015 11:34:38 -0700 Subject: [PATCH 016/156] Update SaltStack repo location and latest version --- bootstrap-salt.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 70d6c62..81cc8e5 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -40,14 +40,14 @@ is dynamically determined by the script. Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-windows-bootstrap Original Vagrant Provisioner Project -https://github.com/saltstack/salty-vagrant Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant -SaltStack Download Location - http://docs.saltstack.com/downloads/ +SaltStack Download Location - https://repo.saltstack.com/windows/ #> [CmdletBinding()] Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "YYYY.M.R-B" [ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')] - [string]$version = "2015.5.2", + [string]$version = "2015.8.3", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] [ValidateSet("true","false")] @@ -102,7 +102,7 @@ If ([IntPtr]::Size -eq 4) { # Download minion setup file Write-Host -NoNewline "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" $webclient = New-Object System.Net.WebClient -$url = "https://docs.saltstack.com/downloads/Salt-Minion-$version-$arch-Setup.exe" +$url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe" $file = "C:\tmp\salt.exe" $webclient.DownloadFile($url, $file) From 6517e03b783679c2493d16330d6326eb4999c30e Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 21 Dec 2015 18:19:37 +0200 Subject: [PATCH 017/156] Better EPEL repository detection on RHEL and CentOS --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3820862..8f866c9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2873,7 +2873,7 @@ __install_epel_repository() { fi # Check if epel repo is already enabled and flag it accordingly - yum repolist | grep -i "epel" > /dev/null 2>&1 + yum repolist | grep -i '^epel/' > /dev/null 2>&1 if [ $? -eq 0 ]; then __EPEL_REPOS_INSTALLED=${BS_TRUE} return 0 From b34efe5633c3f2c5a1b37033e0eccc006577f685 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 22 Dec 2015 10:07:12 +0200 Subject: [PATCH 018/156] Fix EPEL repository enabled check * use global variable * handle output from YUM command with repo expiry mark * suppress grep output instead of redirection --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8f866c9..1271f8f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2873,7 +2873,7 @@ __install_epel_repository() { fi # Check if epel repo is already enabled and flag it accordingly - yum repolist | grep -i '^epel/' > /dev/null 2>&1 + yum repolist | grep -q "^[!]${_EPEL_REPO}/" if [ $? -eq 0 ]; then __EPEL_REPOS_INSTALLED=${BS_TRUE} return 0 From 79789642a90b2c1d1d4295f212358276ce071bc7 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 22 Dec 2015 16:40:29 +0200 Subject: [PATCH 019/156] Fix git invocation fail when `man` command is not available --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3820862..bf5edc0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1291,7 +1291,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 - if [ "$(git clone --help | grep 'single-branch')" != "" ]; then + if [ "$(git clone 2>&1 | 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" "$__SALT_CHECKOUT_REPONAME" From 4d4de1ec7488dc03afc3f1af980ff8b3d07c1c27 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 23 Dec 2015 17:21:51 +0200 Subject: [PATCH 020/156] Make curl follow HTTP 3XX redirections (wget like behaviour) --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a12ee75..15ad593 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -582,7 +582,7 @@ fi #---------------------------------------------------------------------------------------------------------------------- __fetch_url() { # shellcheck disable=SC2086 - curl $_CURL_ARGS -s -o "$1" "$2" >/dev/null 2>&1 || + curl $_CURL_ARGS -L -s -o "$1" "$2" >/dev/null 2>&1 || wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 || fetch -q -o "$1" "$2" >/dev/null 2>&1 # Pre FreeBSD 10 From d3ac593a0827857ccf48a26b5654d527977677c3 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 23 Dec 2015 17:56:58 +0200 Subject: [PATCH 021/156] Fix EPEL release package installation on CentOS/RHEL 5 --- bootstrap-salt.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 15ad593..05ed159 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2892,9 +2892,10 @@ __install_epel_repository() { EPEL_ARCH=$CPU_ARCH_L fi if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - # Use dl.fedoraproject.org to avoid redirect breakage: - # https://lists.fedoraproject.org/pipermail/users/2012-February/414558.html - rpm -Uvh --force "http://dl.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 + # rpm from CentOS/RHEL release 5 does not support HTTP downloads + # properly, especially 3XX code redirects + __fetch_url /tmp/epel-release.rpm "http://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 + rpm -Uvh --force /tmp/epel-release.rpm || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then From 3f09d6b4d93a22457623705a2231117f4f59069d Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 23 Dec 2015 17:57:54 +0200 Subject: [PATCH 022/156] Make sure `curl` is available on minimal CentOS 5 images before installing `epel-release` package --- bootstrap-salt.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 05ed159..4d8e147 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2892,6 +2892,8 @@ __install_epel_repository() { EPEL_ARCH=$CPU_ARCH_L fi if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then + # Install curl which is not included in minimal CentOS 5 images + rpm -q curl > /dev/null 2>&1 || yum -y install curl # rpm from CentOS/RHEL release 5 does not support HTTP downloads # properly, especially 3XX code redirects __fetch_url /tmp/epel-release.rpm "http://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 From 5d327c1325a086573688e4a6d0991ccd0722709d Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 24 Dec 2015 14:29:03 +0200 Subject: [PATCH 023/156] Remove RHEL optional repo check and enable All necessary packages will be installed from salt repo --- bootstrap-salt.sh | 85 ----------------------------------------------- 1 file changed, 85 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4d8e147..3103119 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3314,95 +3314,12 @@ install_centos_check_services() { # # RedHat Install Functions # -__test_rhel_optionals_packages() { - __install_epel_repository || return 1 - - # Make sure yum-utils is installed - yum list installed yum-utils > /dev/null 2>&1 || yum -y install yum-utils --enablerepo=${_EPEL_REPO} || return 1 - - if [ "$DISTRO_MAJOR_VERSION" -ge 7 ]; then - yum-config-manager --enable \*server-optional-rpms || return 1 - fi - - if [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then - #python-jinja2 is in repo server-releases-optional in EC2/RHEL6 - yum-config-manager --enable rhui-\*-server-releases-optional || return 1 - - # Let's enable package installation testing, kind of, --dry-run - echoinfo "Testing if packages usually on the optionals repository are available:" - __YUM_CONF_DIR="$(mktemp -d)" - __YUM_CONF_FILE="${__YUM_CONF_DIR}/yum.conf" - cp /etc/yum.conf "${__YUM_CONF_FILE}" - echo 'tsflags=test' >> "${__YUM_CONF_FILE}" - - # Let's try installing the packages that usually require the optional repository - # shellcheck disable=SC2043 - for package in python-jinja2; do - echoinfo " - ${package}" - if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then - yum --config "${__YUM_CONF_FILE}" install -y ${package} >/dev/null 2>&1 || \ - yum --config "${__YUM_CONF_FILE}" install -y ${package} --enablerepo=${_EPEL_REPO} >/dev/null 2>&1 - else - yum --config "${__YUM_CONF_FILE}" install -y ${package} --enablerepo=${_EPEL_REPO} >/dev/null 2>&1 - fi - if [ $? -ne 0 ]; then - echoerror "Failed to find an installable '${package}' package. The optional repository or its subscription might be missing." - rm -rf "${__YUM_CONF_DIR}" - return 1 - fi - done - rm -rf "${__YUM_CONF_DIR}" - fi - return 0 -} - install_red_hat_linux_stable_deps() { - if [ "${DISTRO_MAJOR_VERSION}" -ge 6 ]; then - # Wait at most 60 seconds for the repository subscriptions to register - __ATTEMPTS=6 - while [ "${__ATTEMPTS}" -gt 0 ]; do - __test_rhel_optionals_packages - if [ $? -eq 1 ]; then - __ATTEMPTS=$(( __ATTEMPTS -1 )) - if [ ${__ATTEMPTS} -lt 1 ]; then - return 1 - fi - echoinfo "Sleeping 10 seconds while waiting for the optional repository subscription to be externally configured" - sleep 10 - continue - else - break - fi - done - else - __test_rhel_optionals_packages || return 1 - fi - install_centos_stable_deps || return 1 return 0 } install_red_hat_linux_git_deps() { - if [ "${DISTRO_MAJOR_VERSION}" -ge 6 ]; then - # Wait at most 60 seconds for the repository subscriptions to register - __ATTEMPTS=6 - while [ "${__ATTEMPTS}" -gt 0 ]; do - __test_rhel_optionals_packages - if [ $? -eq 1 ]; then - __ATTEMPTS=$(( __ATTEMPTS -1 )) - if [ ${__ATTEMPTS} -lt 1 ]; then - return 1 - fi - echoinfo "Sleeping 10 seconds while waiting for the optional repository subscription to be externally configured" - sleep 10 - continue - else - break - fi - done - else - __test_rhel_optionals_packages || return 1 - fi install_centos_git_deps || return 1 return 0 } @@ -3591,13 +3508,11 @@ install_red_hat_enterprise_workstation_testing_post() { # Oracle Linux Install Functions # install_oracle_linux_stable_deps() { - __test_rhel_optionals_packages || return 1 install_centos_stable_deps || return 1 return 0 } install_oracle_linux_git_deps() { - __test_rhel_optionals_packages || return 1 install_centos_git_deps || return 1 return 0 } From b07dd322aba012130a948419ee1685dcc4534be3 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 25 Dec 2015 15:06:43 +0200 Subject: [PATCH 024/156] Remove SaltStack COPR repository configuration for CentOS/RHEL5 --- bootstrap-salt.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4d8e147..a06b289 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2924,14 +2924,6 @@ __install_saltstack_copr_zeromq_repository() { return 0 } -__install_saltstack_copr_salt_el5_repository() { - if [ ! -s /etc/yum.repos.d/saltstack-salt-el5-epel-5.repo ]; then - __fetch_url /etc/yum.repos.d/saltstack-salt-el5-epel-5.repo \ - "http://copr.fedoraproject.org/coprs/saltstack/salt-el5/repo/epel-5/saltstack-salt-el5-epel-5.repo" || return 1 - fi - return 0 -} - __install_saltstack_rhel5_repository() { if [ ! -s /etc/yum.repos.d/repo-saltstack-el5.repo ]; then cat <<_eof > /etc/yum.repos.d/repo-saltstack-el5.repo From 49d1df8a1be9e0fe4d46efa67b76bd0d4ee1d7b3 Mon Sep 17 00:00:00 2001 From: abednarik Date: Mon, 7 Dec 2015 22:56:04 -0300 Subject: [PATCH 025/156] Removed deprecated cli option. Is no longer needed to have this 2 options to bookstrap salt, since now --salt-config-dir is a global option. Fixes #704 --- bootstrap-salt.sh | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 045028b..049f928 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1992,8 +1992,7 @@ install_ubuntu_daily() { install_ubuntu_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || \ - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 fi @@ -2585,8 +2584,7 @@ install_debian_8_stable() { install_debian_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py install --install-layout=deb --salt-config-dir="$_SALT_ETC_DIR" || \ - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 fi @@ -2800,8 +2798,7 @@ install_fedora_git_deps() { install_fedora_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py install --salt-config-dir="$_SALT_ETC_DIR" || \ - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 else python setup.py install || return 1 fi @@ -3168,8 +3165,7 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py install --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" || \ - $_PYEXE setup.py --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + $_PYEXE setup.py --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" install || return 1 else $_PYEXE setup.py install --prefix=/usr || return 1 fi @@ -3919,8 +3915,7 @@ install_arch_linux_stable() { install_arch_linux_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python2 setup.py install --salt-config-dir="$_SALT_ETC_DIR" || \ - python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 else python2 setup.py install || return 1 fi @@ -4242,18 +4237,7 @@ install_freebsd_git() { # We still can't provide the system paths, salt 0.16.x /usr/local/bin/python2 setup.py install || return 1 else - /usr/local/bin/python2 setup.py install \ - --salt-root-dir=/usr/local \ - --salt-config-dir="${_SALT_ETC_DIR}" \ - --salt-cache-dir=/var/cache/salt \ - --salt-sock-dir=/var/run/salt \ - --salt-srv-root-dir=/srv \ - --salt-base-file-roots-dir="${_SALT_ETC_DIR}/states" \ - --salt-base-pillar-roots-dir="${_SALT_ETC_DIR}/pillar" \ - --salt-base-master-roots-dir="${_SALT_ETC_DIR}/salt-master" \ - --salt-logs-dir=/var/log/salt \ - --salt-pidfile-dir=/var/run \ - || /usr/local/bin/python2 setup.py \ + /usr/local/bin/python2 setup.py \ --salt-root-dir=/usr/local \ --salt-config-dir="${_SALT_ETC_DIR}" \ --salt-cache-dir=/var/cache/salt \ @@ -4420,8 +4404,7 @@ install_smartos_stable() { install_smartos_git() { # Use setuptools in order to also install dependencies # lets force our config path on the setup for now, since salt/syspaths.py only got fixed in 2015.5.0 - USE_SETUPTOOLS=1 /opt/local/bin/python setup.py install --salt-config-dir="$_SALT_ETC_DIR" || \ - USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 return 0 } From f3d2385358fda95cf2e1a74adf9823d24d452d0c Mon Sep 17 00:00:00 2001 From: Sergey Paramonov Date: Wed, 30 Dec 2015 00:13:11 -0500 Subject: [PATCH 026/156] adding support for OpenBSD --- AUTHORS.rst | 1 + bootstrap-salt.sh | 201 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 8dc01f2..7f51c86 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -73,6 +73,7 @@ Rob Eden hedinfaok Roberto Aguilar rca roberto@baremetal.io Roman Inflianskas rominf infroma@gmail.com Ronald van Zantvoort The-Loeki ronald@pcextreme.nl +Sergey Paramonov serge-p serg.paramonov@s-vp.com Skyler Berg skylerberg skylertheberg@gmail.com Stanislav B stanislavb Steve Groesz wolfpackmars2 diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b0e448c..e0f7374 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -586,6 +586,7 @@ __fetch_url() { wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 || fetch -q -o "$1" "$2" >/dev/null 2>&1 # Pre FreeBSD 10 + ftp -o "$1" "$2" >/dev/null 2>&1 # OpenBSD } @@ -1667,6 +1668,33 @@ __check_services_debian() { } # ---------- end of function __check_services_debian ---------- +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __check_services_openbsd +# DESCRIPTION: Return 0 or 1 in case the service is enabled or not +# PARAMETERS: servicename +#---------------------------------------------------------------------------------------------------------------------- +__check_services_openbsd() { + if [ $# -eq 0 ]; then + echoerror "You need to pass a service name to check!" + exit 1 + elif [ $# -ne 1 ]; then + echoerror "You need to pass a service name to check as the single argument to the function" + fi + + servicename=$1 + echodebug "Checking if service ${servicename} is enabled" + + # shellcheck disable=SC2086,SC2046,SC2144 + if [ -f /etc/rc.d/${servicename} ] && [ $(grep ${servicename} /etc/rc.conf.local) -ne "" ] ; then + echodebug "Service ${servicename} is enabled" + return 0 + else + echodebug "Service ${servicename} is NOT enabled" + # return 1 + fi +} # ---------- end of function __check_services_openbsd ---------- + + ####################################################################################################################### # # Distribution install functions @@ -4323,6 +4351,179 @@ install_freebsd_restart_daemons() { # ####################################################################################################################### +####################################################################################################################### +# +# OpenBSD Install Functions +# + +install_openbsd_deps() { + ping -c 2 -q mirrors.nycbug.org || return 1 + echo "installpath = http://mirrors.nycbug.org/pub/OpenBSD/${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 + pkg_add -I -v lsof || return 1 + pkg_add -I -v py-pip || return 1 + ln -sf $(ls -d /usr/local/bin/pip2.*) /usr/local/bin/pip || return 1 + ln -sf $(ls -d /usr/local/bin/pydoc2*) /usr/local/bin/pydoc || return 1 + ln -sf $(ls -d /usr/local/bin/python2.[0-9]) /usr/local/bin/python || return 1 + ln -sf $(ls -d /usr/local/bin/python2.[0-9]*to3) /usr/local/bin/2to3 || return 1 + ln -sf $(ls -d /usr/local/bin/python2.[0-9]*-config) /usr/local/bin/python-config || return 1 + pkg_add -I -v swig || return 1 + pkg_add -I -v py-zmq || return 1 + pkg_add -I -v py-requests || return 1 + pkg_add -I -v py-M2Crypto || return 1 + pkg_add -I -v py-raet || return 1 + pkg_add -I -v py-libnacl || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + /usr/local/bin/pip install --upgrade pip || return 1 + fi + # + # PIP based installs need to copy configuration files "by hand". + # Let's trigger config_salt() + # + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + # Let's set the configuration directory to /tmp + _TEMP_CONFIG_DIR="/tmp" + CONFIG_SALT_FUNC="config_salt" + for fname in minion master; do + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + # [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + # Let's download, since they were not provided, the default configuration files + if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then + ftp -o "$_TEMP_CONFIG_DIR/$fname" \ + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + fi + done + fi + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + /usr/local/bin/pip install --upgrade pip || return 1 + fi + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + pkg_add -I -v ${_EXTRA_PACKAGES} || return 1 + fi + return 0 +} + +install_openbsd_git_deps() { + install_openbsd_deps || return 1 + pkg_add -I -v git || return 1 + __git_clone_and_checkout || return 1 + # + # Let's trigger config_salt() + # + if [ "$_TEMP_CONFIG_DIR" -eq "null" ]; then + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" + CONFIG_SALT_FUNC="config_salt" + fi + return 0 +} + +install_openbsd_stable() { + +# pkg_add -r -I -v salt || return 1 + check_pip_allowed + /usr/local/bin/pip install salt || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + /usr/local/bin/pip install --upgrade salt || return 1 + fi + return 0 +} + +install_openbsd_git() { + # + # Install from git + # + if [ ! -f salt/syspaths.py ]; then + # We still can't provide the system paths, salt 0.16.x + /usr/local/bin/python2.7 setup.py install || return 1 + fi + return 0 +} + + +install_openbsd_post() { + + # + # Install rc.d files. + # + ## below workaround for /etc/rc.d/rc.subr in OpenBSD >= 5.8 + ## is needed for salt service to start/stop properly by /etc/rc.d + ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 + ## + if [ $(grep '\-xf' /etc/rc.d/rc.subr)]; then + cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr + sed -i.$(date +%F).saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr + fi + _TEMP_CONFIG_DIR="/tmp" + for fname in minion master syndic api; do + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ] && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && continue + + if [ $? -eq 1 ]; then + if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then + ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ + "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" + if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ $(grep salt_${fname} /etc/rc.conf.local) -eq ""]; then + copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 + echo salt_${fname}_enable="YES" >> /etc/rc.conf.local + echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local + fi + fi + fi + done +} + +install_openbsd_check_services() { + salt --version + for fname in minion master syndic api; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && continue + [ $fname = "syndic" ] && continue + if [ -f /etc/rc.d/salt_${fname} ]; then + __check_services_openbsd salt_${fname} || return 1 + fi + done + return 0 +} + + +install_openbsd_restart_daemons() { + [ $_START_DAEMONS -eq $BS_FALSE ] && return + for fname in minion master syndic api; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + if [ -f /etc/rc.d/salt_${fname} ]; then + /etc/rc.d/salt_${fname} stop > /dev/null 2>&1 + /etc/rc.d/salt_${fname} start + fi + done +} + + +# +# Ended OpenBSD Install Functions +# +####################################################################################################################### + ####################################################################################################################### # # SmartOS Install Functions From 2025bc874bf9d6ec6e1bb08c252f9a9ac684b166 Mon Sep 17 00:00:00 2001 From: Sergey Paramonov Date: Thu, 31 Dec 2015 12:47:07 -0500 Subject: [PATCH 027/156] fix for FreeBSD 11 installation functions --- bootstrap-salt.sh | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b0e448c..23a42d1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4073,15 +4073,20 @@ __configure_freebsd_pkg_details() { mkdir -p /etc/pkg/ ## Use new JSON-like format for pkg repo configs - conf_file=/usr/local/etc/pkg/repos/freebsd.conf - { - echo "FreeBSD:{" - echo " url: \"${PKGCONFURL}\"," - echo " mirror_type: \"SRV\"," - echo " enabled: true" - echo "}" - } > $conf_file - copyfile $conf_file /etc/pkg/FreeBSD.conf + ## check if /etc/pkg/FreeBSD.conf is already in place + if [ ! -f /etc/pkg/FreeBSD.conf ]; then + conf_file=/usr/local/etc/pkg/repos/freebsd.conf + { + echo "FreeBSD:{" + echo " url: \"${PKGCONFURL}\"," + echo " mirror_type: \"srv\"," + echo " signature_type: "fingerprints", + echo " fingerprints: "/usr/share/keys/pkg", + echo " enabled: true" + echo "}" + } > $conf_file + copyfile $conf_file /etc/pkg/FreeBSD.conf + fi FROM_FREEBSD="-r FreeBSD" ## add saltstack freebsd repo @@ -4219,7 +4224,19 @@ install_freebsd_10_stable() { } install_freebsd_11_stable() { - install_freebsd_9_stable +# +# installing latest version of salt from FreeBSD CURRENT ports repo +# + /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 + +# +# setting _SALT_ETC_DIR to match paths from FreeBSD ports: +# + _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} + if [ ! -d /etc/salt ]; then + ln -sf ${_SALT_ETC_DIR} /etc/salt + fi + return 0 } install_freebsd_git() { From d699b221d9d60dbb724716cbdff6e6f23e07fa74 Mon Sep 17 00:00:00 2001 From: Niels Abspoel Date: Wed, 6 Jan 2016 20:46:27 +0100 Subject: [PATCH 028/156] improve openSUSE major version code --- bootstrap-salt.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4256eca..4f33065 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4434,9 +4434,11 @@ __zypper_install() { } install_opensuse_stable_deps() { - if [ "${DISTRO_MAJOR_VERSION}" -ge 42 ]; then + if [ "${DISTRO_MAJOR_VERSION}" -gt 2015 ]; then + DISTRO_REPO="openSUSE_Tumbleweed" + elif [ "${DISTRO_MAJOR_VERSION}" -ge 42 ]; then DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" - else + elif [ "${DISTRO_MAJOR_VERSION}" -lt 42 ]; then DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" fi From 5d94fc33d37f426f9f21dcafe1698355a53ca21b Mon Sep 17 00:00:00 2001 From: justinta89 Date: Thu, 7 Jan 2016 14:58:38 -0700 Subject: [PATCH 029/156] Sometimes bootstrap doesn't install zmq When installing from git, bootstrap seems to skip over the zmq installation. This checks if zmq has been installed, if not, it installs it. --- bootstrap-salt.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4f33065..6fc4e01 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2516,6 +2516,10 @@ install_debian_8_git_deps() { __apt_get_install_noinput git || return 1 fi + if [ "$(python -c 'import zmq; print zmq.pyzmq_version()')" = "" ]; then + __apt_get_install_noinput libzmq3 libzmq3-dev python-zmq || return 1 + fi + __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ python-jinja2 python-m2crypto python-yaml msgpack-python python-pip || return 1 From 0d9827b842cc577e2c4f4b9558590642ad1de5bd Mon Sep 17 00:00:00 2001 From: justinta89 Date: Thu, 7 Jan 2016 15:06:48 -0700 Subject: [PATCH 030/156] Added parentheses on print --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 6fc4e01..167874f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2516,7 +2516,7 @@ install_debian_8_git_deps() { __apt_get_install_noinput git || return 1 fi - if [ "$(python -c 'import zmq; print zmq.pyzmq_version()')" = "" ]; then + if [ "$(python -c 'import zmq; print(zmq.pyzmq_version())')" = "" ]; then __apt_get_install_noinput libzmq3 libzmq3-dev python-zmq || return 1 fi From 1f69dd0a96eb542b1833685e456bd09f387a880f Mon Sep 17 00:00:00 2001 From: justinta89 Date: Thu, 7 Jan 2016 15:51:25 -0700 Subject: [PATCH 031/156] Changed from using python to dpkg-query --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 167874f..6f96e7e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2516,7 +2516,7 @@ install_debian_8_git_deps() { __apt_get_install_noinput git || return 1 fi - if [ "$(python -c 'import zmq; print(zmq.pyzmq_version())')" = "" ]; then + if [ "$(dpkg-query -l 'python-zmq')" = "" ]; then __apt_get_install_noinput libzmq3 libzmq3-dev python-zmq || return 1 fi From b8a5a0a12e3e2e293671774785581eec9fce0d22 Mon Sep 17 00:00:00 2001 From: Marcus Furlong Date: Wed, 13 Jan 2016 14:32:31 +1100 Subject: [PATCH 032/156] Don't add zypp repo if it already exists closes #730 --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ff453f6..bef27a4 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4448,11 +4448,11 @@ install_opensuse_stable_deps() { fi # Is the repository already known - __zypper repos | grep devel_languages_python >/dev/null 2>&1 + opensuse_deps_repo_url="http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/" + __zypper repos --details | grep "${opensuse_deps_repo_url}" >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about devel_languages_python - __zypper addrepo --refresh \ - "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1 + __zypper addrepo --refresh "${opensuse_deps_repo_url}" devel_languages_python || return 1 fi __zypper --gpg-auto-import-keys refresh From 52a6bd2b54e493b8742f1e6b5ffb2666541a51c1 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Jan 2016 15:08:41 -0700 Subject: [PATCH 033/156] warn user about overwrite when -C is used --- bootstrap-salt.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 155b792..c6508c6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -259,7 +259,7 @@ usage() { distribution. Using this flag allows the script to use pip as a last resort method. NOTE: This only works for functions which actually implement pip based installations. - -F Allow copied files to overwrite existing(config, init.d, etc) + -F Allow copied files to overwrite existing (config, init.d, etc). -U If set, fully upgrade the system prior to bootstrapping salt -K If set, keep the temporary files in the temporary directories specified with -c and -k. @@ -4468,6 +4468,12 @@ config_salt() { CONFIGURED_ANYTHING=$BS_TRUE fi + if [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then + echowarn "Passing -C (config only) option implies -F (forced overwrite)." + echowarn "Overwriting configs in 11 seconds!" + sleep 11 + fi + if [ "$_INSTALL_MINION" -eq "$BS_TRUE" ] || [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then # Create the PKI directory [ -d "$_PKI_DIR/minion" ] || (mkdir -p "$_PKI_DIR/minion" && chmod 700 "$_PKI_DIR/minion") || return 1 From deb043f26c407a3eb30042f433569b3df9826ffb Mon Sep 17 00:00:00 2001 From: Beau Hargis Date: Fri, 13 Feb 2015 22:13:43 -0800 Subject: [PATCH 034/156] Added conditional for _CONFIG_ONLY in config_salt so that it is evaluated correctly. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 6939928..9ffa649 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5059,7 +5059,7 @@ config_salt() { fi - if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] || [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then # Create the PKI directory [ -d "$_PKI_DIR/master" ] || (mkdir -p "$_PKI_DIR/master" && chmod 700 "$_PKI_DIR/master") || return 1 From ba99ff9cbca9da3f1c561c53a37997993bb7831a Mon Sep 17 00:00:00 2001 From: Beau Hargis Date: Fri, 13 Feb 2015 22:15:45 -0800 Subject: [PATCH 035/156] Remove dependency on -c flag being required for _CONFIG_ONLY as it appears to be logically superfluous in most contexts. --- bootstrap-salt.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9ffa649..e21ab45 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -383,11 +383,6 @@ if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] exit 0 fi -if [ "$_CONFIG_ONLY" -eq $BS_TRUE ] && [ "$_TEMP_CONFIG_DIR" = "null" ]; then - echoerror "In order to run the script in configuration only mode you also need to provide the configuration directory." - exit 1 -fi - # Check that we're installing a minion if we're being passed a master address if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MASTER_ADDRESS" != "null" ]; then echoerror "Don't pass a master address (-A) if no minion is going to be bootstrapped." From 63d1c1eec41b0a4aa98011e4185d6d9820523857 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Jan 2016 16:13:30 -0700 Subject: [PATCH 036/156] overwrite master configs if -C and -M or -S given Updates #544 with the ideas in #541. --- bootstrap-salt.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e21ab45..6396367 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -259,8 +259,9 @@ usage() { -S Also install salt-syndic -N Do not install salt-minion -X Do not start daemons after installation - -C Only run the configuration function. This option automatically - bypasses any installation. + -C Only run the configuration function. This option automatically bypasses + any installation. Implies -F (forced overwrite). To overwrite master or + syndic configs, -M or -S, respectively, must also be specified. -P Allow pip based installations. On some distributions the required salt packages or its dependencies are not available as a package for that distribution. Using this flag allows the script to use pip as a last @@ -5053,8 +5054,17 @@ config_salt() { fi fi + # only (re)place master or syndic configs if -M (install master) or -S + # (install syndic) specified + OVERWRITE_MASTER_CONFIGS=$BS_FALSE + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] && [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then + OVERWRITE_MASTER_CONFIGS=$BS_TRUE + fi + if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] && [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then + OVERWRITE_MASTER_CONFIGS=$BS_TRUE + fi - if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] || [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] || [ "$OVERWRITE_MASTER_CONFIGS" -eq $BS_TRUE ]; then # Create the PKI directory [ -d "$_PKI_DIR/master" ] || (mkdir -p "$_PKI_DIR/master" && chmod 700 "$_PKI_DIR/master") || return 1 From f8715cb97fe18349567ef03bf37c130e53a27b49 Mon Sep 17 00:00:00 2001 From: Roman Mohr Date: Fri, 22 Jan 2016 22:12:21 +0100 Subject: [PATCH 037/156] COPR project moved Replace old url http://copr.fedoraproject.org with https://copr.fedorainfracloud.org to fix broken bootstrap script. --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0b237e0..135626b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2918,7 +2918,7 @@ __install_saltstack_copr_zeromq_repository() { __REPOTYPE="epel" fi __fetch_url /etc/yum.repos.d/saltstack-zeromq4.repo \ - "http://copr.fedoraproject.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1 + "https://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1 fi return 0 } @@ -2976,7 +2976,7 @@ __install_saltstack_copr_salt_repository() { if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then __fetch_url "/etc/yum.repos.d/${__REPO_FILENAME}" \ - "http://copr.fedoraproject.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1 + "https://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1 fi return 0 } @@ -3654,7 +3654,7 @@ install_amazon_linux_ami_deps() { if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then echoinfo "Adding SaltStack's COPR repository" __fetch_url /etc/yum.repos.d/${__REPO_FILENAME} \ - "http://copr.fedoraproject.org/coprs/saltstack/salt/repo/epel-6/${__REPO_FILENAME}" || return 1 + "https://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/epel-6/${__REPO_FILENAME}" || return 1 fi if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then From 2e2dae3f0f37660af01ecf034879a200bb91b766 Mon Sep 17 00:00:00 2001 From: EYJ Date: Tue, 22 Sep 2015 13:30:42 +0200 Subject: [PATCH 038/156] Add -f option to force shallow cloning --- bootstrap-salt.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 135626b..34dd584 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -214,6 +214,7 @@ _HTTP_PROXY="" _DISABLE_SALT_CHECKS=$BS_FALSE __SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} _NO_DEPS=$BS_FALSE +_FORCE_SHALLOW_CLONE=$BS_FALSE #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -287,12 +288,13 @@ usage() { -Z Enable external software source for newer ZeroMQ(Only available for RHEL/CentOS/Fedora/Ubuntu based distributions) -b Assume that dependencies are already installed and software sources are set up. If git is selected, git tree is still checked out as dependency step. + -f Force shallow cloning for git installations. This may result in an "n/a" in the version number. EOT } # ---------- end of function usage ---------- -while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbs:" opt +while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbsf" opt do case "${opt}" in @@ -346,6 +348,7 @@ do H ) _HTTP_PROXY="$OPTARG" ;; Z ) _ENABLE_EXTERNAL_ZMQ_REPOS=$BS_TRUE ;; b ) _NO_DEPS=$BS_TRUE ;; + f ) _FORCE_SHALLOW_CLONE=$BS_TRUE ;; \?) echo @@ -1282,9 +1285,18 @@ __git_clone_and_checkout() { git pull --rebase || return 1 fi else - __SHALLOW_CLONE="${BS_FALSE}" - 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" + if [ "$_FORCE_SHALLOW_CLONE" -eq "${BS_TRUE}" ]; then + echoinfo "Forced shallow cloning of git repository." + __SHALLOW_CLONE="${BS_TRUE}" + elif [ "$(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, shallow cloning enabled." + __SHALLOW_CLONE="${BS_TRUE}" + else + echowarn "The git revision being installed does not match a Salt version tag. Shallow cloning disabled" + __SHALLOW_CLONE="${BS_FALSE}" + fi + + if [ "$__SHALLOW_CLONE" -eq "${BS_TRUE}" ]; then # 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 @@ -1299,16 +1311,15 @@ __git_clone_and_checkout() { # 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" "$__SALT_CHECKOUT_REPONAME" || return 1 - cd "${__SALT_GIT_CHECKOUT_DIR}" + __SHALLOW_CLONE="${BS_FALSE}" fi else echodebug "Shallow cloning not possible. Required git version not met." - git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 - cd "${__SALT_GIT_CHECKOUT_DIR}" + __SHALLOW_CLONE="${BS_FALSE}" fi - else - echowarn "The git revision being installed does not match a Salt version tag. Shallow cloning disabled" + fi + + if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 cd "${__SALT_GIT_CHECKOUT_DIR}" fi From 1dc003e4ddd67b9b10220e08dae6bdf78969e169 Mon Sep 17 00:00:00 2001 From: EYJ Date: Tue, 22 Sep 2015 14:37:24 +0200 Subject: [PATCH 039/156] Do not fetch saltstack repo if shallow-cloning from a non-saltstack repo --- bootstrap-salt.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 34dd584..ccc511f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1322,18 +1322,16 @@ __git_clone_and_checkout() { if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 cd "${__SALT_GIT_CHECKOUT_DIR}" - fi - if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; 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" || return 1 - echodebug "Fetching upstream(SaltStack's Salt repository) git tags" - git fetch --tags upstream || return 1 - GIT_REV="origin/$GIT_REV" - fi + if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; 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" || return 1 + echodebug "Fetching upstream(SaltStack's Salt repository) git tags" + git fetch --tags upstream || return 1 + GIT_REV="origin/$GIT_REV" + fi - if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then echodebug "Checking out $GIT_REV" git checkout "$GIT_REV" || return 1 fi From 66c3d2727530111f6cdc1dbe46994b9cb45cd909 Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Tue, 26 Jan 2016 23:02:08 +0530 Subject: [PATCH 040/156] Update license year range --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 1b27155..8a7d7a2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Salt Bootstrap - Generic Salt Bootstrap Script - Copyright 2012-2013 Salt Stack (saltstack.org) + Copyright 2012-2016 Salt Stack (saltstack.org) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From da4414a871febc684deb2d099158769f18ac02a4 Mon Sep 17 00:00:00 2001 From: "Michael A. Smith" Date: Mon, 25 Jan 2016 08:25:34 -0500 Subject: [PATCH 041/156] Use POSIX-Compliant Command-Exists Test Suggest the `command` command instead of `which` to determine if the `lsb_release` command exists. `which` is a non-standard command and this script and its documentation should work across as many POSIX like systems as possible. `command` is more portable than `which`. To be consistent with the existing suggestion, the updated suggestion will only act if `lsb_release` exists and is a simple command, not an alias or shell function. References: http://stackoverflow.com/a/677212/418413 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8287a4c..82f197a 100644 --- a/README.rst +++ b/README.rst @@ -392,7 +392,7 @@ Please run the following commands and report their output when creating a ticket .. code:: console sudo find /etc/ -name '*-release' -print -exec cat {} \; - which lsb_release && lsb_release -a + command lsb_release -a Testing in Vagrant From 993e99593993a9d4d2cd38e3442bbf1adeca1076 Mon Sep 17 00:00:00 2001 From: "Michael A. Smith" Date: Mon, 25 Jan 2016 09:00:32 -0500 Subject: [PATCH 042/156] Discover if Commands Exist in a Portable Way --- bootstrap-salt.sh | 110 +++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 135626b..0ec108d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -106,6 +106,14 @@ echodebug() { fi } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __check_command_exists +# DESCRIPTION: Check if a command exists. +#---------------------------------------------------------------------------------------------------------------------- +__check_command_exists() { + command -v "$1" > /dev/null 2>&1 +} + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: check_pip_allowed # DESCRIPTION: Simple function to let the users know that -P needs to be @@ -1838,7 +1846,7 @@ install_ubuntu_deps() { if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" - if [ "$(which pip)" = "" ]; then + if ! __check_command_exists pip; then __PACKAGES="${__PACKAGES} python-setuptools python-pip" fi # shellcheck disable=SC2089 @@ -1949,7 +1957,7 @@ install_ubuntu_git_deps() { if [ "${__REQUIRED_TORNADO}" != "" ]; then __PACKAGES="${__PACKAGES} python-dev" check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" - if [ "$(which pip)" = "" ]; then + if ! __check_command_exists pip; then __PACKAGES="${__PACKAGES} python-setuptools python-pip" fi # shellcheck disable=SC2086 @@ -2003,7 +2011,7 @@ install_ubuntu_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then @@ -2059,7 +2067,7 @@ install_ubuntu_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then @@ -2104,7 +2112,7 @@ install_ubuntu_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then @@ -2423,7 +2431,7 @@ install_debian_git_deps() { # Install Keys __apt_get_install_noinput debian-archive-keyring && apt-get update - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __apt_get_install_noinput git || return 1 fi @@ -2472,7 +2480,7 @@ install_debian_6_git_deps() { __PACKAGES="build-essential lsb-release python python-dev python-pkg-resources python-crypto" __PACKAGES="${__PACKAGES} python-m2crypto python-yaml msgpack-python python-pip python-setuptools" - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __PACKAGES="${__PACKAGES} git" fi @@ -2510,7 +2518,7 @@ install_debian_8_git_deps() { # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __apt_get_install_noinput git || return 1 fi @@ -2611,7 +2619,7 @@ install_debian_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -2701,7 +2709,7 @@ install_debian_check_services() { FEDORA_PACKAGE_MANAGER="yum" __fedora_get_package_manager() { - if [ "$DISTRO_MAJOR_VERSION" -ge 22 ] || [ "$(which dnf)" != "" ]; then + if [ "$DISTRO_MAJOR_VERSION" -ge 22 ] || __check_command_exists dnf; then FEDORA_PACKAGE_MANAGER="dnf" fi } @@ -2755,7 +2763,7 @@ install_fedora_stable_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2771,7 +2779,7 @@ install_fedora_git_deps() { __fedora_get_package_manager install_fedora_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then $FEDORA_PACKAGE_MANAGER install -y git || return 1 fi @@ -2811,7 +2819,7 @@ install_fedora_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && 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" @@ -2835,7 +2843,7 @@ install_fedora_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue systemctl stop salt-$fname > /dev/null 2>&1 @@ -2851,7 +2859,7 @@ install_fedora_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __check_services_systemd salt-$fname || return 1 done @@ -3092,7 +3100,7 @@ install_centos_stable_post() { [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /etc/init.d/salt-$fname ]; then @@ -3112,7 +3120,7 @@ install_centos_stable_post() { install_centos_git_deps() { install_centos_stable_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then # git not installed - need to install it if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then # try both ways --enablerepo=X disables ALL OTHER REPOS!!!! @@ -3174,7 +3182,7 @@ install_centos_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -3228,7 +3236,7 @@ install_centos_restart_daemons() { [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then @@ -3283,7 +3291,7 @@ install_centos_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then __check_services_upstart salt-$fname || return 1 @@ -3686,7 +3694,7 @@ install_amazon_linux_ami_deps() { install_amazon_linux_ami_git_deps() { install_amazon_linux_ami_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then yum -y install git --enablerepo=${_EPEL_REPO} || return 1 fi @@ -3760,7 +3768,7 @@ install_arch_linux_stable_deps() { pacman -Sy --noconfirm --needed pacman || return 1 - if [ "$(which pacman-db-upgrade)" != "" ]; then + if __check_command_exists pacman-db-upgrade; then pacman-db-upgrade || return 1 fi @@ -3783,7 +3791,7 @@ install_arch_linux_git_deps() { install_arch_linux_stable_deps # Don't fail if un-installing python2-distribute threw an error - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then pacman -Sy --noconfirm --needed git || return 1 fi pacman -R --noconfirm python2-distribute @@ -3838,7 +3846,7 @@ install_arch_linux_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Since Arch's pacman renames configuration files @@ -3873,7 +3881,7 @@ install_arch_linux_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /usr/bin/systemctl ]; then @@ -3907,7 +3915,7 @@ install_arch_linux_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /usr/bin/systemctl ]; then @@ -3933,7 +3941,7 @@ install_arch_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __check_services_systemd salt-$fname || return 1 done @@ -4064,7 +4072,7 @@ config_freebsd_salt() { install_freebsd_git_deps() { install_freebsd_9_stable_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then /usr/local/sbin/pkg install -y git || return 1 fi @@ -4180,7 +4188,7 @@ install_freebsd_9_stable_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue enable_string="salt_${fname}_enable=\"YES\"" @@ -4220,7 +4228,7 @@ install_freebsd_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue service salt_$fname stop > /dev/null 2>&1 @@ -4289,7 +4297,7 @@ install_smartos_git_deps() { __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" if [ "${__REQUIRED_TORNADO}" != "" ]; then - if [ "$(which pip)" = "" ]; then + if ! __check_command_exists pip; then pkgin -y install py27-pip fi pip install -U "${__REQUIRED_TORNADO}" @@ -4326,7 +4334,7 @@ install_smartos_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue svcs network/salt-$fname > /dev/null 2>&1 @@ -4357,7 +4365,7 @@ install_smartos_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue svcs "network/salt-$fname" > /dev/null 2>&1 @@ -4385,7 +4393,7 @@ install_smartos_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Stop if running && Start service @@ -4405,7 +4413,7 @@ install_smartos_restart_daemons() { __ZYPPER_REQUIRES_REPLACE_FILES=-1 __version_lte() { - if [ "$(which python)" = "" ]; then + if ! __check_command_exists python; then zypper zypper --non-interactive install --replacefiles --auto-agree-with-licenses python || \ zypper zypper --non-interactive install --auto-agree-with-licenses python || return 1 fi @@ -4500,7 +4508,7 @@ install_opensuse_stable_deps() { install_opensuse_git_deps() { install_opensuse_stable_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __zypper_install git || return 1 fi @@ -4561,7 +4569,7 @@ install_opensuse_stable_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -4583,7 +4591,7 @@ install_opensuse_git_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -4613,7 +4621,7 @@ install_opensuse_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -4641,7 +4649,7 @@ install_opensuse_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __check_services_systemd salt-$fname > /dev/null 2>&1 || __check_services_systemd salt-$fname.service > /dev/null 2>&1 || return 1 done @@ -4719,7 +4727,7 @@ install_suse_11_stable_deps() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Syndic uses the same configuration file as the master @@ -4747,7 +4755,7 @@ install_suse_11_stable_deps() { install_suse_11_git_deps() { install_suse_11_stable_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __zypper_install git || return 1 fi @@ -4795,7 +4803,7 @@ install_suse_11_stable_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -4838,7 +4846,7 @@ install_suse_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __check_services_systemd salt-$fname || return 1 done @@ -4871,13 +4879,13 @@ __gentoo_config_protection() { __gentoo_pre_dep() { if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then - if [ "$(which eix)" != "" ]; then + if __check_command_exists eix; then eix-sync else emerge --sync fi else - if [ "$(which eix)" != "" ]; then + if __check_command_exists eix; then eix-sync -q else emerge --sync --quiet @@ -4938,7 +4946,7 @@ install_gentoo_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -d "/run/systemd/system" ]; then @@ -4961,7 +4969,7 @@ install_gentoo_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -d "/run/systemd/system" ]; then @@ -4987,7 +4995,7 @@ install_gentoo_check_services() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __check_services_systemd salt-$fname || return 1 done @@ -5149,7 +5157,7 @@ daemons_running() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # shellcheck disable=SC2009 @@ -5458,7 +5466,7 @@ if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; th # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ "$_ECHO_DEBUG" -eq $BS_FALSE ]; then From 051351de0ccf48a3dbcd46da88834a67491c638c Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Thu, 28 Jan 2016 16:49:04 +0100 Subject: [PATCH 043/156] Fix for enabling universe repo on Ubuntu If universe must be enabled, old-releases will always be enabled, leading to errors --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 135626b..8206b52 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1761,10 +1761,10 @@ __enable_universe_repository() { elif [ "$DISTRO_MAJOR_VERSION" -lt 11 ] && [ "$DISTRO_MINOR_VERSION" -lt 10 ]; then # Below Ubuntu 11.10, the -y flag to add-apt-repository is not supported add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + else + add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 fi - add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 - return 0 } From 1b16dd993b234c6eebfcc298570cd4ffa8af04e8 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Mon, 1 Feb 2016 16:32:20 +0100 Subject: [PATCH 044/156] Fix CentOS git setup.py syntax error upon installation --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0ec108d..5464c50 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3168,7 +3168,7 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + $_PYEXE setup.py install --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" || return 1 else $_PYEXE setup.py install --prefix=/usr || return 1 fi From 91595528c31205db3c25787d4beee6f1a31cb146 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Tue, 2 Feb 2016 14:48:09 +0100 Subject: [PATCH 045/156] Update bootstrap-salt.sh --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5464c50..87db031 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3168,7 +3168,7 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py install --prefix=/usr --salt-config-dir="$_SALT_ETC_DIR" || return 1 + $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" install --prefix=/usr || return 1 else $_PYEXE setup.py install --prefix=/usr || return 1 fi From 0a05ace37800cc166738f2e3b0ac7610c5f25117 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 3 Feb 2016 21:47:55 +0100 Subject: [PATCH 046/156] Change pegging to major-specific repo's & mirror repo RPM's in repo config --- bootstrap-salt.sh | 58 +++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0be1cc5..a337deb 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2923,50 +2923,28 @@ __install_saltstack_copr_zeromq_repository() { return 0 } -__install_saltstack_rhel5_repository() { - if [ ! -s /etc/yum.repos.d/repo-saltstack-el5.repo ]; then - cat <<_eof > /etc/yum.repos.d/repo-saltstack-el5.repo -[repo-saltstack-el5] -name=SaltStack EL5 Repo -baseurl=https://repo.saltstack.com/yum/rhel5/ -skip_if_unavailable=True -gpgcheck=1 -gpgkey=https://repo.saltstack.com/yum/rhel5/SALTSTACK-EL5-GPG-KEY.pub -enabled=1 -enabled_metadata=1 -_eof - if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then - cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" -includepkgs=?:[!s][!a][!l][!t]* salt*${STABLE_REV}* -_eof - fi - - __fetch_url /tmp/repo-saltstack-el5.pub "https://repo.saltstack.com/yum/rhel5/SALTSTACK-EL5-GPG-KEY.pub" || return 1 - rpm --import /tmp/repo-saltstack-el5.pub || return 1 - rm -f /tmp/repo-saltstack-el5.pub - fi - return 0 -} - __install_saltstack_rhel_repository() { - if [ ! -s "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" ]; then - cat <<_eof > "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" -[repo-saltstack-el${DISTRO_MAJOR_VERSION}] -name=SaltStack EL${DISTRO_MAJOR_VERSION} Repo -baseurl=https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/ + base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${STABLE_REV}/" + if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then + gpg_url="${base_url}SALTSTACK-EL5-GPG-KEY.pub" + else + gpg_url="${base_url}SALTSTACK-GPG-KEY.pub" + fi + + repo_file="/etc/yum.repos.d/salt-${STABLE_REV}.repo" + if [ ! -s "$repo_file" ]; then + cat <<_eof > "$repo_file" +[salt-${STABLE_REV}] +name=SaltStack ${STABLE_REV} Release Channel for RHEL/CentOS \$releasever +baseurl=$base_url skip_if_unavailable=True gpgcheck=1 -gpgkey=https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/SALTSTACK-GPG-KEY.pub +gpgkey=$gpg_url enabled=1 enabled_metadata=1 _eof - if [ "$ITYPE" = "stable" -a "$STABLE_REV" != "latest" ]; then - cat << _eof >> "/etc/yum.repos.d/repo-saltstack-el${DISTRO_MAJOR_VERSION}.repo" -includepkgs=?:[!s][!a][!l][!t]* salt*${STABLE_REV}* -_eof - fi - __fetch_url /tmp/repo-saltstack.pub "https://repo.saltstack.com/yum/rhel${DISTRO_MAJOR_VERSION}/SALTSTACK-GPG-KEY.pub" || return 1 + __fetch_url /tmp/repo-saltstack.pub "$gpg_url" || return 1 rpm --import /tmp/repo-saltstack.pub || return 1 rm -f /tmp/repo-saltstack.pub fi @@ -2993,11 +2971,7 @@ __install_saltstack_copr_salt_repository() { install_centos_stable_deps() { __install_epel_repository || return 1 - if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - __install_saltstack_rhel5_repository || return 1 - elif [ "$DISTRO_MAJOR_VERSION" -gt 5 ]; then - __install_saltstack_rhel_repository || return 1 - fi + __install_saltstack_rhel_repository || return 1 if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file From 5fc652d1ce2cb561375e5465422a786ec1cbfbed Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 3 Feb 2016 22:22:45 +0100 Subject: [PATCH 047/156] Yum vars don't exist when fetching the GPG key manually duh --- bootstrap-salt.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a337deb..0338c9b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2925,10 +2925,12 @@ __install_saltstack_copr_zeromq_repository() { __install_saltstack_rhel_repository() { base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${STABLE_REV}/" + fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/" + if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then - gpg_url="${base_url}SALTSTACK-EL5-GPG-KEY.pub" + gpg_key="SALTSTACK-EL5-GPG-KEY.pub" else - gpg_url="${base_url}SALTSTACK-GPG-KEY.pub" + gpg_key="SALTSTACK-GPG-KEY.pub" fi repo_file="/etc/yum.repos.d/salt-${STABLE_REV}.repo" @@ -2939,12 +2941,12 @@ name=SaltStack ${STABLE_REV} Release Channel for RHEL/CentOS \$releasever baseurl=$base_url skip_if_unavailable=True gpgcheck=1 -gpgkey=$gpg_url +gpgkey=${base_url}${gpg_key} enabled=1 -enabled_metadata=1 +enabled_metadata=1gpg _eof - __fetch_url /tmp/repo-saltstack.pub "$gpg_url" || return 1 + __fetch_url /tmp/repo-saltstack.pub "${fetch_url}${gpg_key}" || return 1 rpm --import /tmp/repo-saltstack.pub || return 1 rm -f /tmp/repo-saltstack.pub fi From d1c12a91bc808b48dbc60d7937f06c1ecab23828 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 3 Feb 2016 22:34:46 +0100 Subject: [PATCH 048/156] And of course the actual STABLE_REV needs to be in for downloading as well --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0338c9b..4f6cbbe 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2925,7 +2925,7 @@ __install_saltstack_copr_zeromq_repository() { __install_saltstack_rhel_repository() { base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${STABLE_REV}/" - fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/" + fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${STABLE_REV}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then gpg_key="SALTSTACK-EL5-GPG-KEY.pub" From 5976902216a6e491a313b259ccb6bd8d1e181b39 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 3 Feb 2016 23:12:10 +0100 Subject: [PATCH 049/156] Redo STABLE_REV-less git installs fix --- bootstrap-salt.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4f6cbbe..5eab54b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2924,8 +2924,14 @@ __install_saltstack_copr_zeromq_repository() { } __install_saltstack_rhel_repository() { - base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${STABLE_REV}/" - fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${STABLE_REV}/" + if [ "$ITYPE" = "stable" ]; then + repo_rev="$STABLE_REV" + else + repo_rev="latest" + fi + + base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then gpg_key="SALTSTACK-EL5-GPG-KEY.pub" @@ -2933,11 +2939,11 @@ __install_saltstack_rhel_repository() { gpg_key="SALTSTACK-GPG-KEY.pub" fi - repo_file="/etc/yum.repos.d/salt-${STABLE_REV}.repo" + repo_file="/etc/yum.repos.d/salt-${repo_rev}.repo" if [ ! -s "$repo_file" ]; then cat <<_eof > "$repo_file" -[salt-${STABLE_REV}] -name=SaltStack ${STABLE_REV} Release Channel for RHEL/CentOS \$releasever +[salt-${repo_rev}] +name=SaltStack ${repo_rev} Release Channel for RHEL/CentOS \$releasever baseurl=$base_url skip_if_unavailable=True gpgcheck=1 From 6ebb414d2b71a49e12ecbc0d1311820254f359ea Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Thu, 4 Feb 2016 01:35:47 -0700 Subject: [PATCH 050/156] add SLE 12 support, fix OpenSUSE support --- bootstrap-salt.sh | 214 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 212 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 859445d..d023c1b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -871,6 +871,10 @@ __gather_linux_system_info() { n="Debian" v=$(__derive_debian_numeric_version "$v") ;; + sles ) + n="SUSE" + v="${rv}" + ;; * ) n=${nn} ;; @@ -4505,6 +4509,9 @@ install_opensuse_stable_deps() { # shellcheck disable=SC2086 __zypper_install ${__PACKAGES} || return 1 + # Fix for OpenSUSE 13.2 and 2015.8 - gcc should not be required. Work around until package is fixed by SuSE + _EXTRA_PACKAGES="${_EXTRA_PACKAGES} gcc python-devel libgit2-devel" + if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 @@ -4671,8 +4678,200 @@ install_opensuse_check_services() { ####################################################################################################################### # -# SuSE Install Functions. +# SUSE Enterprise 12 # + +install_suse_12_stable_deps() { + SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release ) + + if [ "${SUSE_PATCHLEVEL}" != "" ]; then + DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}" + fi + + # SLES 12 repo name does not use a patch level so PATCHLEVEL will need to be updated with SP1 + #DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" + + DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}" + + # Is the repository already known + __zypper repos | grep devel_languages_python >/dev/null 2>&1 + if [ $? -eq 1 ]; then + # zypper does not yet know nothing about devel_languages_python + __zypper addrepo --refresh \ + "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1 + fi + + __zypper --gpg-auto-import-keys refresh || return 1 + + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + __zypper --gpg-auto-import-keys update || return 1 + fi + + # Salt needs python-zypp installed in order to use the zypper module + __PACKAGES="python-zypp" + # shellcheck disable=SC2089 + __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-msgpack-python" + __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests" + + if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then + check_pip_allowed + echowarn "PyYaml will be installed using pip" + else + __PACKAGES="${__PACKAGES} python-PyYAML" + fi + + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + __PACKAGES="${__PACKAGES} python-apache-libcloud" + fi + + # SLES 11 SP3 ships with both python-M2Crypto-0.22.* and python-m2crypto-0.21 and we will be asked which + # we want to install, even with --non-interactive. + # Let's try to install the higher version first and then the lower one in case of failure + __zypper_install 'python-M2Crypto>=0.22' || __zypper_install 'python-M2Crypto>=0.21' || return 1 + # shellcheck disable=SC2086,SC2090 + __zypper_install ${__PACKAGES} || return 1 + + if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then + # There's no python-PyYaml in SP1, let's install it using pip + pip install PyYaml || return 1 + fi + + # PIP based installs need to copy configuration files "by hand". + if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then + # Let's trigger config_salt() + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + # Let's set the configuration directory to /tmp + _TEMP_CONFIG_DIR="/tmp" + CONFIG_SALT_FUNC="config_salt" + + for fname in minion master syndic api; do + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + # Syndic uses the same configuration file as the master + [ $fname = "syndic" ] && fname=master + + # Let's download, since they were not provided, the default configuration files + if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then + # shellcheck disable=SC2086 + curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \ + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + fi + done + fi + fi + + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + __zypper_install ${_EXTRA_PACKAGES} || return 1 + fi + + return 0 +} + +install_suse_12_git_deps() { + install_suse_11_stable_deps || return 1 + + if [ "$(which git)" = "" ]; then + __zypper_install git || return 1 + fi + + __git_clone_and_checkout || return 1 + + if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + # We're on the develop branch, install whichever tornado is on the requirements file + __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + if [ "${__REQUIRED_TORNADO}" != "" ]; then + __zypper_install python-tornado + fi + fi + + # Let's trigger config_salt() + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" + CONFIG_SALT_FUNC="config_salt" + fi + + return 0 +} + +install_suse_12_stable() { + if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then + install_opensuse_stable || return 1 + else + # USE_SETUPTOOLS=1 To work around + # error: option --single-version-externally-managed not recognized + USE_SETUPTOOLS=1 pip install salt || return 1 + fi + return 0 +} + +install_suse_12_git() { + install_opensuse_git || return 1 + return 0 +} + +install_suse_12_stable_post() { + if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then + install_opensuse_stable_post || return 1 + else + for fname in minion master syndic api; do + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + if [ -f /bin/systemctl ]; then + # shellcheck disable=SC2086 + curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ + -o "/usr/lib/systemd/system/salt-$fname.service" || return 1 + continue + fi + + ## shellcheck disable=SC2086 + #curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ + # -o "/etc/init.d/salt-$fname" || return 1 + #chmod +x "/etc/init.d/salt-$fname" + + if [ -f /bin/systemctl ]; then + systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) + sleep 0.1 + systemctl daemon-reload + continue + fi + + done + fi + return 0 +} + +install_suse_12_git_post() { + install_opensuse_git_post || return 1 + return 0 +} + +install_suse_12_restart_daemons() { + install_opensuse_restart_daemons || return 1 + return 0 +} + +# +# End of SUSE Enterprise 12 +# +####################################################################################################################### + +####################################################################################################################### +# +# SUSE Enterprise 11 +# + install_suse_11_stable_deps() { SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release ) if [ "${SUSE_PATCHLEVEL}" != "" ]; then @@ -4842,6 +5041,16 @@ install_suse_11_restart_daemons() { return 0 } + +# +# End of SUSE Enterprise 11 +# +####################################################################################################################### +# +# SUSE Enterprise General Functions +# + +# Used for both SLE 11 and 12 install_suse_check_services() { if [ ! -f /bin/systemctl ]; then # Not running systemd!? Don't check! @@ -4861,8 +5070,9 @@ install_suse_check_services() { done return 0 } + # -# End of SuSE Install Functions. +# SUSE Enterprise General Functions # ####################################################################################################################### From 5eded75bcb87705139ce5aa51588feb13789a2a9 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Thu, 4 Feb 2016 11:54:30 +0100 Subject: [PATCH 051/156] Typo fix (tnx @vutny), Ubuntu repo's & keys according to new layout --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5eab54b..44c6192 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1875,7 +1875,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH/$STABLE_REV $DISTRO_CODENAME main" >> \ /etc/apt/sources.list.d/saltstack.list fi @@ -1884,7 +1884,7 @@ install_ubuntu_stable_deps() { __apt_get_install_noinput wget # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/ubuntu$DISTRO_MAJOR_VERSION/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 @@ -2949,7 +2949,7 @@ skip_if_unavailable=True gpgcheck=1 gpgkey=${base_url}${gpg_key} enabled=1 -enabled_metadata=1gpg +enabled_metadata=1 _eof __fetch_url /tmp/repo-saltstack.pub "${fetch_url}${gpg_key}" || return 1 From accab728b5f8726245d24d6974debea31c4f1745 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 4 Feb 2016 17:38:06 +0200 Subject: [PATCH 052/156] Enable shallow cloning for version branches by default, not only tags --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d023c1b..2201edb 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1300,7 +1300,7 @@ __git_clone_and_checkout() { if [ "$_FORCE_SHALLOW_CLONE" -eq "${BS_TRUE}" ]; then echoinfo "Forced shallow cloning of git repository." __SHALLOW_CLONE="${BS_TRUE}" - elif [ "$(echo "$GIT_REV" | sed 's/^.*\(v[[:digit:]]\{1,4\}\.[[:digit:]]\{1,2\}\)\(\.[[:digit:]]\{1,2\}\)\?.*$/MATCH/')" = "MATCH" ]; then + elif [ "$(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, shallow cloning enabled." __SHALLOW_CLONE="${BS_TRUE}" else From b85e0ebd3e7ec8fe2fab251a500504ccda5d7dcf Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 5 Feb 2016 12:16:40 +0100 Subject: [PATCH 053/156] Ubuntu needs CPU_ARCH_L (amd64) rather than CPU_ARCH (x86_64) --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 44c6192..6d3c0cf 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1875,7 +1875,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH_L/$STABLE_REV $DISTRO_CODENAME main" >> \ /etc/apt/sources.list.d/saltstack.list fi @@ -1884,7 +1884,7 @@ install_ubuntu_stable_deps() { __apt_get_install_noinput wget # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH_L/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 From 00a661a2ab043a6c9a1c20be74079bfe9519b8ea Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Fri, 5 Feb 2016 12:36:45 +0100 Subject: [PATCH 054/156] Actually need a translation similar to BSD's --- bootstrap-salt.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 50fecaf..f5f6fa6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1876,6 +1876,14 @@ install_ubuntu_deps() { } install_ubuntu_stable_deps() { + # This probably holds true for the Debians as well + if [ "$CPU_ARCH_L" = "amd64" -o "$CPU_ARCH_L" = "x86_64" ]; then + repo_arch="amd64" + elif [ "$CPU_ARCH_L" = "i386" -o "$CPU_ARCH_L" = "i686" ]; then + echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Ubuntu (yet?)" + repo_arch="i386" + fi + install_ubuntu_deps || return 1 # the latest version of 2015.5 and all versions of 2015.8 and beyond are hosted on repo.saltstack.com @@ -1883,7 +1891,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH_L/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" >> \ /etc/apt/sources.list.d/saltstack.list fi @@ -1892,7 +1900,7 @@ install_ubuntu_stable_deps() { __apt_get_install_noinput wget # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$CPU_ARCH_L/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 @@ -2938,7 +2946,7 @@ __install_saltstack_rhel_repository() { repo_rev="latest" fi - base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + base_url="http://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then From 0d2afe010d8501b5689562521f50a0657fdde845 Mon Sep 17 00:00:00 2001 From: Tobias Jungel Date: Fri, 5 Feb 2016 14:31:30 +0100 Subject: [PATCH 055/156] do not install copr repo on fedora 22+ * there is no copr repo for fedora 23 * copr repo for fedora 22 is outdated; hence using the packages of fedora #736 --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 57ea6c4..14cf768 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2988,6 +2988,7 @@ __install_saltstack_copr_salt_repository() { echoinfo "Adding SaltStack's COPR repository" if [ "${DISTRO_NAME_L}" = "fedora" ]; then + [ "$DISTRO_MAJOR_VERSION" -ge 22 ] && return 0 __REPOTYPE="${DISTRO_NAME_L}" else __REPOTYPE="epel" From 49ee389b5dc8deb590c78cd9c70621ee914d6940 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 5 Feb 2016 18:03:31 -0700 Subject: [PATCH 056/156] Only ubuntu and CentOS support $STABLE_REV install --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f5f6fa6..0460c56 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -235,9 +235,9 @@ usage() { Installation types: - stable (default) - - stable [version] (ubuntu specific) - - daily (ubuntu specific) - - testing (redhat specific) + - stable [version] (currently only supported on: Ubuntu, CentOS) + - daily (Ubuntu specific) + - testing (RedHat specific) - git Examples: @@ -1210,7 +1210,7 @@ __ubuntu_codename_translation if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 -elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat|scientific|oracle|amazon|fedora)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then +elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi From 85b747e89760a08d3d99e25bdf7775889350d6b4 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 5 Feb 2016 18:04:04 -0700 Subject: [PATCH 057/156] reformat argument help text --- bootstrap-salt.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0460c56..1114712 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -258,7 +258,9 @@ usage() { -D Show debug output. -c Temporary configuration directory -g Salt repository URL. (default: git://github.com/saltstack/salt.git) - -G Instead of cloning from git://github.com/saltstack/salt.git, clone from https://github.com/saltstack/salt.git (Usually necessary on systems which have the regular git protocol port blocked, where https usually is not) + -G Instead of cloning from git://github.com/saltstack/salt.git, clone from + https://github.com/saltstack/salt.git (Usually necessary on systems which + have the regular git protocol port blocked, where https usually is not) -k Temporary directory holding the minion keys which will pre-seed the master. -s Sleep time used when waiting for daemons to start, restart and when checking @@ -292,7 +294,8 @@ usage() { 'install__check_services' checks. You can also do this by touching /tmp/disable_salt_checks on the target host. Defaults \${BS_FALSE} -H Use the specified http proxy for the installation - -Z Enable external software source for newer ZeroMQ(Only available for RHEL/CentOS/Fedora/Ubuntu based distributions) + -Z Enable external software source for newer ZeroMQ(Only available for + RHEL/CentOS/Fedora/Ubuntu based distributions) -b Assume that dependencies are already installed and software sources are set up. If git is selected, git tree is still checked out as dependency step. From 0b6379b1fefae07ef5deb80655603c94e1fa79b7 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 5 Feb 2016 18:20:45 -0700 Subject: [PATCH 058/156] add release channel to ubuntu repo name --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1114712..61a035e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1895,7 +1895,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" >> \ - /etc/apt/sources.list.d/saltstack.list + /etc/apt/sources.list.d/salt-$STABLE_REV.list fi From f601729b1a07b5e1d4aaf6d07e09980a7252937f Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 5 Feb 2016 18:43:28 -0700 Subject: [PATCH 059/156] use HTTPS for SaltStack RHEL repo --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 61a035e..2464f38 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2949,7 +2949,7 @@ __install_saltstack_rhel_repository() { repo_rev="latest" fi - base_url="http://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then From c3aadde20558cf3bdf2ec44198818c35d210168c Mon Sep 17 00:00:00 2001 From: Niels Abspoel Date: Sat, 16 Jan 2016 12:29:26 +0100 Subject: [PATCH 060/156] switch repositories for suse and sles --- bootstrap-salt.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1e9957d..ec2f4a1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4487,11 +4487,11 @@ install_opensuse_stable_deps() { fi # Is the repository already known - opensuse_deps_repo_url="http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/" + opensuse_deps_repo_url="http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" __zypper repos --details | grep "${opensuse_deps_repo_url}" >/dev/null 2>&1 if [ $? -eq 1 ]; then - # zypper does not yet know nothing about devel_languages_python - __zypper addrepo --refresh "${opensuse_deps_repo_url}" devel_languages_python || return 1 + # zypper does not yet know nothing about systemsmanagement_saltstack + __zypper addrepo --refresh "${opensuse_deps_repo_url}" systemsmanagement_saltstack || return 1 fi __zypper --gpg-auto-import-keys refresh @@ -4901,11 +4901,11 @@ install_suse_11_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" # Is the repository already known - __zypper repos | grep devel_languages_python >/dev/null 2>&1 + __zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1 if [ $? -eq 1 ]; then - # zypper does not yet know nothing about devel_languages_python + # zypper does not yet know nothing about systemsmanagement_saltstack __zypper addrepo --refresh \ - "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1 + "http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" || return 1 fi __zypper --gpg-auto-import-keys refresh || return 1 From 966f15d78e1dac3e27ba17acc69106adc2f4602f Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 5 Feb 2016 20:31:46 -0700 Subject: [PATCH 061/156] SuSE 11 and 12 now have libzmq5 --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ec2f4a1..1f43878 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4731,7 +4731,7 @@ install_suse_12_stable_deps() { # Salt needs python-zypp installed in order to use the zypper module __PACKAGES="python-zypp" # shellcheck disable=SC2089 - __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-msgpack-python" + __PACKAGES="${__PACKAGES} libzmq5 python python-Jinja2 python-msgpack-python" __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests" if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then @@ -4917,7 +4917,7 @@ install_suse_11_stable_deps() { # Salt needs python-zypp installed in order to use the zypper module __PACKAGES="python-zypp" # shellcheck disable=SC2089 - __PACKAGES="${__PACKAGES} libzmq3 python python-Jinja2 python-msgpack-python" + __PACKAGES="${__PACKAGES} libzmq5 python python-Jinja2 python-msgpack-python" __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests" if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then From 99927b030114630b90601bc5384e14698d5e1a04 Mon Sep 17 00:00:00 2001 From: Sergey Paramonov Date: Sat, 6 Feb 2016 15:10:46 -0500 Subject: [PATCH 062/156] Update bootstrap-salt.sh corrected for __fetch_url() and install_openbsd_deps() --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e0f7374..ca7fd68 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -585,7 +585,7 @@ __fetch_url() { curl $_CURL_ARGS -L -s -o "$1" "$2" >/dev/null 2>&1 || wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 || - fetch -q -o "$1" "$2" >/dev/null 2>&1 # Pre FreeBSD 10 + fetch -q -o "$1" "$2" >/dev/null 2>&1 || # Pre FreeBSD 10 ftp -o "$1" "$2" >/dev/null 2>&1 # OpenBSD } @@ -4383,11 +4383,11 @@ install_openbsd_deps() { # Let's set the configuration directory to /tmp _TEMP_CONFIG_DIR="/tmp" CONFIG_SALT_FUNC="config_salt" - for fname in minion master; do + for fname in minion master syndic api; do # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - # [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Let's download, since they were not provided, the default configuration files @@ -4451,7 +4451,7 @@ install_openbsd_post() { # Install rc.d files. # ## below workaround for /etc/rc.d/rc.subr in OpenBSD >= 5.8 - ## is needed for salt service to start/stop properly by /etc/rc.d + ## is needed for salt services to start/stop properly from /etc/rc.d ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 ## if [ $(grep '\-xf' /etc/rc.d/rc.subr)]; then From 3ed2a2eafb5d5ea56faa6928d570adc38d00c6cd Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 8 Feb 2016 12:16:02 +0200 Subject: [PATCH 063/156] Reformat and correct usage instructions --- bootstrap-salt.sh | 112 ++++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1f43878..c372523 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -235,71 +235,75 @@ usage() { Usage : ${__ScriptName} [options] Installation types: - - stable (default) - - stable [version] (currently only supported on: Ubuntu, CentOS) - - daily (Ubuntu specific) - - testing (RedHat specific) - - git + - stable (this is default) + - stable [version] (currently only supported on: Ubuntu, CentOS) + - daily (Ubuntu specific) + - testing (RHEL-family specific, configure EPEL testing repo) + - git [branch_or_tag] (install from 'develop' by default) Examples: - ${__ScriptName} - ${__ScriptName} stable - - ${__ScriptName} stable 2014.7 + - ${__ScriptName} stable 2015.8 - ${__ScriptName} daily - ${__ScriptName} testing - ${__ScriptName} git - ${__ScriptName} git develop - - ${__ScriptName} git v0.17.0 + - ${__ScriptName} git v2015.8.5 - ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 Options: - -h Display this message - -v Display script version - -n No colours. - -D Show debug output. - -c Temporary configuration directory - -g Salt repository URL. (default: git://github.com/saltstack/salt.git) - -G Instead of cloning from git://github.com/saltstack/salt.git, clone from - https://github.com/saltstack/salt.git (Usually necessary on systems which - have the regular git protocol port blocked, where https usually is not) - -k Temporary directory holding the minion keys which will pre-seed - the master. - -s Sleep time used when waiting for daemons to start, restart and when checking - for the services running. Default: ${__DEFAULT_SLEEP} - -M Also install salt-master - -S Also install salt-syndic - -N Do not install salt-minion - -X Do not start daemons after installation - -C Only run the configuration function. This option automatically bypasses - any installation. Implies -F (forced overwrite). To overwrite master or - syndic configs, -M or -S, respectively, must also be specified. - -P Allow pip based installations. On some distributions the required salt - packages or its dependencies are not available as a package for that - distribution. Using this flag allows the script to use pip as a last - resort method. NOTE: This only works for functions which actually - implement pip based installations. - -F Allow copied files to overwrite existing (config, init.d, etc). - -U If set, fully upgrade the system prior to bootstrapping salt - -K If set, keep the temporary files in the temporary directories specified - with -c and -k. - -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 - -i Pass the salt-minion id. This will be stored under - \${BS_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. - -d Disable check_service functions. Setting this flag disables the - 'install__check_services' checks. You can also do this by - touching /tmp/disable_salt_checks on the target host. Defaults \${BS_FALSE} - -H Use the specified http proxy for the installation - -Z Enable external software source for newer ZeroMQ(Only available for - RHEL/CentOS/Fedora/Ubuntu based distributions) - -b Assume that dependencies are already installed and software sources are set up. - If git is selected, git tree is still checked out as dependency step. - -f Force shallow cloning for git installations. This may result in an "n/a" in the version number. + -h Display this message + -v Display script version + -n No colours. + -D Show debug output. + -c Temporary configuration directory + -g Salt repository URL. Default: ${_SALTSTACK_REPO_URL} + -G Instead of cloning from ${_SALTSTACK_REPO_URL}, clone from + https://${_SALTSTACK_REPO_URL#*://} + (Usually necessary on systems which have the regular git protocol port + blocked, where https usually is not) + -k Temporary directory holding the minion keys which will pre-seed + the master. + -s Sleep time used when waiting for daemons to start, restart and when + checking for the services running. Default: ${__DEFAULT_SLEEP} + -M Also install salt-master + -S Also install salt-syndic + -N Do not install salt-minion + -X Do not start daemons after installation + -C Only run the configuration function. This option automatically bypasses + any installation. Implies -F (forced overwrite). To overwrite master or + syndic configs, -M or -S, respectively, must also be specified. + -P Allow pip based installations. On some distributions the required salt + packages or its dependencies are not available as a package for that + distribution. Using this flag allows the script to use pip as a last + resort method. NOTE: This only works for functions which actually + implement pip based installations. + -F Allow copied files to overwrite existing (config, init.d, etc). + -U If set, fully upgrade the system prior to bootstrapping salt + -K If set, keep the temporary files in the temporary directories specified + with -c and -k. + -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 + -i Pass the salt-minion id. This will be stored under + \${BS_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. + -d Disable check_service functions. Setting this flag disables the + 'install__check_services' checks. You can also do this by + touching /tmp/disable_salt_checks on the target host. Default: \${BS_FALSE} + -H Use the specified http proxy for the installation + -Z Enable additional package repository for newer ZeroMQ + (Only available for RHEL/CentOS/Fedora/Ubuntu based distributions) + -b Assume that dependencies are already installed and software sources are + set up. If git is selected, git tree is still checked out as dependency + step. + -f Force shallow cloning for git installations. + This may result in an "n/a" in the version number. EOT } # ---------- end of function usage ---------- From aa0caf00e1d85789dbc4e119be8337f0a6ff3717 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 8 Feb 2016 12:24:30 +0200 Subject: [PATCH 064/156] Add myself to authors, fix sorting --- AUTHORS.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 8dc01f2..09c27a7 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -20,10 +20,11 @@ Cam camereonsparr Chris Rebert cvrebert chris.rebert@hulu.com Chris Buechler cbuechler cmb@pfsense.org Christer Edwards cedwards -denmat denmat Dag Viggo Lokøen dagvl dag.viggo@lokoen.org Dan Mick dmick dan.mick@inktank.com David J. Felix DavidJFelix +denmat denmat +Denys Havrysh vutny denys.gavrysh@gmail.com deployboy deployboy Diego Woitasen diegows diego@flugel.it Elias Probst eliasp From 7183557b1d22bb450aa50f073b6c19cba71e7c45 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 8 Feb 2016 12:30:23 +0200 Subject: [PATCH 065/156] Update year in copyright --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index c372523..61e2829 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5,11 +5,11 @@ # # FILE: bootstrap-salt.sh # -# DESCRIPTION: Bootstrap salt installation for various systems/distributions +# DESCRIPTION: Bootstrap Salt installation for various systems/distributions # # BUGS: https://github.com/saltstack/salt-bootstrap/issues # -# COPYRIGHT: (c) 2012-2015 by the SaltStack Team, see AUTHORS.rst for more +# COPYRIGHT: (c) 2012-2016 by the SaltStack Team, see AUTHORS.rst for more # details. # # LICENSE: Apache 2.0 From 9b6bfc9aadbd4e6982f23de220330b033a0ac060 Mon Sep 17 00:00:00 2001 From: shawnbutts Date: Fri, 4 Dec 2015 13:47:24 -0500 Subject: [PATCH 066/156] fix for Amazon Linux - enable EPEL repo with yum-config-manager - exclude zeromq* salt* python-zmq* packages from the EPEL repo - move the install repo to repo.saltstack.com - install python26-ordereddict package as python-ordereddict has been removed --- bootstrap-salt.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 61e2829..14c6f0c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1793,6 +1793,8 @@ __enable_universe_repository() { add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 fi + add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + return 0 } @@ -3668,29 +3670,31 @@ install_amazon_linux_ami_2010_git_deps() { } install_amazon_linux_ami_deps() { - # According to http://aws.amazon.com/amazon-linux-ami/faqs/#epel we should + # enable the EPEL repo + /usr/bin/yum-config-manager --enable epel || return 1 - # enable the EPEL 6 repo - if [ "$CPU_ARCH_L" = "i686" ]; then - EPEL_ARCH="i386" - else - EPEL_ARCH=$CPU_ARCH_L - fi - rpm -Uvh --force "http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 + # exclude Salt and ZeroMQ packages from EPEL + /usr/bin/yum-config-manager epel --setopt "epel.exclude=zeromq* salt* python-zmq*" --save || return 1 - __REPO_FILENAME="saltstack-salt-epel-6.repo" + __REPO_FILENAME="saltstack-repo.repo" if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then - echoinfo "Adding SaltStack's COPR repository" - __fetch_url /etc/yum.repos.d/${__REPO_FILENAME} \ - "https://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/epel-6/${__REPO_FILENAME}" || return 1 + cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}" +[saltstack-repo] +disabled=False +name=SaltStack repo for RHEL/CentOS 6 +gpgcheck=1 +gpgkey=https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub +baseurl=https://repo.saltstack.com/yum/rhel6 +humanname=SaltStack repo for RHEL/CentOS 6 +_eof fi if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then yum -y update || return 1 fi - __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python-ordereddict python-jinja2 python-requests" + __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" @@ -4712,6 +4716,7 @@ install_suse_12_stable_deps() { if [ "${SUSE_PATCHLEVEL}" != "" ]; then DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}" fi + DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" # SLES 12 repo name does not use a patch level so PATCHLEVEL will need to be updated with SP1 #DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" From 00faf95d8f6ed2782c26e1eecefc7ab38f64d9a6 Mon Sep 17 00:00:00 2001 From: Shawn Butts Date: Thu, 4 Feb 2016 05:48:04 -0500 Subject: [PATCH 067/156] Update bootstrap-salt.sh --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 14c6f0c..480ba2d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3684,8 +3684,8 @@ install_amazon_linux_ami_deps() { disabled=False name=SaltStack repo for RHEL/CentOS 6 gpgcheck=1 -gpgkey=https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub -baseurl=https://repo.saltstack.com/yum/rhel6 +gpgkey=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTSTACK-GPG-KEY.pub +baseurl=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/ humanname=SaltStack repo for RHEL/CentOS 6 _eof fi From fac497e58492ff275bd71f5172c64d943f2b3e86 Mon Sep 17 00:00:00 2001 From: Sergey Paramonov Date: Tue, 9 Feb 2016 12:36:44 -0500 Subject: [PATCH 068/156] Update bootstrap-salt.sh added choose_openbsd_mirror() function, which is comparing ping time from all officially listed openbsd mirrors and picks closest mirror. --- bootstrap-salt.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ca7fd68..ea17a4e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4356,9 +4356,27 @@ install_freebsd_restart_daemons() { # OpenBSD Install Functions # +choose_openbsd_mirror() { + MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html + MIRRORS_LIST=$(ftp -o - $MIRRORS_LIST_URL |grep href |grep http | grep pub | awk -F \" '{ print $2 }') + echoinfo "getting list of mirrors from $MIRRORS_LIST_URL" + ping -c 2 -q $(echo $MIRRORS_LIST_URL | awk -F \/ '{ print $3 }') 1>/dev/null || return 1 + for MIRROR in $MIRRORS_LIST + do + TIME=$(ping -c 1 -q $(echo $MIRROR | awk -F \/ '{ print $3 }') |grep round-trip |awk -F \/ '{ print $5 }') + [ -z $TIME ] && continue + echodebug "ping time for $MIRROR is $TIME" + [ -z $MINTIME ] && MINTIME=$TIME + [ $( echo "$TIME < $MINTIME" |bc ) -eq 1 ] && MINTIME=$TIME && OPENBSD_REPO=$MIRROR || continue + done +} + + install_openbsd_deps() { - ping -c 2 -q mirrors.nycbug.org || return 1 - echo "installpath = http://mirrors.nycbug.org/pub/OpenBSD/${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 + choose_openbsd_mirror || return 1 + [ -z $OPENBSD_REPO ] && return 1 + echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" + echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 pkg_add -I -v lsof || return 1 pkg_add -I -v py-pip || return 1 ln -sf $(ls -d /usr/local/bin/pip2.*) /usr/local/bin/pip || return 1 From 86f6f18790a2556aa74bd0b0467c43354f4be164 Mon Sep 17 00:00:00 2001 From: Sergey Paramonov Date: Tue, 9 Feb 2016 12:43:14 -0500 Subject: [PATCH 069/156] Update bootstrap-salt.sh removed commented unneeded lines from install_openbsd_post() function --- bootstrap-salt.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ea17a4e..f4c13af 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4483,8 +4483,6 @@ install_openbsd_post() { [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "api" ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue - #[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && continue if [ $? -eq 1 ]; then From 855bead72199d87d544ead3578235fb644583a90 Mon Sep 17 00:00:00 2001 From: Niels Abspoel Date: Tue, 9 Feb 2016 22:01:59 +0100 Subject: [PATCH 070/156] add new repo --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 61e2829..bdeb8e3 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4719,11 +4719,11 @@ install_suse_12_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}" # Is the repository already known - __zypper repos | grep devel_languages_python >/dev/null 2>&1 + __zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1 if [ $? -eq 1 ]; then - # zypper does not yet know nothing about devel_languages_python + # zypper does not yet know nothing about systemsmanagement_saltstack __zypper addrepo --refresh \ - "http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo" || return 1 + "http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" || return 1 fi __zypper --gpg-auto-import-keys refresh || return 1 From 8c7bff699906f2a2d6aa20290a6a661786d82d4c Mon Sep 17 00:00:00 2001 From: Randy Thompson Date: Tue, 16 Feb 2016 13:29:09 -0600 Subject: [PATCH 071/156] fixing syntax errors SC1073: Couldn't parse this test expression line 4434 SC1073: Couldn't parse this test expression line 4451 SC2173: SIGKILL/SIGSTOP can not be trapped line 553 SC2170: Numerical -eq does not dereference in [..]. Expand or use string operator line 4395 --- bootstrap-salt.sh | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9553299..e137645 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -550,7 +550,7 @@ __exit_cleanup() { # Exit with the "original" exit code, not the trapped code exit $EXIT_CODE } - trap "__trap_errors" INT QUIT ABRT KILL QUIT TERM + trap "__trap_errors" INT QUIT ABRT QUIT TERM # Now we're "good" to kill tee kill -s TERM "$TEE_PID" @@ -4043,8 +4043,8 @@ __configure_freebsd_pkg_details() { mkdir -p /etc/pkg/ ## Use new JSON-like format for pkg repo configs - ## check if /etc/pkg/FreeBSD.conf is already in place - if [ ! -f /etc/pkg/FreeBSD.conf ]; then + ## check if /etc/pkg/FreeBSD.conf is already in place + if [ ! -f /etc/pkg/FreeBSD.conf ]; then conf_file=/usr/local/etc/pkg/repos/freebsd.conf { echo "FreeBSD:{" @@ -4194,16 +4194,16 @@ install_freebsd_10_stable() { } install_freebsd_11_stable() { -# -# installing latest version of salt from FreeBSD CURRENT ports repo -# +# +# installing latest version of salt from FreeBSD CURRENT ports repo +# /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 - + # # setting _SALT_ETC_DIR to match paths from FreeBSD ports: # _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - if [ ! -d /etc/salt ]; then + if [ ! -d /etc/salt ]; then ln -sf ${_SALT_ETC_DIR} /etc/salt fi return 0 @@ -4336,10 +4336,10 @@ install_openbsd_deps() { [ -z $OPENBSD_REPO ] && return 1 echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 - pkg_add -I -v lsof || return 1 - pkg_add -I -v py-pip || return 1 - ln -sf $(ls -d /usr/local/bin/pip2.*) /usr/local/bin/pip || return 1 - ln -sf $(ls -d /usr/local/bin/pydoc2*) /usr/local/bin/pydoc || return 1 + pkg_add -I -v lsof || return 1 + pkg_add -I -v py-pip || return 1 + ln -sf $(ls -d /usr/local/bin/pip2.*) /usr/local/bin/pip || return 1 + ln -sf $(ls -d /usr/local/bin/pydoc2*) /usr/local/bin/pydoc || return 1 ln -sf $(ls -d /usr/local/bin/python2.[0-9]) /usr/local/bin/python || return 1 ln -sf $(ls -d /usr/local/bin/python2.[0-9]*to3) /usr/local/bin/2to3 || return 1 ln -sf $(ls -d /usr/local/bin/python2.[0-9]*-config) /usr/local/bin/python-config || return 1 @@ -4392,7 +4392,7 @@ install_openbsd_git_deps() { # # Let's trigger config_salt() # - if [ "$_TEMP_CONFIG_DIR" -eq "null" ]; then + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" fi @@ -4400,8 +4400,8 @@ install_openbsd_git_deps() { } install_openbsd_stable() { - -# pkg_add -r -I -v salt || return 1 + +# pkg_add -r -I -v salt || return 1 check_pip_allowed /usr/local/bin/pip install salt || return 1 if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then @@ -4427,11 +4427,11 @@ install_openbsd_post() { # # Install rc.d files. # - ## below workaround for /etc/rc.d/rc.subr in OpenBSD >= 5.8 + ## below workaround for /etc/rc.d/rc.subr in OpenBSD >= 5.8 ## is needed for salt services to start/stop properly from /etc/rc.d ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 ## - if [ $(grep '\-xf' /etc/rc.d/rc.subr)]; then + if [ $(grep '\-xf' /etc/rc.d/rc.subr) ]; then cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr sed -i.$(date +%F).saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr fi @@ -4448,7 +4448,7 @@ install_openbsd_post() { if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" - if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ $(grep salt_${fname} /etc/rc.conf.local) -eq ""]; then + if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ $(grep salt_${fname} /etc/rc.conf.local) -eq "" ]; then copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 echo salt_${fname}_enable="YES" >> /etc/rc.conf.local echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local @@ -4459,7 +4459,7 @@ install_openbsd_post() { } install_openbsd_check_services() { - salt --version + salt --version for fname in minion master syndic api; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4485,7 +4485,7 @@ install_openbsd_restart_daemons() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /etc/rc.d/salt_${fname} ]; then /etc/rc.d/salt_${fname} stop > /dev/null 2>&1 /etc/rc.d/salt_${fname} start @@ -4756,7 +4756,7 @@ install_opensuse_stable_deps() { __zypper_install ${__PACKAGES} || return 1 # Fix for OpenSUSE 13.2 and 2015.8 - gcc should not be required. Work around until package is fixed by SuSE - _EXTRA_PACKAGES="${_EXTRA_PACKAGES} gcc python-devel libgit2-devel" + _EXTRA_PACKAGES="${_EXTRA_PACKAGES} gcc python-devel libgit2-devel" if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" From 51a07ddfa691ede78f61edf60c667bc008182376 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Wed, 17 Feb 2016 11:22:44 -0600 Subject: [PATCH 072/156] Added cache dir customization --- bootstrap-salt.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9553299..6ecf2b7 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -27,6 +27,7 @@ __ScriptName="bootstrap-salt.sh" # * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed) # * BS_ECHO_DEBUG: If 1 enable debug echo which can also be set by -D # * BS_SALT_ETC_DIR: Defaults to /etc/salt (Only tweak'able on git based installations) +# * BS_SALT_CACHE_DIR: Defaults to /var/cache/salt (Only tweak'able on git based installations) # * BS_KEEP_TEMP_FILES: If 1, don't move temporary files, instead copy them # * BS_FORCE_OVERWRITE: Force overriding copied files(config, init.d, etc) # * BS_UPGRADE_SYS: If 1 and an option, upgrade system. Default 0. @@ -200,6 +201,7 @@ _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} +_SALT_CACHE_DIR=${BS_SALT_CACHE_DIR:-/var/cache/salt} _PKI_DIR=${_SALT_ETC_DIR}/pki _FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE} _GENTOO_USE_BINHOST=${BS_GENTOO_USE_BINHOST:-$BS_FALSE} @@ -2056,7 +2058,7 @@ install_ubuntu_daily() { install_ubuntu_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 fi @@ -2650,7 +2652,7 @@ install_debian_8_stable() { install_debian_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 fi @@ -2864,7 +2866,7 @@ install_fedora_git_deps() { install_fedora_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 else python setup.py install || return 1 fi @@ -3219,7 +3221,7 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" install --prefix=/usr || return 1 + $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --prefix=/usr || return 1 else $_PYEXE setup.py install --prefix=/usr || return 1 fi @@ -3886,7 +3888,7 @@ install_arch_linux_stable() { install_arch_linux_git() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 else python2 setup.py install || return 1 fi @@ -4228,7 +4230,7 @@ install_freebsd_git() { /usr/local/bin/python2 setup.py \ --salt-root-dir=/usr/local \ --salt-config-dir="${_SALT_ETC_DIR}" \ - --salt-cache-dir=/var/cache/salt \ + --salt-cache-dir="${_SALT_CACHE_DIR}" \ --salt-sock-dir=/var/run/salt \ --salt-srv-root-dir=/srv \ --salt-base-file-roots-dir="${_SALT_ETC_DIR}/states" \ @@ -4581,7 +4583,7 @@ install_smartos_stable() { install_smartos_git() { # Use setuptools in order to also install dependencies # lets force our config path on the setup for now, since salt/syspaths.py only got fixed in 2015.5.0 - USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" install || return 1 + USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 return 0 } @@ -5863,9 +5865,9 @@ fi # Ensure that the cachedir exists # (Workaround for https://github.com/saltstack/salt/issues/6502) if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - if [ ! -d /var/cache/salt/minion/proc ]; then + if [ ! -d ${_SALT_CACHE_DIR}/minion/proc ]; then echodebug "Creating salt's cachedir" - mkdir -p /var/cache/salt/minion/proc + mkdir -p ${_SALT_CACHE_DIR}/minion/proc fi fi From 2096b5595ee3a57121a3a286a490a3d777bafabd Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 22 Feb 2016 15:51:09 +0200 Subject: [PATCH 073/156] Import CentOS 7 GPG key on RHEL for installing base dependencies from Salt corporate repository --- bootstrap-salt.sh | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9553299..60e7224 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1586,6 +1586,28 @@ movefile() { } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __rpm_import_gpg +# DESCRIPTION: Download and import GPG public key to rpm database +# PARAMETERS: url +#---------------------------------------------------------------------------------------------------------------------- +__rpm_import_gpg() { + url="$1" + + if __check_command_exists mktemp; then + tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub)" + else + tempfile="/tmp/salt-gpg-$$.pub" + fi + + __fetch_url "$tempfile" "$url" || return 1 + rpm --import "$tempfile" || return 1 + rm -f "$tempfile" + + return 0 +} + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __check_services_systemd # DESCRIPTION: Return 0 or 1 in case the service is enabled or not @@ -3018,10 +3040,16 @@ enabled=1 enabled_metadata=1 _eof - __fetch_url /tmp/repo-saltstack.pub "${fetch_url}${gpg_key}" || return 1 - rpm --import /tmp/repo-saltstack.pub || return 1 - rm -f /tmp/repo-saltstack.pub + __rpm_import_gpg "${fetch_url}${gpg_key}" || return 1 fi + + if [ "$DISTRO_MAJOR_VERSION" -eq 7 ] && [ "$repo_rev" = "latest" -o "$repo_rev" = "2015.8" ]; then + # Import CentOS 7 GPG key on RHEL for installing base dependencies from + # Salt corporate repository + rpm -qa gpg-pubkey\* --qf "%{name}-%{version}\n" | grep -q ^gpg-pubkey-f4a80eb5$ || \ + __rpm_import_gpg "https://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1 + fi + return 0 } From 173a7cf64e492be3bebad55d44fd6f64fa455260 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 23 Feb 2016 10:38:41 +0200 Subject: [PATCH 074/156] Securely create temp file --- bootstrap-salt.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 60e7224..da1bbd9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1595,7 +1595,12 @@ __rpm_import_gpg() { url="$1" if __check_command_exists mktemp; then - tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub)" + tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)" + + if [ -z "$tempfile" ]; then + echoerror "Failed to create temporary file in /tmp" + return 1 + fi else tempfile="/tmp/salt-gpg-$$.pub" fi From 9e21f790d26ccf49c2abc01018bf36d083891033 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 26 Feb 2016 12:07:07 +0200 Subject: [PATCH 075/156] Fix lint error --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index da1bbd9..8546680 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3048,7 +3048,7 @@ _eof __rpm_import_gpg "${fetch_url}${gpg_key}" || return 1 fi - if [ "$DISTRO_MAJOR_VERSION" -eq 7 ] && [ "$repo_rev" = "latest" -o "$repo_rev" = "2015.8" ]; then + if [ "$DISTRO_MAJOR_VERSION" -eq 7 ] && ([ "$repo_rev" = "latest" ] || [ "$repo_rev" = "2015.8" ]); then # Import CentOS 7 GPG key on RHEL for installing base dependencies from # Salt corporate repository rpm -qa gpg-pubkey\* --qf "%{name}-%{version}\n" | grep -q ^gpg-pubkey-f4a80eb5$ || \ From 903f5c55518ff1e4962085597fcf7095cab0e4b9 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 11:20:37 +0200 Subject: [PATCH 076/156] Fix some shellcheck warnings --- bootstrap-salt.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ae49152..0bbab2d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1969,7 +1969,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" >> \ - /etc/apt/sources.list.d/salt-$STABLE_REV.list + "/etc/apt/sources.list.d/salt-$STABLE_REV.list" fi @@ -4230,6 +4230,7 @@ install_freebsd_11_stable() { # # installing latest version of salt from FreeBSD CURRENT ports repo # + # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 # @@ -4237,7 +4238,7 @@ install_freebsd_11_stable() { # _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} if [ ! -d /etc/salt ]; then - ln -sf ${_SALT_ETC_DIR} /etc/salt + ln -sf "${_SALT_ETC_DIR}" /etc/salt fi return 0 } @@ -4464,9 +4465,9 @@ install_openbsd_post() { ## is needed for salt services to start/stop properly from /etc/rc.d ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 ## - if [ $(grep '\-xf' /etc/rc.d/rc.subr) ]; then + if grep -q '\-xf' /etc/rc.d/rc.subr; then cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr - sed -i.$(date +%F).saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr + sed -i."$(date +%F)".saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr fi _TEMP_CONFIG_DIR="/tmp" for fname in minion master syndic api; do @@ -4481,7 +4482,7 @@ install_openbsd_post() { if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" - if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ $(grep salt_${fname} /etc/rc.conf.local) -eq "" ]; then + if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 echo salt_${fname}_enable="YES" >> /etc/rc.conf.local echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local From d762a7336e503aacfb2a5dfb2934e2f8e90ce2ca Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 11:32:31 +0200 Subject: [PATCH 077/156] Fix FreeBSD pkg conf file --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0bbab2d..4af9ba1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4083,8 +4083,8 @@ __configure_freebsd_pkg_details() { echo "FreeBSD:{" echo " url: \"${PKGCONFURL}\"," echo " mirror_type: \"srv\"," - echo " signature_type: "fingerprints", - echo " fingerprints: "/usr/share/keys/pkg", + echo " signature_type: \"fingerprints\"," + echo " fingerprints: \"/usr/share/keys/pkg\"," echo " enabled: true" echo "}" } > $conf_file From 63a55c7bad97cc8c98d33d2d4771c6f7cca8685d Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 12:11:50 +0200 Subject: [PATCH 078/156] Refactor `choose_openbsd_mirror` function --- bootstrap-salt.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4af9ba1..b07e434 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4350,17 +4350,31 @@ install_freebsd_restart_daemons() { # choose_openbsd_mirror() { - MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html - MIRRORS_LIST=$(ftp -o - $MIRRORS_LIST_URL |grep href |grep http | grep pub | awk -F \" '{ print $2 }') - echoinfo "getting list of mirrors from $MIRRORS_LIST_URL" - ping -c 2 -q $(echo $MIRRORS_LIST_URL | awk -F \/ '{ print $3 }') 1>/dev/null || return 1 - for MIRROR in $MIRRORS_LIST - do - TIME=$(ping -c 1 -q $(echo $MIRROR | awk -F \/ '{ print $3 }') |grep round-trip |awk -F \/ '{ print $5 }') - [ -z $TIME ] && continue + MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html + MIRROR_LIST_FILE=/tmp/openbsd-mirrors.html + OPENBSD_REPO='' + MINTIME='' + + __fetch_url "$MIRROR_LIST_FILE" "$MIRRORS_LIST_URL" || return 1 + MIRRORS_LIST=$(grep href "$MIRROR_LIST_FILE" | grep http | grep pub | awk -F \" '{ print $2 }') + [ -n "$MIRRORS_LIST" ] && rm -f "$MIRROR_LIST_FILE" + + echoinfo "Getting list of mirrors from $MIRRORS_LIST_URL" + for MIRROR in $MIRRORS_LIST; do + MIRROR_HOST=$(echo "$MIRROR" | awk -F / '{ print $3 }') + TIME=$(ping -c 1 -q "$MIRROR_HOST" | grep round-trip | awk -F / '{ print $5 }') + [ -z "$TIME" ] && continue + echodebug "ping time for $MIRROR is $TIME" - [ -z $MINTIME ] && MINTIME=$TIME - [ $( echo "$TIME < $MINTIME" |bc ) -eq 1 ] && MINTIME=$TIME && OPENBSD_REPO=$MIRROR || continue + [ -z "$MINTIME" ] && MINTIME=$TIME + + FASTER_MIRROR=$(echo "$TIME < $MINTIME" | bc) + if [ "$FASTER_MIRROR" -eq 1 ]; then + MINTIME=$TIME + OPENBSD_REPO=$MIRROR + else + continue + fi done } From edcf6551601b2ba9caed22e889671d5db05d00de Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 17:08:43 +0200 Subject: [PATCH 079/156] Refactor install_openbsd_deps function --- bootstrap-salt.sh | 155 +++++++++++++++++++++++++++++++--------------- 1 file changed, 104 insertions(+), 51 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b07e434..1ab078e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1571,7 +1571,7 @@ movefile() { fi if [ ! -f "$dfile" ]; then - # The destination file does not exist, copy + # The destination file does not exist, move echodebug "Moving $sfile to $dfile" mv "$sfile" "$dfile" || return 1 elif [ -f "$dfile" ] && [ "$overwrite" -eq $BS_TRUE ]; then @@ -1586,6 +1586,57 @@ movefile() { } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: linkfile +# DESCRIPTION: Simple function to create symlinks. Overrides if asked. Accepts globs. +#---------------------------------------------------------------------------------------------------------------------- +linkfile() { + overwrite=$_FORCE_OVERWRITE + if [ $# -eq 2 ]; then + target=$1 + linkname=$2 + elif [ $# -eq 3 ]; then + target=$1 + linkname=$2 + overwrite=$3 + else + echoerror "Wrong number of arguments for linkfile()" + echoinfo "USAGE: linkfile OR linkfile " + exit 1 + fi + + for sfile in $target; do + # Does the source file exist? + if [ ! -f "$sfile" ]; then + echowarn "$sfile does not exist!" + return 1 + fi + + # If the destination is a directory, let's make it a full path so the logic + # below works as expected + if [ -d "$linkname" ]; then + echodebug "The passed link name ($linkname) is a directory" + linkname="${linkname}/$(basename "$sfile")" + echodebug "Full destination path is now: $linkname" + fi + + if [ ! -e "$linkname" ]; then + # The destination file does not exist, create link + echodebug "Creating $linkname symlink pointing to $sfile" + ln -s "$sfile" "$linkname" || return 1 + elif [ -e "$linkname" ] && [ "$overwrite" -eq $BS_TRUE ]; then + # The destination exist and we're overwriting + echodebug "Overwriting $linkname symlink to point on $sfile" + ln -sf "$sfile" "$linkname" || return 1 + elif [ -e "$linkname" ] && [ "$overwrite" -ne $BS_TRUE ]; then + echodebug "Not overwriting $linkname symlink to point on $sfile" + fi + done + + return 0 +} + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __rpm_import_gpg # DESCRIPTION: Download and import GPG public key to rpm database @@ -4380,57 +4431,59 @@ choose_openbsd_mirror() { install_openbsd_deps() { - choose_openbsd_mirror || return 1 - [ -z $OPENBSD_REPO ] && return 1 - echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" - echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 - pkg_add -I -v lsof || return 1 - pkg_add -I -v py-pip || return 1 - ln -sf $(ls -d /usr/local/bin/pip2.*) /usr/local/bin/pip || return 1 - ln -sf $(ls -d /usr/local/bin/pydoc2*) /usr/local/bin/pydoc || return 1 - ln -sf $(ls -d /usr/local/bin/python2.[0-9]) /usr/local/bin/python || return 1 - ln -sf $(ls -d /usr/local/bin/python2.[0-9]*to3) /usr/local/bin/2to3 || return 1 - ln -sf $(ls -d /usr/local/bin/python2.[0-9]*-config) /usr/local/bin/python-config || return 1 - pkg_add -I -v swig || return 1 - pkg_add -I -v py-zmq || return 1 - pkg_add -I -v py-requests || return 1 - pkg_add -I -v py-M2Crypto || return 1 - pkg_add -I -v py-raet || return 1 - pkg_add -I -v py-libnacl || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - /usr/local/bin/pip install --upgrade pip || return 1 - fi - # - # PIP based installs need to copy configuration files "by hand". - # Let's trigger config_salt() - # - if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - # Let's set the configuration directory to /tmp - _TEMP_CONFIG_DIR="/tmp" - CONFIG_SALT_FUNC="config_salt" - for fname in minion master syndic api; do - # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue - [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue - [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + choose_openbsd_mirror || return 1 + [ -n "$OPENBSD_REPO" ] || return 1 + echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" + echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 + pkg_add -I -v lsof || return 1 + pkg_add -I -v py-pip || return 1 + linkfile /usr/local/bin/pip2.* /usr/local/bin/pip $BS_TRUE || return 1 + linkfile /usr/local/bin/pydoc2* /usr/local/bin/pydoc $BS_TRUE || return 1 + linkfile /usr/local/bin/python2.[0-9] /usr/local/bin/python $BS_TRUE || return 1 + linkfile /usr/local/bin/python2.[0-9]*to3 /usr/local/bin/2to3 $BS_TRUE || return 1 + linkfile /usr/local/bin/python2.[0-9]*-config /usr/local/bin/python-config $BS_TRUE || return 1 + pkg_add -I -v swig || return 1 + pkg_add -I -v py-zmq || return 1 + pkg_add -I -v py-requests || return 1 + pkg_add -I -v py-M2Crypto || return 1 + pkg_add -I -v py-raet || return 1 + pkg_add -I -v py-libnacl || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + /usr/local/bin/pip install --upgrade pip || return 1 + fi + # + # PIP based installs need to copy configuration files "by hand". + # Let's trigger config_salt() + # + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + # Let's set the configuration directory to /tmp + _TEMP_CONFIG_DIR="/tmp" + CONFIG_SALT_FUNC="config_salt" + for fname in minion master syndic api; do + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || __check_command_exists "salt-${fname}") && \ + continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - # Let's download, since they were not provided, the default configuration files - if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then - ftp -o "$_TEMP_CONFIG_DIR/$fname" \ - "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 - fi - done - fi - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - /usr/local/bin/pip install --upgrade pip || return 1 - fi - if [ "${_EXTRA_PACKAGES}" != "" ]; then - echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - # shellcheck disable=SC2086 - pkg_add -I -v ${_EXTRA_PACKAGES} || return 1 - fi - return 0 + # Let's download, since they were not provided, the default configuration files + if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then + ftp -o "$_TEMP_CONFIG_DIR/$fname" \ + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + fi + done + fi + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + /usr/local/bin/pip install --upgrade pip || return 1 + fi + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + pkg_add -I -v ${_EXTRA_PACKAGES} || return 1 + fi + return 0 } install_openbsd_git_deps() { From 8d74e90a5564c5ece6dd14c399627cb577f2123f Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 17:12:20 +0200 Subject: [PATCH 080/156] Fix indentation --- bootstrap-salt.sh | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1ab078e..d508f5a 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4503,11 +4503,11 @@ install_openbsd_git_deps() { install_openbsd_stable() { # pkg_add -r -I -v salt || return 1 - check_pip_allowed - /usr/local/bin/pip install salt || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + check_pip_allowed || return 1 + /usr/local/bin/pip install salt || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then /usr/local/bin/pip install --upgrade salt || return 1 - fi + fi return 0 } @@ -4524,7 +4524,6 @@ install_openbsd_git() { install_openbsd_post() { - # # Install rc.d files. # @@ -4533,12 +4532,11 @@ install_openbsd_post() { ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 ## if grep -q '\-xf' /etc/rc.d/rc.subr; then - cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr - sed -i."$(date +%F)".saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr + cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr + sed -i."$(date +%F)".saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr fi _TEMP_CONFIG_DIR="/tmp" for fname in minion master syndic api; do - # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue @@ -4549,18 +4547,18 @@ install_openbsd_post() { if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" - if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then - copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 - echo salt_${fname}_enable="YES" >> /etc/rc.conf.local - echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local - fi + if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then + copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 + echo salt_${fname}_enable="YES" >> /etc/rc.conf.local + echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local + fi fi fi done } install_openbsd_check_services() { - salt --version + #salt --version # DEBUG? for fname in minion master syndic api; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4579,19 +4577,19 @@ install_openbsd_check_services() { install_openbsd_restart_daemons() { - [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do - # Skip salt-api since the service should be opt-in and not necessarily started on boot - [ $fname = "api" ] && continue - # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue - [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f /etc/rc.d/salt_${fname} ]; then + [ $_START_DAEMONS -eq $BS_FALSE ] && return + for fname in minion master syndic api; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + # Skip if not meant to be installed + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + if [ -f "/etc/rc.d/salt_${fname}" ]; then /etc/rc.d/salt_${fname} stop > /dev/null 2>&1 /etc/rc.d/salt_${fname} start - fi - done + fi + done } From c4457433cc370fc4120e1c0c68cf25d26764a296 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 17:17:09 +0200 Subject: [PATCH 081/156] Remove duplicate lines in `install_openbsd_deps` function --- bootstrap-salt.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d508f5a..f5092b0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4475,9 +4475,6 @@ install_openbsd_deps() { fi done fi - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - /usr/local/bin/pip install --upgrade pip || return 1 - fi if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 From 10628e0aa8d3a218e217d0d025c0313cba93639d Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 22:47:31 +0200 Subject: [PATCH 082/156] Fix lint warning `ShellCheck.SC2166` --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f5092b0..d37864f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2005,9 +2005,9 @@ install_ubuntu_deps() { install_ubuntu_stable_deps() { # This probably holds true for the Debians as well - if [ "$CPU_ARCH_L" = "amd64" -o "$CPU_ARCH_L" = "x86_64" ]; then + if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then repo_arch="amd64" - elif [ "$CPU_ARCH_L" = "i386" -o "$CPU_ARCH_L" = "i686" ]; then + elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Ubuntu (yet?)" repo_arch="i386" fi From cf85b21a7ec5d73a221bc88ece6cb1eb41ec64de Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 22:48:46 +0200 Subject: [PATCH 083/156] Fix lint warning `ShellCheck.SC2164` --- bootstrap-salt.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d37864f..e8151cd 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -523,6 +523,7 @@ __exit_cleanup() { if [ $_KEEP_TEMP_FILES -eq $BS_FALSE ]; then # Clean up the checked out repository echodebug "Cleaning up the Salt Temporary Git Repository" + # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" rm -rf "${__SALT_GIT_CHECKOUT_DIR}" else @@ -1270,9 +1271,11 @@ __git_clone_and_checkout() { __SALT_CHECKOUT_REPONAME="$(basename "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)" __SALT_CHECKOUT_REPONAME="${__SALT_CHECKOUT_REPONAME:-salt}" [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}" + # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" if [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then echodebug "Found a checked out Salt repository" + # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_DIR}" echodebug "Fetching git changes" git fetch || return 1 @@ -1325,6 +1328,7 @@ __git_clone_and_checkout() { echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" if [ $? -eq 0 ]; then + # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_DIR}" __SHALLOW_CLONE="${BS_TRUE}" else @@ -4875,6 +4879,7 @@ install_opensuse_git_deps() { __git_clone_and_checkout || return 1 if [ -f "${__SALT_GIT_CHECKOUT_DIR}/pkg/suse/use-forking-daemon.patch" ]; then + # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_DIR}" echowarn "Applying patch to systemd service unit file" patch -p1 < pkg/suse/use-forking-daemon.patch || return 1 From ccdd294dec22070d4809179c606bf5f7c86e99b9 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 28 Feb 2016 22:49:52 +0200 Subject: [PATCH 084/156] Rename linkfile() to __linkfile() (mark for internal use) --- bootstrap-salt.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e8151cd..33150bb 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1591,10 +1591,10 @@ movefile() { #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: linkfile +# NAME: __linkfile # DESCRIPTION: Simple function to create symlinks. Overrides if asked. Accepts globs. #---------------------------------------------------------------------------------------------------------------------- -linkfile() { +__linkfile() { overwrite=$_FORCE_OVERWRITE if [ $# -eq 2 ]; then target=$1 @@ -1604,8 +1604,8 @@ linkfile() { linkname=$2 overwrite=$3 else - echoerror "Wrong number of arguments for linkfile()" - echoinfo "USAGE: linkfile OR linkfile " + echoerror "Wrong number of arguments for __linkfile()" + echoinfo "USAGE: __linkfile OR __linkfile " exit 1 fi @@ -4441,11 +4441,11 @@ install_openbsd_deps() { echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 pkg_add -I -v lsof || return 1 pkg_add -I -v py-pip || return 1 - linkfile /usr/local/bin/pip2.* /usr/local/bin/pip $BS_TRUE || return 1 - linkfile /usr/local/bin/pydoc2* /usr/local/bin/pydoc $BS_TRUE || return 1 - linkfile /usr/local/bin/python2.[0-9] /usr/local/bin/python $BS_TRUE || return 1 - linkfile /usr/local/bin/python2.[0-9]*to3 /usr/local/bin/2to3 $BS_TRUE || return 1 - linkfile /usr/local/bin/python2.[0-9]*-config /usr/local/bin/python-config $BS_TRUE || return 1 + __linkfile /usr/local/bin/pip2.* /usr/local/bin/pip $BS_TRUE || return 1 + __linkfile /usr/local/bin/pydoc2* /usr/local/bin/pydoc $BS_TRUE || return 1 + __linkfile /usr/local/bin/python2.[0-9] /usr/local/bin/python $BS_TRUE || return 1 + __linkfile /usr/local/bin/python2.[0-9]*to3 /usr/local/bin/2to3 $BS_TRUE || return 1 + __linkfile /usr/local/bin/python2.[0-9]*-config /usr/local/bin/python-config $BS_TRUE || return 1 pkg_add -I -v swig || return 1 pkg_add -I -v py-zmq || return 1 pkg_add -I -v py-requests || return 1 @@ -4559,7 +4559,6 @@ install_openbsd_post() { } install_openbsd_check_services() { - #salt --version # DEBUG? for fname in minion master syndic api; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue From a7190224107e4bb86769761e9a177b3b3ff1bb4b Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 2 Mar 2016 11:50:54 +0200 Subject: [PATCH 085/156] Deprecate `config_freebsd_salt()` function, there is no purpose for it --- bootstrap-salt.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 33150bb..40c7d06 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4204,17 +4204,6 @@ install_freebsd_11_stable_deps() { install_freebsd_9_stable_deps } -config_freebsd_salt() { - # Set _SALT_ETC_DIR to ports default - _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - # We also need to redefine the PKI directory - _PKI_DIR=${_SALT_ETC_DIR}/pki - - config_salt || return 1 - - return 0 -} - install_freebsd_git_deps() { install_freebsd_9_stable_deps || return 1 @@ -4265,7 +4254,12 @@ install_freebsd_git_deps() { # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/" - CONFIG_SALT_FUNC="config_freebsd_salt" + CONFIG_SALT_FUNC="config_salt" + + # Set _SALT_ETC_DIR to ports default + _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} + # We also need to redefine the PKI directory + _PKI_DIR=${_SALT_ETC_DIR}/pki fi return 0 From 603464257758fd0db6f3a1a96246a23e0a1cdd09 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 2 Mar 2016 11:52:22 +0200 Subject: [PATCH 086/156] Rename `choose_openbsd_mirror()` to `__choose_openbsd_mirror()` (make internal) --- bootstrap-salt.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 40c7d06..803f98e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4398,7 +4398,7 @@ install_freebsd_restart_daemons() { # OpenBSD Install Functions # -choose_openbsd_mirror() { +__choose_openbsd_mirror() { MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html MIRROR_LIST_FILE=/tmp/openbsd-mirrors.html OPENBSD_REPO='' @@ -4429,7 +4429,7 @@ choose_openbsd_mirror() { install_openbsd_deps() { - choose_openbsd_mirror || return 1 + __choose_openbsd_mirror || return 1 [ -n "$OPENBSD_REPO" ] || return 1 echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 @@ -4457,6 +4457,7 @@ install_openbsd_deps() { # Let's set the configuration directory to /tmp _TEMP_CONFIG_DIR="/tmp" CONFIG_SALT_FUNC="config_salt" + for fname in minion master syndic api; do # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue From c69974cd347e670275136c387d7359401bfc1acc Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 3 Mar 2016 10:12:50 +0200 Subject: [PATCH 087/156] Make `__install_debian_stable` function "public" --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 803f98e..42ec15e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2698,7 +2698,7 @@ install_debian_8_git_deps() { return 0 } -__install_debian_stable() { +install_debian_stable() { __PACKAGES="" if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then __PACKAGES="${__PACKAGES} salt-minion" @@ -2716,17 +2716,17 @@ __install_debian_stable() { } install_debian_6_stable() { - __install_debian_stable || return 1 + install_debian_stable || return 1 return 0 } install_debian_7_stable() { - __install_debian_stable || return 1 + install_debian_stable || return 1 return 0 } install_debian_8_stable() { - __install_debian_stable || return 1 + install_debian_stable || return 1 return 0 } From 9210b87b8949c371bcce43a53ac751a91ed147b1 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 4 Mar 2016 10:32:46 +0200 Subject: [PATCH 088/156] Drop useless commented lines --- bootstrap-salt.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 42ec15e..6ed028e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3345,19 +3345,6 @@ install_centos_git_post() { /sbin/chkconfig salt-${fname} on fi - #if [ -f /sbin/initctl ]; then - # # We have upstart support - # /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 - # 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/ - # chmod +x /etc/init.d/salt-${fname} - # /sbin/chkconfig salt-${fname} on - #fi done if [ "$SYSTEMD_RELOAD" -eq $BS_TRUE ]; then From 7cb36114ea25d6236de01c7fadc8d490ea380772 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 4 Mar 2016 10:33:47 +0200 Subject: [PATCH 089/156] Make `copyfile()` and `movefile()` functions "private" --- bootstrap-salt.sh | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 6ed028e..d12668c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1486,10 +1486,10 @@ __check_end_of_life_versions #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: copyfile +# NAME: __copyfile # DESCRIPTION: Simple function to copy files. Overrides if asked. #---------------------------------------------------------------------------------------------------------------------- -copyfile() { +__copyfile() { overwrite=$_FORCE_OVERWRITE if [ $# -eq 2 ]; then sfile=$1 @@ -1499,8 +1499,8 @@ copyfile() { dfile=$2 overwrite=$3 else - echoerror "Wrong number of arguments for copyfile()" - echoinfo "USAGE: copyfile OR copyfile " + echoerror "Wrong number of arguments for __copyfile()" + echoinfo "USAGE: __copyfile OR __copyfile " exit 1 fi @@ -1534,10 +1534,10 @@ copyfile() { #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: movefile +# NAME: __movefile # DESCRIPTION: Simple function to move files. Overrides if asked. #---------------------------------------------------------------------------------------------------------------------- -movefile() { +__movefile() { overwrite=$_FORCE_OVERWRITE if [ $# -eq 2 ]; then sfile=$1 @@ -1547,8 +1547,8 @@ movefile() { dfile=$2 overwrite=$3 else - echoerror "Wrong number of arguments for movefile()" - echoinfo "USAGE: movefile OR movefile " + echoerror "Wrong number of arguments for __movefile()" + echoinfo "USAGE: __movefile OR __movefile " exit 1 fi @@ -1556,7 +1556,7 @@ movefile() { # We're being told not to move files, instead copy them so we can keep # them around echodebug "Since BS_KEEP_TEMP_FILES=1 we're copying files instead of moving them" - copyfile "$sfile" "$dfile" "$overwrite" + __copyfile "$sfile" "$dfile" "$overwrite" return $? fi @@ -2155,7 +2155,7 @@ install_ubuntu_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; 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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -2171,14 +2171,14 @@ 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" /sbin/initctl reload-configuration || return 1 fi # No upstart support in Ubuntu!? 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" + __copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2764,7 +2764,7 @@ install_debian_git_post() { if [ -f /bin/systemctl ]; then if [ ! -f /etc/systemd/system/salt-${fname}.service ] || ([ -f /etc/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system + __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system fi # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2775,7 +2775,7 @@ install_debian_git_post() { elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then 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" + __copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" "/etc/init.d/salt-$fname" else __fetch_url "/etc/init.d/salt-$fname" "http://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi @@ -2962,7 +2962,7 @@ install_fedora_git_post() { [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && 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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -3326,7 +3326,7 @@ install_centos_git_post() { if [ -f /bin/systemctl ]; then if [ ! -f /usr/lib/systemd/system/salt-${fname}.service ] || ([ -f /usr/lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system/ + __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system/ fi # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -3336,7 +3336,7 @@ install_centos_git_post() { SYSTEMD_RELOAD=$BS_TRUE 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} # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -3982,7 +3982,7 @@ install_arch_linux_post() { # Since a configuration directory was provided, it also means that any # configuration file copied was renamed by Arch, see: # https://wiki.archlinux.org/index.php/Pacnew_and_Pacsave_Files#.pacorig - copyfile "$_SALT_ETC_DIR/$fname.pacorig" "$_SALT_ETC_DIR/$fname" $BS_TRUE + __copyfile "$_SALT_ETC_DIR/$fname.pacorig" "$_SALT_ETC_DIR/$fname" $BS_TRUE fi # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -4013,7 +4013,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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4028,7 +4028,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 } @@ -4130,7 +4130,7 @@ __configure_freebsd_pkg_details() { echo " enabled: true" echo "}" } > $conf_file - copyfile $conf_file /etc/pkg/FreeBSD.conf + __copyfile $conf_file /etc/pkg/FreeBSD.conf fi FROM_FREEBSD="-r FreeBSD" @@ -4335,7 +4335,7 @@ install_freebsd_9_stable_post() { grep "$enable_string" /etc/rc.conf >/dev/null 2>&1 [ $? -eq 1 ] && echo "$enable_string" >> /etc/rc.conf - [ -f "${_SALT_ETC_DIR}/${fname}.sample" ] && copyfile "${_SALT_ETC_DIR}/${fname}.sample" "${_SALT_ETC_DIR}/${fname}" + [ -f "${_SALT_ETC_DIR}/${fname}.sample" ] && __copyfile "${_SALT_ETC_DIR}/${fname}.sample" "${_SALT_ETC_DIR}/${fname}" if [ $fname = "minion" ] ; then grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1 @@ -4531,7 +4531,7 @@ install_openbsd_post() { ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then - copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 + __copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 echo salt_${fname}_enable="YES" >> /etc/rc.conf.local echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local fi @@ -4690,7 +4690,7 @@ install_smartos_post() { mkdir -p "$smf_dir" || return 1 fi if [ ! -f "$smf_dir/salt-$fname.xml" ]; then - copyfile "$_TEMP_CONFIG_DIR/salt-$fname.xml" "$smf_dir/" || return 1 + __copyfile "$_TEMP_CONFIG_DIR/salt-$fname.xml" "$smf_dir/" || return 1 fi fi fi @@ -4716,7 +4716,7 @@ install_smartos_git_post() { 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 @@ -4940,14 +4940,14 @@ install_opensuse_git_post() { if [ -f /bin/systemctl ]; then if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || ([ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]); then - copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/usr/lib/systemd/system/salt-${fname}.service" + __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/usr/lib/systemd/system/salt-${fname}.service" else - 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" fi 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 @@ -5572,7 +5572,7 @@ config_salt() { # Copy the grains file if found if [ -f "$_TEMP_CONFIG_DIR/grains" ]; then echodebug "Moving provided grains file from $_TEMP_CONFIG_DIR/grains to $_SALT_ETC_DIR/grains" - movefile "$_TEMP_CONFIG_DIR/grains" "$_SALT_ETC_DIR/grains" || return 1 + __movefile "$_TEMP_CONFIG_DIR/grains" "$_SALT_ETC_DIR/grains" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -5588,24 +5588,24 @@ config_salt() { # Copy the minions configuration if found if [ -f "$_TEMP_CONFIG_DIR/minion" ]; then - movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$BS_TRUE" || return 1 + __movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$BS_TRUE" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi # Copy the minion's keys if found if [ -f "$_TEMP_CONFIG_DIR/minion.pem" ]; then - movefile "$_TEMP_CONFIG_DIR/minion.pem" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 + __movefile "$_TEMP_CONFIG_DIR/minion.pem" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 chmod 400 "$_PKI_DIR/minion/minion.pem" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi if [ -f "$_TEMP_CONFIG_DIR/minion.pub" ]; then - movefile "$_TEMP_CONFIG_DIR/minion.pub" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 + __movefile "$_TEMP_CONFIG_DIR/minion.pub" "$_PKI_DIR/minion/" "$BS_TRUE" || return 1 chmod 664 "$_PKI_DIR/minion/minion.pub" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi # For multi-master-pki, copy the master_sign public key if found if [ -f "$_TEMP_CONFIG_DIR/master_sign.pub" ]; then - movefile "$_TEMP_CONFIG_DIR/master_sign.pub" "$_PKI_DIR/minion/" || return 1 + __movefile "$_TEMP_CONFIG_DIR/master_sign.pub" "$_PKI_DIR/minion/" || return 1 chmod 664 "$_PKI_DIR/minion/master_sign.pub" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -5627,18 +5627,18 @@ config_salt() { # Copy the masters configuration if found if [ -f "$_TEMP_CONFIG_DIR/master" ]; then - movefile "$_TEMP_CONFIG_DIR/master" "$_SALT_ETC_DIR" || return 1 + __movefile "$_TEMP_CONFIG_DIR/master" "$_SALT_ETC_DIR" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi # Copy the master's keys if found if [ -f "$_TEMP_CONFIG_DIR/master.pem" ]; then - movefile "$_TEMP_CONFIG_DIR/master.pem" "$_PKI_DIR/master/" || return 1 + __movefile "$_TEMP_CONFIG_DIR/master.pem" "$_PKI_DIR/master/" || return 1 chmod 400 "$_PKI_DIR/master/master.pem" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi if [ -f "$_TEMP_CONFIG_DIR/master.pub" ]; then - movefile "$_TEMP_CONFIG_DIR/master.pub" "$_PKI_DIR/master/" || return 1 + __movefile "$_TEMP_CONFIG_DIR/master.pub" "$_PKI_DIR/master/" || return 1 chmod 664 "$_PKI_DIR/master/master.pub" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -5679,7 +5679,7 @@ preseed_master() { # If it's not a file, skip to the next [ ! -f "$src_keyfile" ] && continue - movefile "$src_keyfile" "$dst_keyfile" || return 1 + __movefile "$src_keyfile" "$dst_keyfile" || return 1 chmod 664 "$dst_keyfile" || return 1 done From f47afeb11743435ec87cd84eda37d0c909899088 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 5 Mar 2016 12:09:41 +0200 Subject: [PATCH 090/156] Remove duplicate `QUIT` signal in trap statement --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d12668c..35116ef 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -551,7 +551,7 @@ __exit_cleanup() { # Exit with the "original" exit code, not the trapped code exit $EXIT_CODE } - trap "__trap_errors" INT QUIT ABRT QUIT TERM + trap "__trap_errors" INT ABRT QUIT TERM # Now we're "good" to kill tee kill -s TERM "$TEE_PID" From 5ac89373305d587905c08ff9c72202c5d894210b Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 6 Mar 2016 11:50:44 +0200 Subject: [PATCH 091/156] Make `check_pip_allowed()` a "private" function --- bootstrap-salt.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 35116ef..53a6465 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -115,11 +115,11 @@ __check_command_exists() { } #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: check_pip_allowed +# NAME: __check_pip_allowed # DESCRIPTION: Simple function to let the users know that -P needs to be # used. #---------------------------------------------------------------------------------------------------------------------- -check_pip_allowed() { +__check_pip_allowed() { if [ $# -eq 1 ]; then _PIP_ALLOWED_ERROR_MSG=$1 else @@ -1977,7 +1977,7 @@ install_ubuntu_deps() { if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" if ! __check_command_exists pip; then __PACKAGES="${__PACKAGES} python-setuptools python-pip" fi @@ -2096,7 +2096,7 @@ install_ubuntu_git_deps() { __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __PACKAGES="${__PACKAGES} python-dev" - check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" if ! __check_command_exists pip; then __PACKAGES="${__PACKAGES} python-setuptools python-pip" fi @@ -2293,7 +2293,7 @@ install_debian_deps() { if [ "$DISTRO_MAJOR_VERSION" -lt 6 ]; then # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 6 # need to be installed using pip - check_pip_allowed "You need to allow pip based installations (-P) in order to install the python 'requests' package" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python 'requests' package" __PACKAGES="${__PACKAGES} python-pip" # shellcheck disable=SC2089 __PIP_PACKAGES="${__PIP_PACKAGES} 'requests>=$_PY_REQUESTS_MIN_VERSION'" @@ -2407,7 +2407,7 @@ _eof __apt_get_install_noinput python-apt if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud/requests" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud/requests" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -2484,7 +2484,7 @@ install_debian_7_deps() { __PACKAGES="build-essential python-dev python-pip" # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" || return 1 fi @@ -2584,7 +2584,7 @@ install_debian_git_deps() { # We're on the develop branch, install whichever tornado is on the requirements file __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" __apt_get_install_noinput python-dev pip install -U "${__REQUIRED_TORNADO}" || return 1 fi @@ -2597,7 +2597,7 @@ install_debian_git_deps() { fi if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -3158,13 +3158,13 @@ install_centos_stable_deps() { __PACKAGES="${__PACKAGES} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests" __PACKAGES="${__PACKAGES} python26-crypto python26-msgpack python26-zmq python26-jinja2" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __PACKAGES="${__PACKAGES} python26-setuptools" fi else __PACKAGES="${__PACKAGES} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2 python-requests" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __PACKAGES="${__PACKAGES} python-pip" fi fi @@ -3181,7 +3181,7 @@ install_centos_stable_deps() { fi if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then easy_install-2.6 "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" else @@ -3800,7 +3800,7 @@ _eof __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __PACKAGES="${__PACKAGES} python-pip" fi @@ -3808,7 +3808,7 @@ _eof yum -y install ${__PACKAGES} --enablerepo=${_EPEL_REPO}"" || return 1 if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -4486,7 +4486,7 @@ install_openbsd_git_deps() { install_openbsd_stable() { # pkg_add -r -I -v salt || return 1 - check_pip_allowed || return 1 + __check_pip_allowed || return 1 /usr/local/bin/pip install salt || return 1 if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then /usr/local/bin/pip install --upgrade salt || return 1 @@ -4635,7 +4635,7 @@ install_smartos_git_deps() { if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" - check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" if [ "${__REQUIRED_TORNADO}" != "" ]; then if ! __check_command_exists pip; then pkgin -y install py27-pip @@ -5043,7 +5043,7 @@ install_suse_12_stable_deps() { __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests" if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then - check_pip_allowed + __check_pip_allowed echowarn "PyYaml will be installed using pip" else __PACKAGES="${__PACKAGES} python-PyYAML" @@ -5229,7 +5229,7 @@ install_suse_11_stable_deps() { __PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests" if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then - check_pip_allowed + __check_pip_allowed echowarn "PyYaml will be installed using pip" else __PACKAGES="${__PACKAGES} python-PyYAML" @@ -5451,7 +5451,7 @@ __gentoo_post_dep() { __gentoo_config_protection if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __emerge -v 'dev-python/pip' pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi From 448c66b4bef4c54647d180bb1a46d5e85242c0d1 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 7 Mar 2016 11:38:28 +0200 Subject: [PATCH 092/156] Align global variable names --- bootstrap-salt.sh | 169 +++++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 85 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 53a6465..8a3870e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -40,7 +40,6 @@ __ScriptName="bootstrap-salt.sh" # LET THE BLACK MAGIC BEGIN!!!! #====================================================================================================================== - # Bootstrap script truth values BS_TRUE=1 BS_FALSE=0 @@ -204,7 +203,7 @@ _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} +_EPEL_REPOS_INSTALLED=$BS_FALSE _UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE} _INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE} _WGET_ARGS=${BS_WGET_ARGS:-} @@ -213,14 +212,14 @@ _FETCH_ARGS=${BS_FETCH_ARGS:-} _ENABLE_EXTERNAL_ZMQ_REPOS=${BS_ENABLE_EXTERNAL_ZMQ_REPOS:-$BS_FALSE} _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 +# _SIMPLIFY_VERSION is mostly used in Solaris based distributions +_SIMPLIFY_VERSION=$BS_TRUE _LIBCLOUD_MIN_VERSION="0.14.0" _PY_REQUESTS_MIN_VERSION="2.0" _EXTRA_PACKAGES="" _HTTP_PROXY="" _DISABLE_SALT_CHECKS=$BS_FALSE -__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} +_SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} _NO_DEPS=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE @@ -519,13 +518,13 @@ echowarn "Running the unstable version of ${__ScriptName}" __exit_cleanup() { EXIT_CODE=$? - if [ "$ITYPE" = "git" ] && [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then + if [ "$ITYPE" = "git" ] && [ -d "${_SALT_GIT_CHECKOUT_DIR}" ]; then if [ $_KEEP_TEMP_FILES -eq $BS_FALSE ]; then # Clean up the checked out repository echodebug "Cleaning up the Salt Temporary Git Repository" # shellcheck disable=SC2164 cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" - rm -rf "${__SALT_GIT_CHECKOUT_DIR}" + 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" @@ -948,7 +947,7 @@ __gather_sunos_system_info() { *OmniOS*) DISTRO_NAME="OmniOS" DISTRO_VERSION=$(echo "$line" | awk '{print $3}') - __SIMPLIFY_VERSION=$BS_FALSE + _SIMPLIFY_VERSION=$BS_FALSE break ;; esac @@ -1201,7 +1200,7 @@ __ubuntu_derivatives_translation __debian_derivatives_translation # Simplify version naming on functions -if [ "${DISTRO_VERSION}" = "" ] || [ $__SIMPLIFY_VERSION -eq $BS_FALSE ]; then +if [ "$DISTRO_VERSION" = "" ] || [ ${_SIMPLIFY_VERSION} -eq $BS_FALSE ]; then DISTRO_MAJOR_VERSION="" DISTRO_MINOR_VERSION="" PREFIXED_DISTRO_MAJOR_VERSION="" @@ -1266,17 +1265,17 @@ __git_clone_and_checkout() { echodebug "Installed git version: $(git --version | awk '{ print $3 }')" - __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null) + __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null) __SALT_GIT_CHECKOUT_PARENT_DIR="${__SALT_GIT_CHECKOUT_PARENT_DIR:-/tmp/git}" - __SALT_CHECKOUT_REPONAME="$(basename "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)" + __SALT_CHECKOUT_REPONAME="$(basename "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)" __SALT_CHECKOUT_REPONAME="${__SALT_CHECKOUT_REPONAME:-salt}" [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}" # shellcheck disable=SC2164 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" # shellcheck disable=SC2164 - 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 @@ -1329,7 +1328,7 @@ __git_clone_and_checkout() { git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" if [ $? -eq 0 ]; then # shellcheck disable=SC2164 - cd "${__SALT_GIT_CHECKOUT_DIR}" + cd "${_SALT_GIT_CHECKOUT_DIR}" __SHALLOW_CLONE="${BS_TRUE}" else # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. @@ -1345,7 +1344,7 @@ __git_clone_and_checkout() { if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 - cd "${__SALT_GIT_CHECKOUT_DIR}" + cd "${_SALT_GIT_CHECKOUT_DIR}" if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; then # We need to add the saltstack repository as a remote and fetch tags for proper versioning @@ -2091,9 +2090,9 @@ install_ubuntu_git_deps() { __git_clone_and_checkout || return 1 __PACKAGES="" - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __PACKAGES="${__PACKAGES} python-dev" __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" @@ -2108,7 +2107,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 @@ -2137,7 +2136,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 --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 @@ -2155,7 +2154,7 @@ install_ubuntu_git_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; 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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -2170,15 +2169,15 @@ 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" /sbin/initctl reload-configuration || return 1 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 # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2580,9 +2579,9 @@ install_debian_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" __apt_get_install_noinput python-dev @@ -2592,7 +2591,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 @@ -2633,7 +2632,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 @@ -2671,9 +2670,9 @@ install_debian_8_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install tornado - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __apt_get_install_noinput python-tornado fi @@ -2681,7 +2680,7 @@ install_debian_8_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 @@ -2731,7 +2730,7 @@ install_debian_8_stable() { } install_debian_git() { - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py --salt-config-dir="$_SALT_ETC_DIR" install --install-layout=deb || return 1 else python setup.py install --install-layout=deb || return 1 @@ -2764,7 +2763,7 @@ install_debian_git_post() { if [ -f /bin/systemctl ]; then if [ ! -f /etc/systemd/system/salt-${fname}.service ] || ([ -f /etc/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system fi # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2774,8 +2773,8 @@ install_debian_git_post() { SYSTEMD_RELOAD=$BS_TRUE elif [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - 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" else __fetch_url "/etc/init.d/salt-$fname" "http://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi @@ -2927,9 +2926,9 @@ install_fedora_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then $FEDORA_PACKAGE_MANAGER install -y python-tornado fi @@ -2937,7 +2936,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 @@ -2945,7 +2944,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 --salt-config-dir="$_SALT_ETC_DIR" install || return 1 else python setup.py install || return 1 @@ -2962,7 +2961,7 @@ install_fedora_git_post() { [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && 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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -3015,21 +3014,21 @@ install_fedora_check_services() { # CentOS Install Functions # __install_epel_repository() { - if [ ${__EPEL_REPOS_INSTALLED} -eq $BS_TRUE ]; then + if [ ${_EPEL_REPOS_INSTALLED} -eq $BS_TRUE ]; then return 0 fi # Check if epel repo is already enabled and flag it accordingly yum repolist | grep -q "^[!]${_EPEL_REPO}/" if [ $? -eq 0 ]; then - __EPEL_REPOS_INSTALLED=${BS_TRUE} + _EPEL_REPOS_INSTALLED=$BS_TRUE return 0 fi # Check if epel-release is already installed and flag it accordingly rpm --nodigest --nosignature -q epel-release > /dev/null 2>&1 if [ $? -eq 0 ]; then - __EPEL_REPOS_INSTALLED=${BS_TRUE} + _EPEL_REPOS_INSTALLED=$BS_TRUE return 0 fi @@ -3053,7 +3052,7 @@ __install_epel_repository() { echoerror "Failed add EPEL repository support." return 1 fi - __EPEL_REPOS_INSTALLED=${BS_TRUE} + _EPEL_REPOS_INSTALLED=$BS_TRUE return 0 } @@ -3136,9 +3135,9 @@ install_centos_stable_deps() { __install_epel_repository || return 1 __install_saltstack_rhel_repository || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then yum install -y python26-tornado @@ -3279,9 +3278,9 @@ install_centos_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then yum install -y python26-tornado @@ -3293,7 +3292,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 @@ -3306,7 +3305,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 --salt-config-dir="$_SALT_ETC_DIR" install --prefix=/usr || return 1 else $_PYEXE setup.py install --prefix=/usr || return 1 @@ -3326,7 +3325,7 @@ install_centos_git_post() { if [ -f /bin/systemctl ]; then if [ ! -f /usr/lib/systemd/system/salt-${fname}.service ] || ([ -f /usr/lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system/ + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system/ fi # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -3336,7 +3335,7 @@ install_centos_git_post() { SYSTEMD_RELOAD=$BS_TRUE 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} # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -3828,9 +3827,9 @@ install_amazon_linux_ami_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then yum install -y python-tornado fi @@ -3839,7 +3838,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 @@ -3929,9 +3928,9 @@ install_arch_linux_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then pacman -Sy --noconfirm --needed python2-tornado fi @@ -3940,7 +3939,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 @@ -3960,7 +3959,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 --salt-config-dir="$_SALT_ETC_DIR" install || return 1 else python2 setup.py install || return 1 @@ -4013,7 +4012,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" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4028,7 +4027,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 } @@ -4202,9 +4201,9 @@ install_freebsd_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then /usr/local/sbin/pkg install -y www/py-tornado || return 1 fi @@ -4240,7 +4239,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" # Set _SALT_ETC_DIR to ports default @@ -4477,7 +4476,7 @@ install_openbsd_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 return 0 @@ -4632,9 +4631,9 @@ install_smartos_git_deps() { pkgin -y install git || return 1 fi - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" if [ "${__REQUIRED_TORNADO}" != "" ]; then if ! __check_command_exists pip; then @@ -4647,7 +4646,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 @@ -4710,13 +4709,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 @@ -4859,16 +4858,16 @@ install_opensuse_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/pkg/suse/use-forking-daemon.patch" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/suse/use-forking-daemon.patch" ]; then # shellcheck disable=SC2164 - cd "${__SALT_GIT_CHECKOUT_DIR}" + cd "${_SALT_GIT_CHECKOUT_DIR}" echowarn "Applying patch to systemd service unit file" patch -p1 < pkg/suse/use-forking-daemon.patch || return 1 fi - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __zypper_install python-tornado fi @@ -4877,7 +4876,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 @@ -4940,14 +4939,14 @@ install_opensuse_git_post() { if [ -f /bin/systemctl ]; then if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || ([ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]); then - __copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/usr/lib/systemd/system/salt-${fname}.service" + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/usr/lib/systemd/system/salt-${fname}.service" else - __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" fi 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 @@ -5112,9 +5111,9 @@ install_suse_12_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __zypper_install python-tornado fi @@ -5122,7 +5121,7 @@ install_suse_12_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 @@ -5298,9 +5297,9 @@ install_suse_11_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then __zypper_install python-tornado fi @@ -5308,7 +5307,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 5078c517239f6cb1816a59c24148daf6297c1fc6 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 8 Mar 2016 13:28:42 +0200 Subject: [PATCH 093/156] Small correction to usage instructions --- bootstrap-salt.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8a3870e..4706650 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -127,7 +127,7 @@ __check_pip_allowed() { if [ "$_PIP_ALLOWED" -eq $BS_FALSE ]; then echoerror "$_PIP_ALLOWED_ERROR_MSG" - usage + __usage exit 1 fi } @@ -225,19 +225,19 @@ _FORCE_SHALLOW_CLONE=$BS_FALSE #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: usage +# NAME: __usage # DESCRIPTION: Display usage information. #---------------------------------------------------------------------------------------------------------------------- -usage() { +__usage() { cat << EOT - Usage : ${__ScriptName} [options] + Usage : ${__ScriptName} [options] [install-type-args] Installation types: - - stable (this is default) + - stable (install latest stable release, this is default) - stable [version] (currently only supported on: Ubuntu, CentOS) - - daily (Ubuntu specific) - - testing (RHEL-family specific, configure EPEL testing repo) + - daily (Ubuntu specific: configure SaltStack Daily PPA) + - testing (RHEL-family specific: configure EPEL testing repo) - git [branch_or_tag] (install from 'develop' by default) Examples: @@ -305,14 +305,14 @@ usage() { This may result in an "n/a" in the version number. EOT -} # ---------- end of function usage ---------- +} # ---------- end of function __usage ---------- while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbsf" opt do case "${opt}" in - h ) usage; exit 0 ;; + h ) __usage; exit 0 ;; v ) echo "$0 -- Version $__ScriptVersion"; exit 0 ;; n ) _COLORS=0; __detect_color_support ;; @@ -367,7 +367,7 @@ do \?) echo echoerror "Option does not exist : $OPTARG" - usage + __usage exit 1 ;; @@ -386,7 +386,7 @@ __check_unparsed_options() { fi unparsed_options=$( echo "$shellopts" | ${grep} -E '(^|[[:space:]])[-]+[[:alnum:]]' ) if [ "$unparsed_options" != "" ]; then - usage + __usage echo echoerror "options are only allowed before install arguments" echo @@ -457,7 +457,7 @@ fi # Check for any unparsed arguments. Should be an error. if [ "$#" -gt 0 ]; then __check_unparsed_options "$*" - usage + __usage echo echoerror "Too many arguments." exit 1 From 5696216b54fcd52c2c5ce5cce9c2dbdf14184927 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 9 Mar 2016 12:23:01 +0200 Subject: [PATCH 094/156] Make sleep time variable and constant more clear --- bootstrap-salt.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4706650..8a20f50 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -17,6 +17,7 @@ # CREATED: 10/15/2012 09:49:37 PM WEST #====================================================================================================================== set -o nounset # Treat unset variables as an error + __ScriptVersion="2015.11.09" __ScriptName="bootstrap-salt.sh" @@ -46,7 +47,6 @@ BS_FALSE=0 # Default sleep time used when waiting for daemons to start, restart and checking for these running __DEFAULT_SLEEP=3 -__DEFAULT_SLEEP_ORIGINAL="${__DEFAULT_SLEEP}" #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __detect_color_support @@ -190,6 +190,7 @@ _TEMP_CONFIG_DIR="null" _SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git" _SALT_REPO_URL=${_SALTSTACK_REPO_URL} _TEMP_KEYS_DIR="null" +_SLEEP="${__DEFAULT_SLEEP}" _INSTALL_MASTER=$BS_FALSE _INSTALL_SYNDIC=$BS_FALSE _INSTALL_MINION=$BS_TRUE @@ -343,7 +344,7 @@ do exit 1 fi ;; - s ) __DEFAULT_SLEEP="$OPTARG" ;; + s ) _SLEEP="$OPTARG" ;; M ) _INSTALL_MASTER=$BS_TRUE ;; S ) _INSTALL_SYNDIC=$BS_TRUE ;; N ) _INSTALL_MINION=$BS_FALSE ;; @@ -1908,11 +1909,11 @@ __enable_universe_repository() { } install_ubuntu_deps() { - if ([ "${__DEFAULT_SLEEP}" -eq "${__DEFAULT_SLEEP_ORIGINAL}" ] && [ "$DISTRO_MAJOR_VERSION" -lt 15 ]); then + if ([ "${_SLEEP}" -eq "${__DEFAULT_SLEEP}" ] && [ "$DISTRO_MAJOR_VERSION" -lt 15 ]); then # The user did not pass a custom sleep value as an argument, let's increase the default value echodebug "On Ubuntu systems we increase the default sleep value to 10." echodebug "See https://github.com/saltstack/salt/issues/12248 for more info." - __DEFAULT_SLEEP=10 + _SLEEP=10 fi if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." @@ -5988,8 +5989,8 @@ fi # Run any start daemons function if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then echoinfo "Running ${STARTDAEMONS_INSTALL_FUNC}()" - echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them" - sleep ${__DEFAULT_SLEEP} + echodebug "Waiting ${_SLEEP} seconds for processes to settle before checking for them" + sleep ${_SLEEP} $STARTDAEMONS_INSTALL_FUNC if [ $? -ne 0 ]; then echoerror "Failed to run ${STARTDAEMONS_INSTALL_FUNC}()!!!" @@ -6000,8 +6001,8 @@ fi # Check if the installed daemons are running or not if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; then echoinfo "Running ${DAEMONS_RUNNING_FUNC}()" - echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them" - sleep ${__DEFAULT_SLEEP} # Sleep a little bit to let daemons start + echodebug "Waiting ${_SLEEP} seconds for processes to settle before checking for them" + sleep ${_SLEEP} # Sleep a little bit to let daemons start $DAEMONS_RUNNING_FUNC if [ $? -ne 0 ]; then echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!" From 1987444c412e80d4849e243935094747c795710b Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 9 Mar 2016 12:27:10 +0200 Subject: [PATCH 095/156] Small indentation fixes --- bootstrap-salt.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8a20f50..bb88e47 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -313,11 +313,11 @@ while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbsf" opt do case "${opt}" in - h ) __usage; exit 0 ;; - + h ) __usage; exit 0 ;; v ) echo "$0 -- Version $__ScriptVersion"; exit 0 ;; n ) _COLORS=0; __detect_color_support ;; D ) _ECHO_DEBUG=$BS_TRUE ;; + c ) _TEMP_CONFIG_DIR=$(__check_config_dir "$OPTARG") # If the configuration directory does not exist, error out if [ "$_TEMP_CONFIG_DIR" = "null" ]; then @@ -329,14 +329,17 @@ do exit 1 fi ;; - g ) _SALT_REPO_URL=$OPTARG ;; - G ) if [ "${_SALT_REPO_URL}" = "${_SALTSTACK_REPO_URL}" ]; then - _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" - _SALT_REPO_URL=${_SALTSTACK_REPO_URL} - else - _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" - fi + + g ) _SALT_REPO_URL=$OPTARG ;; + + G ) if [ "${_SALT_REPO_URL}" = "${_SALTSTACK_REPO_URL}" ]; then + _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" + _SALT_REPO_URL=${_SALTSTACK_REPO_URL} + else + _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" + fi ;; + k ) _TEMP_KEYS_DIR="$OPTARG" # If the configuration directory does not exist, error out if [ ! -d "$_TEMP_KEYS_DIR" ]; then @@ -344,6 +347,7 @@ do exit 1 fi ;; + s ) _SLEEP="$OPTARG" ;; M ) _INSTALL_MASTER=$BS_TRUE ;; S ) _INSTALL_SYNDIC=$BS_TRUE ;; @@ -365,7 +369,6 @@ do b ) _NO_DEPS=$BS_TRUE ;; f ) _FORCE_SHALLOW_CLONE=$BS_TRUE ;; - \?) echo echoerror "Option does not exist : $OPTARG" __usage From 15fef41308a827458d0e89057920ad769f1570fb Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 9 Mar 2016 12:30:54 +0200 Subject: [PATCH 096/156] Bump version (`develop` branch went far ahead) --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index bb88e47..f8622f6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2015.11.09" +__ScriptVersion="2016.03.09" __ScriptName="bootstrap-salt.sh" #====================================================================================================================== From a41d9078efa5c04645fe30e1f702602d512e70e3 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 10 Mar 2016 10:53:52 +0200 Subject: [PATCH 097/156] Fix sleep time option to recognize a numeric argument --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f8622f6..d580d17 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.03.09" +__ScriptVersion="2016.03.10" __ScriptName="bootstrap-salt.sh" #====================================================================================================================== @@ -309,7 +309,7 @@ EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:k:MSNXCPFUKIA:i:Lp:dH:Zbsf" opt +while getopts ":hvnDc:Gg:k:s:MSNXCPFUKIA:i:Lp:dH:Zbf" opt do case "${opt}" in @@ -348,7 +348,7 @@ do fi ;; - s ) _SLEEP="$OPTARG" ;; + s ) _SLEEP=$OPTARG ;; M ) _INSTALL_MASTER=$BS_TRUE ;; S ) _INSTALL_SYNDIC=$BS_TRUE ;; N ) _INSTALL_MINION=$BS_FALSE ;; From 1b9ea4f00fd62f256735270cc0ad08da29c05013 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 10 Mar 2016 11:01:22 +0200 Subject: [PATCH 098/156] Ignore lint warning `SC2164` --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d580d17..7a267f8 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1348,6 +1348,7 @@ __git_clone_and_checkout() { if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 + # shellcheck disable=SC2164 cd "${_SALT_GIT_CHECKOUT_DIR}" if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; then From 98d20fce3a05594b3477e72f00a0ca252a6b8011 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 12 Mar 2016 17:36:20 +0200 Subject: [PATCH 099/156] Correct and reformat README file --- README.rst | 168 ++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 85 deletions(-) diff --git a/README.rst b/README.rst index 82f197a..68798d9 100644 --- a/README.rst +++ b/README.rst @@ -2,36 +2,32 @@ Bootstrapping Salt ================== -Before `Salt`_ can be used for provisioning on the desired machine, the binaries need to be -installed. Since `Salt`_ supports many different distributions and versions of operating systems, -the `Salt`_ installation process is handled by this shell script ``bootstrap-salt.sh``. This -script runs through a series of checks to determine operating system type and version to then +Before `Salt`_ can be used for provisioning on the desired machine, the binaries need to be +installed. Since `Salt`_ supports many different distributions and versions of operating systems, +the `Salt`_ installation process is handled by this shell script ``bootstrap-salt.sh``. This +script runs through a series of checks to determine operating system type and version to then install the `Salt`_ binaries using the appropriate methods. - .. note:: - This ``README`` file is not the absolute truth to what the bootstrap script is capable of, for - that, please read the generated help by passing ``-h`` to the script or even better, `read the + This ``README`` file is not the absolute truth to what the bootstrap script is capable of, for + that, please read the generated help by passing ``-h`` to the script or even better, `read the source`_. +**In case you found a bug, please read** `I found a bug`_ **first before submitting a new issue.** .. _`read the source`: https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh -**In case you found a bug, please read** `I found a bug`_ **first before submitting a new issue.** - - - Bootstrap ---------- +========= If you're looking for the *one-liner* to install salt, please scroll to the bottom and use the instructions for `Installing via an Insecure One-Liner`_. Examples -~~~~~~~~ +-------- .. note:: @@ -39,6 +35,9 @@ Examples it to ensure that it does what you expect. +Install using curl +~~~~~~~~~~~~~~~~~~ + Using ``curl`` to install latest git: .. code:: console @@ -46,6 +45,30 @@ Using ``curl`` to install latest git: curl -L https://bootstrap.saltstack.com -o install_salt.sh sudo sh install_salt.sh git develop +If you want to install a specific release version (based on the git tags): + +.. code:: console + + curl -o install_salt.sh -L https://bootstrap.saltstack.com + sudo sh install_salt.sh git v2015.8.7 + +To install a specific branch from a git fork: + +.. code:: console + + curl -o install_salt.sh -L https://bootstrap.saltstack.com + sudo sh install_salt.sh -g https://github.com/myuser/salt.git git mybranch + +If all you want is to install a ``salt-master`` using latest git: + +.. code:: console + + curl -o install_salt.sh -L https://bootstrap.saltstack.com + sudo sh install_salt.sh -M -N git develop + + +Install using wget +~~~~~~~~~~~~~~~~~~ Using ``wget`` to install your distribution's stable packages: @@ -54,27 +77,30 @@ Using ``wget`` to install your distribution's stable packages: wget -O install_salt.sh https://bootstrap.saltstack.com sudo sh install_salt.sh - Install a specific version from git using ``wget``: .. code:: console wget -O install_salt.sh https://bootstrap.saltstack.com - sudo sh install_salt.sh -P git v0.16.4 + sudo sh install_salt.sh -P git v2015.8.7 -On the above example we added `-P` which will allow PIP packages to be installed if required but -it's no a necessary flag for git based bootstraps. +.. note:: + + On the above example we added `-P` which will allow PIP packages to be installed if required but + it's no a necessary flag for git based bootstraps. -If you already have python installed, ``python 2.6``, then it's as easy as: +Install using Python +~~~~~~~~~~~~~~~~~~~~ + +If you already have Python installed, ``python 2.6``, then it's as easy as: .. code:: console python -m urllib "https://bootstrap.saltstack.com" > install_salt.sh sudo sh install_salt.sh git develop - -All python versions should support the following one liner: +All Python versions should support the following one liner: .. code:: console @@ -82,7 +108,10 @@ All python versions should support the following one liner: sudo sh install_salt.sh git develop -On a FreeBSD base system you usually don't have either of the above binaries available. You **do** +Install using fetch +~~~~~~~~~~~~~~~~~~~ + +On a FreeBSD base system you usually don't have either of the above binaries available. You **do** have ``fetch`` available though: .. code:: console @@ -109,34 +138,6 @@ Or link them to the right place: ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem -If all you want is to install a ``salt-master`` using latest git: - -.. code:: console - - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh -M -N git develop - - -If you want to install a specific release version (based on the git tags): - -.. code:: console - - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh git v0.16.4 - - -To install a specific branch from a git fork: - -.. code:: console - - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh -g https://github.com/myuser/salt.git git mybranch - - -Any of the example above which use two-lines can be made to run in a single-line -configuration with minor modifications, see `Installing via an Insecure One-Liner`_. - - Installing via an Insecure One-Liner ------------------------------------ @@ -147,10 +148,6 @@ The following examples illustrate how to install Salt via a one-liner. Warning! These methods do not involve a verification step and assume that the delivered file is trustworthy. - -Examples -~~~~~~~~ - Installing the latest stable release of Salt (default): .. code:: console @@ -170,8 +167,21 @@ Installing the latest develop branch of Salt: curl -L https://bootstrap.saltstack.com | sudo sh -s -- git develop -Adding support for other operating systems +Unsupported Distro +------------------ + +You found a Linux distribution which we still do not support or we do not correctly identify? +Please run the following commands and report their output when creating a ticket: + +.. code:: console + + sudo find /etc/ -name \*-release -print -exec cat {} \; + command lsb_release -a + + +Adding Support for Other Operating Systems ------------------------------------------ + In order to install salt for a distribution you need to define: 1. To Install Dependencies, which is required, one of: @@ -186,7 +196,7 @@ In order to install salt for a distribution you need to define: install__deps -2. Optionally, define a minion configuration function, which will be called if the +2. Optionally, define a minion configuration function, which will be called if the ``-c|config-dir`` option is passed. One of: .. code:: bash @@ -200,7 +210,7 @@ In order to install salt for a distribution you need to define: config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT] -3. Optionally, define a salt master pre-seed function, which will be called if the -k (pre-seed +3. Optionally, define a salt master pre-seed function, which will be called if the -k (pre-seed master keys) option is passed. One of: .. code:: bash @@ -249,7 +259,7 @@ In order to install salt for a distribution you need to define: .. admonition:: Attention! - The start daemons function should be able to restart any daemons which are running, or start if + The start daemons function should be able to restart any daemons which are running, or start if they're not running. @@ -280,7 +290,7 @@ In order to install salt for a distribution you need to define: ---- -Below is an example for Ubuntu Oneiric(the example may not be up to date with the script): +Below is an example for Ubuntu Oneiric (the example may not be up to date with the script): .. code:: bash @@ -328,8 +338,8 @@ Below is an example for Ubuntu Oneiric(the example may not be up to date with th Since there is no ``install_ubuntu_11_10_stable()`` it defaults to the unspecified version script. -The bootstrapping script must be plain POSIX sh only, **not** bash or another shell script. By -design the targeting for each operating system and version is very specific. Assumptions of +The bootstrapping script must be plain POSIX sh only, **not** bash or another shell script. By +design the targeting for each operating system and version is very specific. Assumptions of supported versions or variants should not be made, to avoid failed or broken installations. Supported Operating Systems @@ -344,10 +354,9 @@ Supported Operating Systems - Linaro - Linux Mint 13/14 - OpenSUSE 12/13 -- Oracle Linux 5/5 -- Red Hat 5/6 -- Red Hat Enterprise 5/6 -- Scientific Linux 5/6 +- Oracle Linux 5/6/7 +- Red Hat Enterprise Linux 5/6/7 +- Scientific Linux 5/6/7 - SmartOS - SUSE Linux Enterprise 11 SP1/11 SP2/11 SP3 - Ubuntu 10.x/11.x/12.x/13.x/14.x/15.04 @@ -355,11 +364,11 @@ Supported Operating Systems -I found a bug -------------- +I Found a Bug +============= -If you found a possible problem, or bug, please try to bootstrap using the develop version. The -issue you are having might have already been fixed and it's just not yet included in the stable +If you found a possible problem, or bug, please try to bootstrap using the develop version. The +issue you are having might have already been fixed and it's just not yet included in the stable version. .. code:: console @@ -378,34 +387,23 @@ Or the insecure one liner: If after trying this, you still see the same problems, then, please `file an issue`_. - .. _`Salt`: http://saltstack.org/ .. _`file an issue`: https://github.com/saltstack/salt-bootstrap/issues/new -Unsupported Distro ------------------- - -You found a Linux distribution which we still do not support or we do not correctly identify? -Please run the following commands and report their output when creating a ticket: - -.. code:: console - - sudo find /etc/ -name '*-release' -print -exec cat {} \; - command lsb_release -a - - Testing in Vagrant ------------------- -You can use Vagrant_ to easily test changes on a clean machine. The ``Vagrantfile`` defaults to an +================== + +You can use Vagrant_ to easily test changes on a clean machine. The ``Vagrantfile`` defaults to an Ubuntu box. First, install Vagrant, then: .. code:: console - $ vagrant up - $ vagrant ssh + vagrant up + vagrant ssh .. _Vagrant: http://www.vagrantup.com .. _Installing via an Insecure One-Liner: #installing-via-an-insecure-one-liner + .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et From 9548d7d6ef50c0bc3ca4b1bcdb0054f54e0f47be Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 13 Mar 2016 18:29:18 +0200 Subject: [PATCH 100/156] Correct lists of supported/detected OS and distros --- README.rst | 108 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 25 deletions(-) diff --git a/README.rst b/README.rst index 68798d9..70aa8b4 100644 --- a/README.rst +++ b/README.rst @@ -167,6 +167,66 @@ Installing the latest develop branch of Salt: curl -L https://bootstrap.saltstack.com | sudo sh -s -- git develop +Supported Operating Systems +--------------------------- + + +Debian and derivatives +~~~~~~~~~~~~~~~~~~~~~~ + +- Debian GNU/Linux 6/7/8 +- Linux Mint Debian Edition 1 (based on Debian 8) +- Kali Linux 1.0 (based on Debian 7) + + +Red Hat family +~~~~~~~~~~~~~~ + +- Amazon Linux 2012.09 (and some later) +- CentOS 5/6/7 +- Fedora 17/18/20/21/22 +- Oracle Linux 5/6/7 +- Red Hat Enterprise Linux 5/6/7 +- Scientific Linux 5/6/7 + + +SUSE family +~~~~~~~~~~~ + +- OpenSUSE 12/13 +- SUSE Linux Enterprise Server 11 SP1/11 SP2/11 SP3/12 + + +Ubuntu and derivatives +~~~~~~~~~~~~~~~~~~~~~~ + +- Elementary OS 0.2 (based on Ubuntu 12.04) +- Linaro 12.04 +- Linux Mint 13/14/16/17 +- Trisquel GNU/Linux 6 (based on Ubuntu 12.04) +- Ubuntu 10.x/11.x/12.x/13.x/14.x/15.04 + + +Other Linux distro +~~~~~~~~~~~~~~~~~~ + +- Arch Linux +- Gentoo + + +UNIX systems +~~~~~~~~~~~~ + +**BSD**: + +- OpenBSD (``pip`` installation) +- FreeBSD 9/10/11 + +**SunOS**: + +- SmartOS + + Unsupported Distro ------------------ @@ -182,7 +242,26 @@ Please run the following commands and report their output when creating a ticket Adding Support for Other Operating Systems ------------------------------------------ -In order to install salt for a distribution you need to define: +The following operating systems are detected, but Salt and its dependencies installation functions +are not developed yet: + +**BSD**: + +- NetBSD + +**Linux**: + +- Raspbian (detected as Debian) +- Slackware + +**SunOS** + +- OpenIndiana +- Oracle Solaris +- OmniOS (Illumos) + + +In order to install Salt for a distribution you need to define: 1. To Install Dependencies, which is required, one of: @@ -197,7 +276,7 @@ In order to install salt for a distribution you need to define: 2. Optionally, define a minion configuration function, which will be called if the - ``-c|config-dir`` option is passed. One of: + ``-c`` option is passed. One of: .. code:: bash @@ -210,8 +289,8 @@ In order to install salt for a distribution you need to define: config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT] -3. Optionally, define a salt master pre-seed function, which will be called if the -k (pre-seed - master keys) option is passed. One of: +3. Optionally, define a Salt master pre-seed function, which will be called if the + ``-k`` (pre-seed master keys) option is passed. One of: .. code:: bash @@ -342,27 +421,6 @@ The bootstrapping script must be plain POSIX sh only, **not** bash or another sh design the targeting for each operating system and version is very specific. Assumptions of supported versions or variants should not be made, to avoid failed or broken installations. -Supported Operating Systems ---------------------------- -- Amazon Linux 2012.09 -- Arch -- CentOS 5/6/7 -- Debian 6/7/8 -- Fedora 17/18/20/21/22 -- FreeBSD 9.1/9.2/10/11 -- Gentoo -- Linaro -- Linux Mint 13/14 -- OpenSUSE 12/13 -- Oracle Linux 5/6/7 -- Red Hat Enterprise Linux 5/6/7 -- Scientific Linux 5/6/7 -- SmartOS -- SUSE Linux Enterprise 11 SP1/11 SP2/11 SP3 -- Ubuntu 10.x/11.x/12.x/13.x/14.x/15.04 -- Elementary OS 0.2 - - I Found a Bug ============= From 758dc7215a584dfdd6ca5ed0c5d4272641e8a0fd Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 19 Mar 2016 16:18:02 +0200 Subject: [PATCH 101/156] Add example how to use Git install with HTTP proxy --- README.rst | 20 ++++++++++++++------ bootstrap-salt.sh | 6 ++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 70aa8b4..059199e 100644 --- a/README.rst +++ b/README.rst @@ -38,34 +38,42 @@ Examples Install using curl ~~~~~~~~~~~~~~~~~~ -Using ``curl`` to install latest git: +Using ``curl`` to install latest development version from GitHub: .. code:: console - curl -L https://bootstrap.saltstack.com -o install_salt.sh + curl -o install_salt.sh -L https://bootstrap.saltstack.com sudo sh install_salt.sh git develop -If you want to install a specific release version (based on the git tags): +If you want to install a specific release version (based on the Git tags): .. code:: console curl -o install_salt.sh -L https://bootstrap.saltstack.com sudo sh install_salt.sh git v2015.8.7 -To install a specific branch from a git fork: +To install a specific branch from a Git fork: .. code:: console curl -o install_salt.sh -L https://bootstrap.saltstack.com sudo sh install_salt.sh -g https://github.com/myuser/salt.git git mybranch -If all you want is to install a ``salt-master`` using latest git: +If all you want is to install a ``salt-master`` using latest Git: .. code:: console curl -o install_salt.sh -L https://bootstrap.saltstack.com sudo sh install_salt.sh -M -N git develop +If your host has Internet access only via HTTP proxy: + +.. code:: console + + PROXY='http://user:password@myproxy.example.com:3128' + curl -o install_salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com + sudo sh install_salt.sh -G -H "$PROXY" git + Install using wget ~~~~~~~~~~~~~~~~~~ @@ -87,7 +95,7 @@ Install a specific version from git using ``wget``: .. note:: On the above example we added `-P` which will allow PIP packages to be installed if required but - it's no a necessary flag for git based bootstraps. + it's no a necessary flag for Git based bootstraps. Install using Python diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7a267f8..820b29a 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -295,8 +295,10 @@ __usage() { per -p flag. You're responsible for providing the proper package name. -d Disable check_service functions. Setting this flag disables the 'install__check_services' checks. You can also do this by - touching /tmp/disable_salt_checks on the target host. Default: \${BS_FALSE} - -H Use the specified http proxy for the installation + touching /tmp/disable_salt_checks on the target host. + Default: \${BS_FALSE} + -H Use the specified HTTP proxy for all download URLs (including https://). + For example: http://myproxy.example.com:3128 -Z Enable additional package repository for newer ZeroMQ (Only available for RHEL/CentOS/Fedora/Ubuntu based distributions) -b Assume that dependencies are already installed and software sources are From db77e59e5590bf1bbe79a74dcf3e7647cc77e36e Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 20 Mar 2016 16:55:07 +0200 Subject: [PATCH 102/156] Add note about SaltStack corporate repo, fix links --- README.rst | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 059199e..22b79aa 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,10 @@ install the `Salt`_ binaries using the appropriate methods. source`_. **In case you found a bug, please read** `I found a bug`_ **first before submitting a new issue.** +The examples there show how to get the latest development version of the bootstrap script. Chances +are high that your issue was already fixed. +.. _`Salt`: https://saltstack.com/community/ .. _`read the source`: https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh @@ -25,14 +28,20 @@ Bootstrap If you're looking for the *one-liner* to install salt, please scroll to the bottom and use the instructions for `Installing via an Insecure One-Liner`_. +.. note:: + + In every two-step example, you would be well-served to examine the downloaded file and examine + it to ensure that it does what you expect. + Examples -------- .. note:: - In every two-step example, you would be well-served to examine the downloaded file and examine - it to ensure that it does what you expect. + Those examples below show how to bootstrap Salt directly from GitHub or other Git repository. + Run the script without any parameters to get latest stable Salt packages for your system from + `SaltStack corporate repository`_. See first example in the `Install using wget`_ section. Install using curl @@ -146,6 +155,9 @@ Or link them to the right place: ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem +.. _`SaltStack corporate repository`: https://repo.saltstack.com/ + + Installing via an Insecure One-Liner ------------------------------------ @@ -450,11 +462,10 @@ Or the insecure one liner: curl -L https://bootstrap.saltstack.com/develop | sudo sh -s -- git develop -If after trying this, you still see the same problems, then, please `file an issue`_. +If after trying this, you still see the same problems, then, please `fill an issue`_. -.. _`Salt`: http://saltstack.org/ -.. _`file an issue`: https://github.com/saltstack/salt-bootstrap/issues/new +.. _`fill an issue`: https://github.com/saltstack/salt-bootstrap/issues/new Testing in Vagrant @@ -470,6 +481,6 @@ Ubuntu box. First, install Vagrant, then: .. _Vagrant: http://www.vagrantup.com -.. _Installing via an Insecure One-Liner: #installing-via-an-insecure-one-liner + .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et From aad6c2c56051d7358394df5f9497aa15f50df1ba Mon Sep 17 00:00:00 2001 From: Ryan Walder Date: Tue, 22 Mar 2016 14:02:13 +0000 Subject: [PATCH 103/156] Add config_freebsd_salt func so freebsd puts cfgs in the right place FreeBSD uses /usr/local/etc/salt as config dir not /etc/salt, this adds a wrapper function to set the right config dir for config_salt to use. --- bootstrap-salt.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7a267f8..f916145 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4088,6 +4088,11 @@ install_arch_check_services() { # # FreeBSD Install Functions # +config_freebsd_salt() { + _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} + config_salt +} + __freebsd_get_packagesite() { if [ "$CPU_ARCH_L" = "amd64" ]; then BSD_ARCH="x86:64" @@ -4339,8 +4344,6 @@ install_freebsd_9_stable_post() { grep "$enable_string" /etc/rc.conf >/dev/null 2>&1 [ $? -eq 1 ] && echo "$enable_string" >> /etc/rc.conf - [ -f "${_SALT_ETC_DIR}/${fname}.sample" ] && __copyfile "${_SALT_ETC_DIR}/${fname}.sample" "${_SALT_ETC_DIR}/${fname}" - if [ $fname = "minion" ] ; then grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1 [ $? -eq 1 ] && echo "salt_minion_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\"" >> /etc/rc.conf From 879def7a23bc75751c8a8453593b0211d2d8329f Mon Sep 17 00:00:00 2001 From: Jared E Stroud Date: Sat, 26 Mar 2016 15:47:13 -0400 Subject: [PATCH 104/156] Lack of HTTPS for RPM packages. --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7a267f8..036f388 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2350,7 +2350,7 @@ install_debian_6_deps() { fi # shellcheck disable=SC2086 - wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q https://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3" @@ -3047,12 +3047,12 @@ __install_epel_repository() { rpm -q curl > /dev/null 2>&1 || yum -y install curl # rpm from CentOS/RHEL release 5 does not support HTTP downloads # properly, especially 3XX code redirects - __fetch_url /tmp/epel-release.rpm "http://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 + __fetch_url /tmp/epel-release.rpm "https://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 rpm -Uvh --force /tmp/epel-release.rpm || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then - rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 + rpm -Uvh --force "https://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then - rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1 + rpm -Uvh --force "https://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1 else echoerror "Failed add EPEL repository support." return 1 From ae88f3152c0b225c72a3bf126d766b63017744cd Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 28 Mar 2016 10:38:56 +0300 Subject: [PATCH 105/156] Rename the script to `bootstrap_salt.sh` in README --- README.rst | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/README.rst b/README.rst index 22b79aa..b188aa0 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,8 @@ Examples Run the script without any parameters to get latest stable Salt packages for your system from `SaltStack corporate repository`_. See first example in the `Install using wget`_ section. +.. _`SaltStack corporate repository`: https://repo.saltstack.com/ + Install using curl ~~~~~~~~~~~~~~~~~~ @@ -51,37 +53,37 @@ Using ``curl`` to install latest development version from GitHub: .. code:: console - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh git develop + curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh git develop If you want to install a specific release version (based on the Git tags): .. code:: console - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh git v2015.8.7 + curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh git v2015.8.7 To install a specific branch from a Git fork: .. code:: console - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh -g https://github.com/myuser/salt.git git mybranch + curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh -g https://github.com/myuser/salt.git git mybranch If all you want is to install a ``salt-master`` using latest Git: .. code:: console - curl -o install_salt.sh -L https://bootstrap.saltstack.com - sudo sh install_salt.sh -M -N git develop + curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh -M -N git develop If your host has Internet access only via HTTP proxy: .. code:: console PROXY='http://user:password@myproxy.example.com:3128' - curl -o install_salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com - sudo sh install_salt.sh -G -H "$PROXY" git + curl -o bootstrap_salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh -G -H "$PROXY" git Install using wget @@ -91,15 +93,15 @@ Using ``wget`` to install your distribution's stable packages: .. code:: console - wget -O install_salt.sh https://bootstrap.saltstack.com - sudo sh install_salt.sh + wget -O bootstrap_salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh Install a specific version from git using ``wget``: .. code:: console - wget -O install_salt.sh https://bootstrap.saltstack.com - sudo sh install_salt.sh -P git v2015.8.7 + wget -O bootstrap_salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh -P git v2015.8.7 .. note:: @@ -114,15 +116,15 @@ If you already have Python installed, ``python 2.6``, then it's as easy as: .. code:: console - python -m urllib "https://bootstrap.saltstack.com" > install_salt.sh - sudo sh install_salt.sh git develop + python -m urllib "https://bootstrap.saltstack.com" > bootstrap_salt.sh + sudo sh bootstrap_salt.sh git develop All Python versions should support the following one liner: .. code:: console - python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > install_salt.sh - sudo sh install_salt.sh git develop + python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > bootstrap_salt.sh + sudo sh bootstrap_salt.sh git develop Install using fetch @@ -133,8 +135,8 @@ have ``fetch`` available though: .. code:: console - fetch -o install_salt.sh https://bootstrap.saltstack.com - sudo sh install_salt.sh + fetch -o bootstrap_salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap_salt.sh If you have any SSL issues install ``ca_root_nssp``: @@ -155,9 +157,6 @@ Or link them to the right place: ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem -.. _`SaltStack corporate repository`: https://repo.saltstack.com/ - - Installing via an Insecure One-Liner ------------------------------------ @@ -437,8 +436,8 @@ Below is an example for Ubuntu Oneiric (the example may not be up to date with t Since there is no ``install_ubuntu_11_10_stable()`` it defaults to the unspecified version script. -The bootstrapping script must be plain POSIX sh only, **not** bash or another shell script. By -design the targeting for each operating system and version is very specific. Assumptions of +The bootstrapping script must be plain POSIX ``sh`` only, **not** ``bash`` or another shell script. +By design the targeting for each operating system and version is very specific. Assumptions of supported versions or variants should not be made, to avoid failed or broken installations. @@ -451,8 +450,8 @@ version. .. code:: console - curl -o install_salt.sh -L https://bootstrap.saltstack.com/develop - sudo sh install_salt.sh git develop + curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com/develop + sudo sh bootstrap_salt.sh git develop Or the insecure one liner: From 6367592fe3405d4b3518326670c5f76146a148fa Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 28 Mar 2016 10:57:29 -0600 Subject: [PATCH 106/156] get tornado from pip on a fedora git install --- bootstrap-salt.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7a267f8..506e735 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2935,7 +2935,15 @@ install_fedora_git_deps() { # We're on the develop branch, install whichever tornado is on the requirements file __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ "${__REQUIRED_TORNADO}" != "" ]; then - $FEDORA_PACKAGE_MANAGER install -y python-tornado + __check_pip_allowed "You need to allow pip based installations (-P) in order to install tornado" + + # Install pip and pip dependencies + if ! __check_command_exists pip; then + $FEDORA_PACKAGE_MANAGER install -y python-setuptools python-pip gcc python-devel + fi + + pip install -U tornado + fi fi From e872ef4032d2a3ecaa22d418a4f7fa6e4458928a Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 29 Mar 2016 10:20:39 +0300 Subject: [PATCH 107/156] README: correct link name --- README.rst | 2 +- bootstrap-salt.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index b188aa0..d8bb5b2 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ install the `Salt`_ binaries using the appropriate methods. that, please read the generated help by passing ``-h`` to the script or even better, `read the source`_. -**In case you found a bug, please read** `I found a bug`_ **first before submitting a new issue.** +**In case you found a bug, please read** `I Found a Bug`_ **first before submitting a new issue.** The examples there show how to get the latest development version of the bootstrap script. Chances are high that your issue was already fixed. diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 820b29a..b801c38 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -909,7 +909,7 @@ __gather_linux_system_info() { #---------------------------------------------------------------------------------------------------------------------- __gather_sunos_system_info() { if [ -f /sbin/uname ]; then - DISTRO_VERSION=$(/sbin/uname -X | awk '/[kK][eE][rR][nN][eE][lL][iI][dD]/ { print $3}') + DISTRO_VERSION=$(/sbin/uname -X | awk '/[kK][eE][rR][nN][eE][lL][iI][dD]/ { print $3 }') fi DISTRO_NAME="" From f78bc21cf84a9e248e343b9d74f8e67ed3166cab Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 29 Mar 2016 10:53:29 +0300 Subject: [PATCH 108/156] Add some SUSE releases to detected OS list --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d8bb5b2..fecd8a8 100644 --- a/README.rst +++ b/README.rst @@ -212,7 +212,9 @@ Red Hat family SUSE family ~~~~~~~~~~~ -- OpenSUSE 12/13 +- openSUSE 12/13 +- openSUSE Leap 42 +- openSUSE Tumbleweed 2015 (and some later) - SUSE Linux Enterprise Server 11 SP1/11 SP2/11 SP3/12 From 8d75aaf33ce369fa6560662adc98f13e7eb2c37a Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 29 Mar 2016 13:36:52 +0300 Subject: [PATCH 109/156] README: correct typos --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index fecd8a8..7bc356b 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Examples .. note:: - Those examples below show how to bootstrap Salt directly from GitHub or other Git repository. + These examples below show how to bootstrap Salt directly from GitHub or other Git repository. Run the script without any parameters to get latest stable Salt packages for your system from `SaltStack corporate repository`_. See first example in the `Install using wget`_ section. @@ -106,7 +106,7 @@ Install a specific version from git using ``wget``: .. note:: On the above example we added `-P` which will allow PIP packages to be installed if required but - it's no a necessary flag for Git based bootstraps. + it's not a necessary flag for Git based bootstraps. Install using Python From 7987acac448d706f8354998e07d61b14da755bd9 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 30 Mar 2016 11:34:23 +0300 Subject: [PATCH 110/156] Add note about latest-and-greatest OS releases support --- README.rst | 11 +++++++++-- bootstrap-salt.sh | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 7bc356b..26f925f 100644 --- a/README.rst +++ b/README.rst @@ -189,6 +189,13 @@ Installing the latest develop branch of Salt: Supported Operating Systems --------------------------- +.. note:: + + Bootstrap may fail to install Salt on the cutting-edge version of distributions with frequent + release cycle, such as: Amazon Linux, Fedora, openSUSE Tumbleweed or Ubuntu non-LTS. Check the + versions from the list below. Also, see the `Unsupported Distro`_ and + `Adding Support for Other Operating Systems`_ sections. + Debian and derivatives ~~~~~~~~~~~~~~~~~~~~~~ @@ -201,7 +208,7 @@ Debian and derivatives Red Hat family ~~~~~~~~~~~~~~ -- Amazon Linux 2012.09 (and some later) +- Amazon Linux 2012.09/2013.03/2013.09/2014.03/2014.09 - CentOS 5/6/7 - Fedora 17/18/20/21/22 - Oracle Linux 5/6/7 @@ -214,7 +221,7 @@ SUSE family - openSUSE 12/13 - openSUSE Leap 42 -- openSUSE Tumbleweed 2015 (and some later) +- openSUSE Tumbleweed 2015 - SUSE Linux Enterprise Server 11 SP1/11 SP2/11 SP3/12 diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b801c38..2e838bc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -874,7 +874,7 @@ __gather_linux_system_info() { [ "${rv}" != "" ] && v=$(__parse_version_string "$rv") || v="" case $(echo "${nn}" | tr '[:upper:]' '[:lower:]') in amzn ) - # Amazon AMI's after 2014.9 match here + # Amazon AMI's after 2014.09 match here n="Amazon Linux AMI" ;; arch ) @@ -3764,6 +3764,9 @@ install_scientific_linux_check_services() { # Amazon Linux AMI Install Functions # +# FIXME: 2010.xx releases are no longer avaliable: https://aws.amazon.com/amazon-linux-ami/ +# Need to add amazon case to __check_end_of_life_versions + install_amazon_linux_ami_2010_deps() { # Linux Amazon AMI 2010.xx seems to use EPEL5 but the system is based on CentOS6. # Supporting this would be quite troublesome and we need to workaround some serious package conflicts From 01bf30b6c69d9c4f1b35cab7a6aefa8d0cc3c774 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 4 Apr 2016 18:53:15 +0300 Subject: [PATCH 111/156] Add Dockerfile for building Salt Master + Minion image --- Dockerfile | 20 ++++++++++++++++++++ README.rst | 32 +++++++++++++++++++------------- 2 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c4d7978 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu-upstart:14.04 +MAINTAINER "SaltStack Team" + +# Bootstrap script options: install Salt Master by default +ENV BOOTSTRAP_OPTS='-M' +# Version of salt to install: stable or git +ENV SALT_VERSION=stable + +ADD bootstrap-salt.sh /tmp/ + +# Prevent udev from being upgraded inside the container, dpkg will fail to configure it +RUN echo udev hold | dpkg --set-selections +# Upgrade System and Install Salt +RUN sudo sh /tmp/bootstrap-salt.sh -U -X -d $BOOTSTRAP_OPTS $SALT_VERSION && \ + apt-get clean +RUN /usr/sbin/update-rc.d -f ondemand remove; \ + update-rc.d salt-minion defaults && \ + update-rc.d salt-master defaults || true + +EXPOSE 4505 4506 diff --git a/README.rst b/README.rst index 26f925f..a94d650 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,7 @@ are high that your issue was already fixed. Bootstrap ========= -If you're looking for the *one-liner* to install salt, please scroll to the bottom and use the +If you're looking for the *one-liner* to install Salt, please scroll to the bottom and use the instructions for `Installing via an Insecure One-Liner`_. .. note:: @@ -37,6 +37,9 @@ instructions for `Installing via an Insecure One-Liner`_. Examples -------- +The Salt Bootstrap script has a wide variety of options that can be passed as +well as several ways of obtaining the bootstrap script itself. + .. note:: These examples below show how to bootstrap Salt directly from GitHub or other Git repository. @@ -61,7 +64,7 @@ If you want to install a specific release version (based on the Git tags): .. code:: console curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh git v2015.8.7 + sudo sh bootstrap_salt.sh git v2015.8.8 To install a specific branch from a Git fork: @@ -96,7 +99,7 @@ Using ``wget`` to install your distribution's stable packages: wget -O bootstrap_salt.sh https://bootstrap.saltstack.com sudo sh bootstrap_salt.sh -Install a specific version from git using ``wget``: +Installing a specific version from git using ``wget``: .. code:: console @@ -119,7 +122,7 @@ If you already have Python installed, ``python 2.6``, then it's as easy as: python -m urllib "https://bootstrap.saltstack.com" > bootstrap_salt.sh sudo sh bootstrap_salt.sh git develop -All Python versions should support the following one liner: +All Python versions should support the following in-line code: .. code:: console @@ -142,7 +145,7 @@ If you have any SSL issues install ``ca_root_nssp``: .. code:: console - pkg install ca_root_nssp + pkg install ca_root_nssp And either copy the certificates to the place where fetch can find them: @@ -164,20 +167,23 @@ The following examples illustrate how to install Salt via a one-liner. .. note:: - Warning! These methods do not involve a verification step and assume that the delivered file - is trustworthy. + Warning! These methods do not involve a verification step and assume that the delivered file + is trustworthy. + +Any of the example above which use two-lines can be made to run in a single-line +configuration with minor modifications. Installing the latest stable release of Salt (default): .. code:: console - curl -L https://bootstrap.saltstack.com | sudo sh -s -- stable + curl -L https://bootstrap.saltstack.com | sudo sh -or +Using ``wget`` to install your distribution's stable packages: -.. code:: console +.. code-block:: bash - curl -L https://bootstrap.saltstack.com | sudo sh -s + wget -O - https://bootstrap.saltstack.com | sudo sh Installing the latest develop branch of Salt: @@ -484,8 +490,8 @@ Ubuntu box. First, install Vagrant, then: .. code:: console - vagrant up - vagrant ssh + vagrant up + vagrant ssh .. _Vagrant: http://www.vagrantup.com From 23fa9f8f6f8a34a30d6b00588ccde4f0f79b0197 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 5 Apr 2016 18:53:20 +0300 Subject: [PATCH 112/156] Add section about Docker to README file --- Dockerfile | 2 +- README.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c4d7978..bfcafd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV BOOTSTRAP_OPTS='-M' # Version of salt to install: stable or git ENV SALT_VERSION=stable -ADD bootstrap-salt.sh /tmp/ +COPY bootstrap-salt.sh /tmp/ # Prevent udev from being upgraded inside the container, dpkg will fail to configure it RUN echo udev hold | dpkg --set-selections diff --git a/README.rst b/README.rst index a94d650..0857add 100644 --- a/README.rst +++ b/README.rst @@ -497,4 +497,33 @@ Ubuntu box. First, install Vagrant, then: .. _Vagrant: http://www.vagrantup.com +Running in Docker +================= + +Also you are able to run and use Salt inside Docker_ container on Linux machine. +Let's prepare Docker image with both Salt Master and Minion installed by the bootstrap script: + +.. code:: console + + docker built -t local/salt-bootstrap . + +Start your new container with Salt services: + +.. code:: console + + docker run --detach --name salt --hostname salt local/salt-bootstrap + +And finally "enter" the running container and make Salt fully operational: + +.. code:: console + + docker exec -i -t salt /bin/bash + salt-key -A -y + +Salt is ready and working in the Docker container with Minion authenticated on Master. + + +.. _Docker: https://www.docker.com/ + + .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et From 8325af94ec27f17c859a1df5cc7bc9f946a82c83 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 7 Apr 2016 17:36:26 +0300 Subject: [PATCH 113/156] README: add note about `Dockerfile` --- README.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 0857add..b14912e 100644 --- a/README.rst +++ b/README.rst @@ -145,19 +145,19 @@ If you have any SSL issues install ``ca_root_nssp``: .. code:: console - pkg install ca_root_nssp + pkg install ca_root_nssp And either copy the certificates to the place where fetch can find them: .. code:: console - cp /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem + cp /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem Or link them to the right place: .. code:: console - ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem + ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem Installing via an Insecure One-Liner @@ -501,13 +501,14 @@ Running in Docker ================= Also you are able to run and use Salt inside Docker_ container on Linux machine. -Let's prepare Docker image with both Salt Master and Minion installed by the bootstrap script: +Let's prepare the Docker image using provided ``Dockerfile`` to install both Salt Master and Minion +with the bootstrap script: .. code:: console docker built -t local/salt-bootstrap . -Start your new container with Salt services: +Start your new container with Salt services up and running: .. code:: console @@ -522,8 +523,15 @@ And finally "enter" the running container and make Salt fully operational: Salt is ready and working in the Docker container with Minion authenticated on Master. +.. note:: + + The ``Dockerfile`` here inherits Ubuntu 14.04 public image with Upstart configured as init system. + Consider it as an example or starting point of how to make your own Docker images with suitable + Salt components, custom configurations and even `pre-accepted Minion key`_ already installed. + .. _Docker: https://www.docker.com/ +.. _`pre-accepted Minion key`: https://docs.saltstack.com/en/latest/topics/tutorials/preseed_key.html .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et From d377f9b1ecb461f5d1eb0f398c6daa65c819efa9 Mon Sep 17 00:00:00 2001 From: "C. R. Oldham" Date: Fri, 8 Apr 2016 15:32:52 -0600 Subject: [PATCH 114/156] Zypper chokes when the repo name does not match what is in the metadata and GPG keys need to be accepted. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index dcbe9e1..8853ebc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4814,7 +4814,7 @@ install_opensuse_stable_deps() { __zypper repos --details | grep "${opensuse_deps_repo_url}" >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${opensuse_deps_repo_url}" systemsmanagement_saltstack || return 1 + __zypper addrepo --refresh "${opensuse_deps_repo_url}" || return 1 fi __zypper --gpg-auto-import-keys refresh From 506139a8712541c42d2bb102446885c37f40a662 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Thu, 3 Mar 2016 15:31:49 -0600 Subject: [PATCH 115/156] Allow archive versions --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 28c0963..614a442 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -452,8 +452,8 @@ elif [ "$ITYPE" = "stable" ]; then STABLE_REV="latest" else __check_unparsed_options "$*" - if [ "$(echo "$1" | egrep '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" = "" ]; then - echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest)" + if [ "$(echo "$1" | egrep '^(latest|archive/[0-9]*\.[0-9]*\.[0-9]*|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" = "" ]; then + echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, archive/\$MAJOR.\$MINOR.\$PATCH)" exit 1 else STABLE_REV="$1" From 5168c51e049ea539e3428dc86f24bf662d27b124 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Thu, 3 Mar 2016 15:50:37 -0600 Subject: [PATCH 116/156] Change the name of the repo file - having a '/' in the archive versions breaks things --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 614a442..872dfaf 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3103,10 +3103,10 @@ __install_saltstack_rhel_repository() { gpg_key="SALTSTACK-GPG-KEY.pub" fi - repo_file="/etc/yum.repos.d/salt-${repo_rev}.repo" + repo_file="/etc/yum.repos.d/saltstack.repo" if [ ! -s "$repo_file" ]; then cat <<_eof > "$repo_file" -[salt-${repo_rev}] +[saltstack] name=SaltStack ${repo_rev} Release Channel for RHEL/CentOS \$releasever baseurl=$base_url skip_if_unavailable=True From 9b5df62f35b4c0ab5f9b083578642ba54000dd62 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Mon, 28 Mar 2016 23:59:20 -0500 Subject: [PATCH 117/156] Allow archived versions on rhel too --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 872dfaf..1da5c33 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1233,7 +1233,7 @@ __ubuntu_codename_translation if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 -elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then +elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi From 6af97d16fcc52ade9327db5db69179b0dcba9709 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Fri, 8 Apr 2016 22:05:57 -0500 Subject: [PATCH 118/156] No longer require archive/ in the syntax for stable installs of specific versions --- bootstrap-salt.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1da5c33..8d2f034 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -452,12 +452,16 @@ elif [ "$ITYPE" = "stable" ]; then STABLE_REV="latest" else __check_unparsed_options "$*" - if [ "$(echo "$1" | egrep '^(latest|archive/[0-9]*\.[0-9]*\.[0-9]*|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" = "" ]; then - echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, archive/\$MAJOR.\$MINOR.\$PATCH)" - exit 1 - else + if [ "$(echo "$1" | egrep '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" != "" ]; then STABLE_REV="$1" shift + elif [ "$(echo "$1" | egrep '^([0-9]*\.[0-9]*\.[0-9]*)$')" != "" ]; then + STABLE_REV="archive/$1" + shift + else + echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, \$MAJOR.\$MINOR.\$PATCH)" + exit 1 + fi fi fi From 904cb807d73b1c437a073ef461934bfe8b11121d Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Fri, 8 Apr 2016 22:11:11 -0500 Subject: [PATCH 119/156] Added RedHat to help section on stable releases --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8d2f034..e0dc19b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -238,7 +238,7 @@ __usage() { Installation types: - stable (install latest stable release, this is default) - - stable [version] (currently only supported on: Ubuntu, CentOS) + - stable [version] (currently only supported on: Ubuntu, CentOS, RedHat) - daily (Ubuntu specific: configure SaltStack Daily PPA) - testing (RHEL-family specific: configure EPEL testing repo) - git [branch_or_tag] (install from 'develop' by default) From 521fd4fdf444030d86f506482a639a922fb0d148 Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Fri, 8 Apr 2016 22:14:04 -0500 Subject: [PATCH 120/156] Added oracle & scientific --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e0dc19b..dbee1b6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -238,7 +238,7 @@ __usage() { Installation types: - stable (install latest stable release, this is default) - - stable [version] (currently only supported on: Ubuntu, CentOS, RedHat) + - stable [version] (currently only supported on: Ubuntu, CentOS, RedHat, Oracle, Scientific) - daily (Ubuntu specific: configure SaltStack Daily PPA) - testing (RHEL-family specific: configure EPEL testing repo) - git [branch_or_tag] (install from 'develop' by default) @@ -1237,7 +1237,7 @@ __ubuntu_codename_translation if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 -elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then +elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat|oracle|scientific)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi From 6f19f48c9a03aa96b29f82f8c4d8d935ea1b3c1a Mon Sep 17 00:00:00 2001 From: Clark Perkins Date: Fri, 8 Apr 2016 22:18:54 -0500 Subject: [PATCH 121/156] Changed filename of ubuntu list file as well --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index dbee1b6..b0a4429 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2036,7 +2036,7 @@ install_ubuntu_stable_deps() { # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" >> \ - "/etc/apt/sources.list.d/salt-$STABLE_REV.list" + "/etc/apt/sources.list.d/saltstack.list" fi From d5d83c29f8ec60c2c817f162b774df1159f89aab Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 18:21:30 -0600 Subject: [PATCH 122/156] support specific pkg versions on ubuntu --- bootstrap-salt.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b0a4429..54216c4 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1947,8 +1947,8 @@ install_ubuntu_deps() { __enable_universe_repository || return 1 - # the latest version of 2015.5 and all versions of 2015.8 and beyond are hosted on repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest)$')" = "" ]; then + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository" if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then @@ -2030,16 +2030,14 @@ install_ubuntu_stable_deps() { install_ubuntu_deps || return 1 - # the latest version of 2015.5 and all versions of 2015.8 and beyond are hosted on repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest)$')" != "" ]; then - + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then # Saltstack's Stable Ubuntu repository if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" >> \ + echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" > \ "/etc/apt/sources.list.d/saltstack.list" fi - # Make sure wget is available __apt_get_install_noinput wget From 09d10ed25d6d04e010ffdfef49cec173e0c34a48 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 18:48:37 -0600 Subject: [PATCH 123/156] support specific pkg versions on debian --- bootstrap-salt.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 54216c4..1a58b46 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1237,7 +1237,7 @@ __ubuntu_codename_translation if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$ITYPE" = "daily" ]); then echoerror "${DISTRO_NAME} does not have daily packages support" exit 1 -elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(ubuntu|centos|red_hat|oracle|scientific)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then +elif ([ "$(echo "${DISTRO_NAME_L}" | egrep '(debian|ubuntu|centos|red_hat|oracle|scientific)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then echoerror "${DISTRO_NAME} does not have major version pegged packages support" exit 1 fi @@ -2020,7 +2020,6 @@ install_ubuntu_deps() { } install_ubuntu_stable_deps() { - # This probably holds true for the Debians as well if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then repo_arch="amd64" elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then @@ -2514,6 +2513,13 @@ install_debian_7_deps() { install_debian_8_deps() { echodebug "install_debian_8_deps" + if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then + repo_arch="amd64" + elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then + echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)" + repo_arch="i386" + fi + if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." fi @@ -2533,14 +2539,16 @@ install_debian_8_deps() { apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1 fi - # Saltstack's Stable Debian repository - if [ "$(grep -R 'latest jessie main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/debian/latest jessie main" >> \ - /etc/apt/sources.list.d/saltstack.list - fi + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + SALTSTACK_DEBIAN_URL="https://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" + echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://repo.saltstack.com/apt/debian/latest/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + # shellcheck disable=SC2086 + wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + + __apt_get_install_noinput apt-transport-https || return 1 + fi apt-get update || return 1 __PACKAGES="libzmq3 libzmq3-dev python-zmq python-requests python-apt" From f578f694281b27041d22e465ea2372f8474f1feb Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 18:23:24 -0600 Subject: [PATCH 124/156] clarify installation types usage help --- bootstrap-salt.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1a58b46..b3460e1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -237,21 +237,28 @@ __usage() { Usage : ${__ScriptName} [options] [install-type-args] Installation types: - - stable (install latest stable release, this is default) - - stable [version] (currently only supported on: Ubuntu, CentOS, RedHat, Oracle, Scientific) - - daily (Ubuntu specific: configure SaltStack Daily PPA) - - testing (RHEL-family specific: configure EPEL testing repo) - - git [branch_or_tag] (install from 'develop' by default) + - stable Install latest stable release. This is the default + install type + - stable [branch] Install latest version on a branch. Only supported + for packages available at repo.saltstack.com + - stable [version] Install a specific version. Only supported for + packages available at repo.saltstack.com + - daily Ubuntu specific: configure SaltStack Daily PPA + - testing RHEL-family specific: configure EPEL testing repo + - git Install from the head of the develop branch + - git [ref] Install from any git ref (such as a branch, tag, or + commit) Examples: - ${__ScriptName} - ${__ScriptName} stable - ${__ScriptName} stable 2015.8 + - ${__ScriptName} stable 2015.8.9 - ${__ScriptName} daily - ${__ScriptName} testing - ${__ScriptName} git - - ${__ScriptName} git develop - - ${__ScriptName} git v2015.8.5 + - ${__ScriptName} git 2015.8 + - ${__ScriptName} git v2015.8.9 - ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 Options: From fb8d06f383a0485fc86caa26caf0fcb8afa768d7 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 19:47:47 -0600 Subject: [PATCH 125/156] debian.saltstack.com is http --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 036f388..b1a2efa 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2350,7 +2350,7 @@ install_debian_6_deps() { fi # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3" From 105e36c4133cc51c801c78e79f280829ac38beb8 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 22:12:58 -0600 Subject: [PATCH 126/156] fix lint from #761 --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index c7c1bec..77bd9de 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5984,9 +5984,9 @@ fi # Ensure that the cachedir exists # (Workaround for https://github.com/saltstack/salt/issues/6502) if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - if [ ! -d ${_SALT_CACHE_DIR}/minion/proc ]; then + if [ ! -d "${_SALT_CACHE_DIR}/minion/proc" ]; then echodebug "Creating salt's cachedir" - mkdir -p ${_SALT_CACHE_DIR}/minion/proc + mkdir -p "${_SALT_CACHE_DIR}/minion/proc" fi fi From 8c42c52eece17cd223b67058dda0224e47b3e91a Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Tue, 5 Apr 2016 15:00:13 -0600 Subject: [PATCH 127/156] add downstream pkg repo for SUSE --- bootstrap-salt.sh | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 77bd9de..d2c1e12 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -190,6 +190,7 @@ _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} +_DOWNSTREAM_PKG_REPO=$BS_FALSE _TEMP_KEYS_DIR="null" _SLEEP="${__DEFAULT_SLEEP}" _INSTALL_MASTER=$BS_FALSE @@ -272,6 +273,9 @@ __usage() { https://${_SALTSTACK_REPO_URL#*://} (Usually necessary on systems which have the regular git protocol port blocked, where https usually is not) + -w Install packages from downstream package repository rather than + upstream, saltstack package repository. This is currently only + implemented for SUSE. -k Temporary directory holding the minion keys which will pre-seed the master. -s Sleep time used when waiting for daemons to start, restart and when @@ -320,7 +324,7 @@ EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:k:s:MSNXCPFUKIA:i:Lp:dH:Zbf" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbf" opt do case "${opt}" in @@ -341,7 +345,7 @@ do fi ;; - g ) _SALT_REPO_URL=$OPTARG ;; + g ) _SALT_REPO_URL=$OPTARG ;; G ) if [ "${_SALT_REPO_URL}" = "${_SALTSTACK_REPO_URL}" ]; then _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" @@ -351,6 +355,8 @@ do fi ;; + w ) _DOWNSTREAM_PKG_REPO=$BS_TRUE ;; + k ) _TEMP_KEYS_DIR="$OPTARG" # If the configuration directory does not exist, error out if [ ! -d "$_TEMP_KEYS_DIR" ]; then @@ -1158,6 +1164,21 @@ __debian_derivatives_translation() { fi } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __set_suse_pkg_repo +# DESCRIPTION: Set SUSE_PKG_URL to either the upstream SaltStack repo or the +# downstream SUSE repo +#---------------------------------------------------------------------------------------------------------------------- +__set_suse_pkg_repo() { + suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo" + if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then + suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" + else + suse_pkg_url_base="https://repo.saltstack.com/opensuse" + fi + SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path" +} + __gather_system_info echo @@ -4832,11 +4853,11 @@ install_opensuse_stable_deps() { fi # Is the repository already known - opensuse_deps_repo_url="http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" - __zypper repos --details | grep "${opensuse_deps_repo_url}" >/dev/null 2>&1 + __set_suse_pkg_repo + __zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${opensuse_deps_repo_url}" || return 1 + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 fi __zypper --gpg-auto-import-keys refresh @@ -5062,11 +5083,11 @@ install_suse_12_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}" # Is the repository already known - __zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1 + __set_suse_pkg_repo + __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh \ - "http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" || return 1 + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 fi __zypper --gpg-auto-import-keys refresh || return 1 @@ -5248,11 +5269,11 @@ install_suse_11_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" # Is the repository already known - __zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1 + __set_suse_pkg_repo + __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh \ - "http://download.opensuse.org/repositories/systemsmanagement:saltstack/${DISTRO_REPO}/systemsmanagement:saltstack.repo" || return 1 + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 fi __zypper --gpg-auto-import-keys refresh || return 1 From 9247c942b258565497b5c825b1cbe0189cac4f2a Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 12 Apr 2016 11:12:04 +0300 Subject: [PATCH 128/156] Bump Salt version to latest stable in PS bootstrap script for Windows --- bootstrap-salt.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 81cc8e5..0ea731b 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -47,7 +47,7 @@ Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "YYYY.M.R-B" [ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')] - [string]$version = "2015.8.3", + [string]$version = "2015.8.8-2", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] [ValidateSet("true","false")] From 0d3371feae2d3d3f55c7c1d14481bb08eda7a20f Mon Sep 17 00:00:00 2001 From: gdm85 Date: Wed, 30 Mar 2016 19:32:48 +0200 Subject: [PATCH 129/156] Fixed use of HTTP over HTTPS for anonscm.debian.org Verify downloaded GPG public over HTTP Added FIXMEs for remaining unsecure downloads over HTTP --- bootstrap-salt.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d2c1e12..0aa4444 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -629,6 +629,28 @@ __fetch_url() { ftp -o "$1" "$2" >/dev/null 2>&1 # OpenBSD } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __fetch_verify +# DESCRIPTION: Retrieves a URL, verifies its content and writes it to standard output +#---------------------------------------------------------------------------------------------------------------------- +__fetch_verify() { + local tmpf url sum size + url="$1" + sum="$2" + size="$3" + + tmpf=$(mktemp) && \ + __fetch_url "$tmpf" "$url" && \ + test $(stat --format=%s "$tmpf") -eq "$size" && \ + test $(md5sum "$tmpf" | awk '{ print $1 }') = "$sum" && \ + cat "$tmpf" && \ + rm -f "$tmpf" + if [ $? -eq 0 ]; then + return 0 + fi + echo "Failed verification of $url" + return 1 +} #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __gather_hardware_info @@ -1172,6 +1194,7 @@ __debian_derivatives_translation() { __set_suse_pkg_repo() { suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo" if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then + # FIXME: cleartext download over unsecure protocol (HTTP) suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" else suse_pkg_url_base="https://repo.saltstack.com/opensuse" @@ -2383,7 +2406,7 @@ install_debian_6_deps() { fi # shellcheck disable=SC2086 - wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 + __fetch_verify http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key 267d1f152d0cc94b23eb4c6993ba3d67 3100 | apt-key add - || return 1 if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3" @@ -2505,7 +2528,7 @@ install_debian_7_deps() { fi # shellcheck disable=SC2086 - wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 + __fetch_verify http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key 267d1f152d0cc94b23eb4c6993ba3d67 3100 | apt-key add - || return 1 apt-get update || return 1 __apt_get_install_noinput -t wheezy-backports libzmq3 libzmq3-dev python-zmq python-apt || return 1 @@ -2823,7 +2846,7 @@ install_debian_git_post() { 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" else - __fetch_url "/etc/init.d/salt-$fname" "http://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" + __fetch_url "/etc/init.d/salt-$fname" "https://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi if [ ! -f "/etc/init.d/salt-$fname" ]; then echowarn "The init script for salt-$fname was not found, skipping it..." @@ -4446,6 +4469,7 @@ install_freebsd_restart_daemons() { # __choose_openbsd_mirror() { + # FIXME: cleartext download over unsecure protocol (HTTP) MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html MIRROR_LIST_FILE=/tmp/openbsd-mirrors.html OPENBSD_REPO='' From 3290e432d71bfb2e3667db857049a22d75086bbe Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 11 Apr 2016 20:24:36 -0600 Subject: [PATCH 130/156] fixup lint: remove tabs, local `local` is not portable. --- bootstrap-salt.sh | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0aa4444..0fcef10 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -634,22 +634,21 @@ __fetch_url() { # DESCRIPTION: Retrieves a URL, verifies its content and writes it to standard output #---------------------------------------------------------------------------------------------------------------------- __fetch_verify() { - local tmpf url sum size - url="$1" - sum="$2" - size="$3" + fetch_verify_url="$1" + fetch_verify_sum="$2" + fetch_verify_size="$3" - tmpf=$(mktemp) && \ - __fetch_url "$tmpf" "$url" && \ - test $(stat --format=%s "$tmpf") -eq "$size" && \ - test $(md5sum "$tmpf" | awk '{ print $1 }') = "$sum" && \ - cat "$tmpf" && \ - rm -f "$tmpf" - if [ $? -eq 0 ]; then - return 0 - fi - echo "Failed verification of $url" - return 1 + fetch_verify_tmpf=$(mktemp) && \ + __fetch_url "$fetch_verify_tmpf" "$fetch_verify_url" && \ + test "$(stat --format=%s "$fetch_verify_tmpf")" -eq "$fetch_verify_size" && \ + test "$(md5sum "$fetch_verify_tmpf" | awk '{ print $1 }')" = "$fetch_verify_sum" && \ + cat "$fetch_verify_tmpf" && \ + rm -f "$fetch_verify_tmpf" + if [ $? -eq 0 ]; then + return 0 + fi + echo "Failed verification of $fetch_verify_url" + return 1 } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -4469,7 +4468,7 @@ install_freebsd_restart_daemons() { # __choose_openbsd_mirror() { - # FIXME: cleartext download over unsecure protocol (HTTP) + # FIXME: cleartext download over unsecure protocol (HTTP) MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html MIRROR_LIST_FILE=/tmp/openbsd-mirrors.html OPENBSD_REPO='' From 00fbe44f94029794776f4a78ecfbaa3ef8ddabe4 Mon Sep 17 00:00:00 2001 From: rallytime Date: Mon, 11 Apr 2016 11:43:42 -0600 Subject: [PATCH 131/156] Add the -l option to switch https to http links --- bootstrap-salt.sh | 51 ++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0fcef10..78780e7 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -226,6 +226,7 @@ _DISABLE_SALT_CHECKS=$BS_FALSE _SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} _NO_DEPS=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE +_DISABLE_SSL=$BS_FALSE #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -319,12 +320,14 @@ __usage() { step. -f Force shallow cloning for git installations. This may result in an "n/a" in the version number. + -l Disable ssl checks. When passed, switches "https" calls to "http" where + possible. EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbf" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbfl" opt do case "${opt}" in @@ -385,6 +388,7 @@ do Z ) _ENABLE_EXTERNAL_ZMQ_REPOS=$BS_TRUE ;; b ) _NO_DEPS=$BS_TRUE ;; f ) _FORCE_SHALLOW_CLONE=$BS_TRUE ;; + l ) _DISABLE_SSL=$BS_TRUE ;; \?) echo echoerror "Option does not exist : $OPTARG" @@ -428,7 +432,7 @@ if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MASTER_ADDRESS" != "null" ] exit 1 fi -# Check that we're installing a minion if we're being passed a master address +# Check that we're installing a minion if we're being passed a minion id if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MINION_ID" != "null" ]; then echoerror "Don't pass a minion id (-i) if no minion is going to be bootstrapped." exit 1 @@ -488,6 +492,13 @@ if [ "$#" -gt 0 ]; then exit 1 fi +# Check the _DISABLE_SSL value and set HTTP or HTTPS. +if [ "$_DISABLE_SSL" -eq "${BS_TRUE}" ]; then + HTTP_VAL="http" +else + HTTP_VAL="https" +fi + # whoami alternative for SunOS if [ -f /usr/xpg4/bin/id ]; then whoami='/usr/xpg4/bin/id -un' @@ -2091,7 +2102,7 @@ install_ubuntu_stable_deps() { __apt_get_install_noinput wget # shellcheck disable=SC2086 - wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q $HTTP_VAL://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 @@ -3142,7 +3153,7 @@ __install_saltstack_copr_zeromq_repository() { __REPOTYPE="epel" fi __fetch_url /etc/yum.repos.d/saltstack-zeromq4.repo \ - "https://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1 + "${HTTP_VAL}://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1 fi return 0 } @@ -3154,8 +3165,8 @@ __install_saltstack_rhel_repository() { repo_rev="latest" fi - base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" - fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" + base_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + fetch_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then gpg_key="SALTSTACK-EL5-GPG-KEY.pub" @@ -3183,7 +3194,7 @@ _eof # Import CentOS 7 GPG key on RHEL for installing base dependencies from # Salt corporate repository rpm -qa gpg-pubkey\* --qf "%{name}-%{version}\n" | grep -q ^gpg-pubkey-f4a80eb5$ || \ - __rpm_import_gpg "https://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1 + __rpm_import_gpg "${HTTP_VAL}://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1 fi return 0 @@ -3203,7 +3214,7 @@ __install_saltstack_copr_salt_repository() { if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then __fetch_url "/etc/yum.repos.d/${__REPO_FILENAME}" \ - "https://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1 + "${HTTP_VAL}://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1 fi return 0 } @@ -3866,8 +3877,8 @@ install_amazon_linux_ami_deps() { disabled=False name=SaltStack repo for RHEL/CentOS 6 gpgcheck=1 -gpgkey=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -baseurl=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/ +gpgkey=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTSTACK-GPG-KEY.pub +baseurl=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/ humanname=SaltStack repo for RHEL/CentOS 6 _eof fi @@ -4540,7 +4551,7 @@ install_openbsd_deps() { # Let's download, since they were not provided, the default configuration files if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/$fname" \ - "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -4612,7 +4623,7 @@ install_openbsd_post() { if [ $? -eq 1 ]; then if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ - "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" + "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then __copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 echo salt_${fname}_enable="YES" >> /etc/rc.conf.local @@ -4685,12 +4696,12 @@ install_smartos_deps() { if [ ! -f "$_SALT_ETC_DIR/minion" ] && [ ! -f "$_TEMP_CONFIG_DIR/minion" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/minion" -L \ - https://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1 + $HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1 fi if [ ! -f "$_SALT_ETC_DIR/master" ] && [ ! -f $_TEMP_CONFIG_DIR/master ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/master" -L \ - https://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1 + $HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1 fi fi @@ -4765,7 +4776,7 @@ install_smartos_post() { if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname.xml" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/salt-$fname.xml" -L \ - "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml" + "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml" fi svccfg import "$_TEMP_CONFIG_DIR/salt-$fname.xml" if [ "${VIRTUAL_TYPE}" = "global" ]; then @@ -5171,7 +5182,7 @@ install_suse_12_stable_deps() { if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \ - "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -5242,7 +5253,7 @@ install_suse_12_stable_post() { if [ -f /bin/systemctl ]; then # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ + curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ -o "/usr/lib/systemd/system/salt-$fname.service" || return 1 continue fi @@ -5357,7 +5368,7 @@ install_suse_11_stable_deps() { if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \ - "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -5428,13 +5439,13 @@ install_suse_11_stable_post() { if [ -f /bin/systemctl ]; then # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ + curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ -o "/lib/systemd/system/salt-$fname.service" || return 1 continue fi # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ + curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ -o "/etc/init.d/salt-$fname" || return 1 chmod +x "/etc/init.d/salt-$fname" From 9591e8a1c1cf0e3aac452418fed86a5c8c317bb1 Mon Sep 17 00:00:00 2001 From: rallytime Date: Tue, 12 Apr 2016 14:21:46 -0600 Subject: [PATCH 132/156] Don't use http for Github links - redirects to https --- bootstrap-salt.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 78780e7..99a19f0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4551,7 +4551,7 @@ install_openbsd_deps() { # Let's download, since they were not provided, the default configuration files if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/$fname" \ - "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -4623,7 +4623,7 @@ install_openbsd_post() { if [ $? -eq 1 ]; then if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ - "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" + "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then __copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 echo salt_${fname}_enable="YES" >> /etc/rc.conf.local @@ -4696,12 +4696,12 @@ install_smartos_deps() { if [ ! -f "$_SALT_ETC_DIR/minion" ] && [ ! -f "$_TEMP_CONFIG_DIR/minion" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/minion" -L \ - $HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1 + https://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1 fi if [ ! -f "$_SALT_ETC_DIR/master" ] && [ ! -f $_TEMP_CONFIG_DIR/master ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/master" -L \ - $HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1 + https://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1 fi fi @@ -4776,7 +4776,7 @@ install_smartos_post() { if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname.xml" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/salt-$fname.xml" -L \ - "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml" + "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml" fi svccfg import "$_TEMP_CONFIG_DIR/salt-$fname.xml" if [ "${VIRTUAL_TYPE}" = "global" ]; then @@ -5182,7 +5182,7 @@ install_suse_12_stable_deps() { if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \ - "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -5253,7 +5253,7 @@ install_suse_12_stable_post() { if [ -f /bin/systemctl ]; then # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ + curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ -o "/usr/lib/systemd/system/salt-$fname.service" || return 1 continue fi @@ -5368,7 +5368,7 @@ install_suse_11_stable_deps() { if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then # shellcheck disable=SC2086 curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \ - "${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 + "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 fi done fi @@ -5439,13 +5439,13 @@ install_suse_11_stable_post() { if [ -f /bin/systemctl ]; then # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ + curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \ -o "/lib/systemd/system/salt-$fname.service" || return 1 continue fi # shellcheck disable=SC2086 - curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ + curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ -o "/etc/init.d/salt-$fname" || return 1 chmod +x "/etc/init.d/salt-$fname" From e11ffc701a22f6ecea0a9ae06efb971d678781e9 Mon Sep 17 00:00:00 2001 From: rallytime Date: Tue, 12 Apr 2016 14:34:32 -0600 Subject: [PATCH 133/156] Update new https references to HTTP_VAL where appropriate --- bootstrap-salt.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 99a19f0..7edbe3b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1207,7 +1207,7 @@ __set_suse_pkg_repo() { # FIXME: cleartext download over unsecure protocol (HTTP) suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" else - suse_pkg_url_base="https://repo.saltstack.com/opensuse" + suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse" fi SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path" } @@ -2602,7 +2602,7 @@ install_debian_8_deps() { # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then - SALTSTACK_DEBIAN_URL="https://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" + SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" # shellcheck disable=SC2086 @@ -2856,7 +2856,7 @@ install_debian_git_post() { 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" else - __fetch_url "/etc/init.d/salt-$fname" "https://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" + __fetch_url "/etc/init.d/salt-$fname" "${HTTP_VAL}://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi if [ ! -f "/etc/init.d/salt-$fname" ]; then echowarn "The init script for salt-$fname was not found, skipping it..." @@ -3130,12 +3130,12 @@ __install_epel_repository() { rpm -q curl > /dev/null 2>&1 || yum -y install curl # rpm from CentOS/RHEL release 5 does not support HTTP downloads # properly, especially 3XX code redirects - __fetch_url /tmp/epel-release.rpm "https://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 + __fetch_url /tmp/epel-release.rpm "${HTTP_VAL}://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 rpm -Uvh --force /tmp/epel-release.rpm || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then - rpm -Uvh --force "https://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 + rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then - rpm -Uvh --force "https://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1 + rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1 else echoerror "Failed add EPEL repository support." return 1 From a8d8d3f87aed534968541c5cc7795704a3ee8da1 Mon Sep 17 00:00:00 2001 From: Robert James Hernandez Date: Mon, 11 Apr 2016 15:27:04 -0700 Subject: [PATCH 134/156] Ubuntu support for virtualenvs --- bootstrap-salt.sh | 185 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 164 insertions(+), 21 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7edbe3b..5be5b1b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -26,6 +26,8 @@ __ScriptName="bootstrap-salt.sh" #---------------------------------------------------------------------------------------------------------------------- # * BS_COLORS: If 0 disables colour support # * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed) +# * BS_PIP_ALL: If 1 enable all python packages to be installed via pip instead of apt, requires setting virtualenv +# * BS_VIRTUALENV_DIR: The virtualenv to install salt into (shouldn't exist yet) # * BS_ECHO_DEBUG: If 1 enable debug echo which can also be set by -D # * BS_SALT_ETC_DIR: Defaults to /etc/salt (Only tweak'able on git based installations) # * BS_SALT_CACHE_DIR: Defaults to /var/cache/salt (Only tweak'able on git based installations) @@ -197,10 +199,12 @@ _INSTALL_MASTER=$BS_FALSE _INSTALL_SYNDIC=$BS_FALSE _INSTALL_MINION=$BS_TRUE _INSTALL_CLOUD=$BS_FALSE +_VIRTUALENV_DIR=${BS_VIRTUALENV_DIR:-"null"} _START_DAEMONS=$BS_TRUE _ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE} _CONFIG_ONLY=$BS_FALSE _PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE} +_PIP_ALL=${BS_PIP_ALL:-$BS_FALSE} _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt} _SALT_CACHE_DIR=${BS_SALT_CACHE_DIR:-/var/cache/salt} _PKI_DIR=${_SALT_ETC_DIR}/pki @@ -322,12 +326,16 @@ __usage() { This may result in an "n/a" in the version number. -l Disable ssl checks. When passed, switches "https" calls to "http" where possible. + -V Install salt into virtualenv(Only available for Ubuntu base distributions) + -a Pip install all python pkg dependencies for salt. Requires -V to install + all pip pkgs into the virtualenv(Only available for Ubuntu base + distributions) EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbfl" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:a" opt do case "${opt}" in @@ -367,7 +375,6 @@ do exit 1 fi ;; - s ) _SLEEP=$OPTARG ;; M ) _INSTALL_MASTER=$BS_TRUE ;; S ) _INSTALL_SYNDIC=$BS_TRUE ;; @@ -389,6 +396,8 @@ do b ) _NO_DEPS=$BS_TRUE ;; f ) _FORCE_SHALLOW_CLONE=$BS_TRUE ;; l ) _DISABLE_SSL=$BS_TRUE ;; + V ) _VIRTUALENV_DIR="$OPTARG" ;; + a ) _PIP_ALL=$BS_TRUE ;; \?) echo echoerror "Option does not exist : $OPTARG" @@ -483,6 +492,18 @@ elif [ "$ITYPE" = "stable" ]; then fi fi +# -a and -V only work from git +if [ "$ITYPE" != "git" ]; then + if [ $_PIP_ALL -eq $BS_TRUE ]; then + echoerror "Pip installing all python packages with -a is only possible when installing salt via git" + exit 1 + fi + if [ $_VIRTUALENV_DIR != "null" ]; then + echoerror "Virtualenv installs via -V is only possible when installing salt via git" + exit 1 + fi +fi + # Check for any unparsed arguments. Should be an error. if [ "$#" -gt 0 ]; then __check_unparsed_options "$*" @@ -532,6 +553,20 @@ if [ ${_DISABLE_SALT_CHECKS} -eq 0 ]; then echowarn "Found file: /tmp/disable_salt_checks, setting \$_DISABLE_SALT_CHECKS=true" fi +# Because -a can only be installed into virtualenv +if ([ $_PIP_ALL -eq $BS_TRUE ] && [ $_VIRTUALENV_DIR = "null" ]); then + usage + # Could possibly set up a default virtualenv location when -a flag is passed + echoerror "Using -a requires -V because pip pkgs should be siloed from python system pkgs" + exit 1 +fi + +# Make sure virtualenv directory does not already exist +if [ -d "$_VIRTUALENV_DIR" ]; then + echoerror "The directory ${_VIRTUALENV_DIR} for virtualenv already exists" + exit 1 +fi + echoinfo "${CALLER} ${0} -- Version ${__ScriptVersion}" echowarn "Running the unstable version of ${__ScriptName}" @@ -1312,6 +1347,17 @@ if [ "${ITYPE}" = "testing" ]; then _EPEL_REPO="epel-testing" fi +# Only Ubuntu has support for installing to virtualenvs +if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$_VIRTUALENV_DIR" != "null" ]); then + echoerror "${DISTRO_NAME} does not have -V support" + exit 1 +fi + +# Only Ubuntu has support for pip installing all packages +if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]);then + echoerror "${DISTRO_NAME} does not have -a support" + exit 1 +fi #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __function_defined # DESCRIPTION: Checks if a function is defined within this scripts scope @@ -1876,6 +1922,76 @@ __check_services_openbsd() { } # ---------- end of function __check_services_openbsd ---------- +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __create_virtualenv +# DESCRIPTION: Return 0 or 1 depending on successful creation of virtualenv +#---------------------------------------------------------------------------------------------------------------------- +__create_virtualenv() { + if [ ! -d "$_VIRTUALENV_DIR" ]; then + echoinfo "Creating virtualenv ${_VIRTUALENV_DIR}" + if [ $_PIP_ALL -eq $BS_TRUE ]; then + virtualenv --no-site-packages ${_VIRTUALENV_DIR} || return 1 + else + virtualenv --system-site-packages ${_VIRTUALENV_DIR} || return 1 + fi + fi + return 0 +} # ---------- end of function __create_virtualenv ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __activate_virtualenv +# DESCRIPTION: Return 0 or 1 depending on successful activation of virtualenv +#---------------------------------------------------------------------------------------------------------------------- +__activate_virtualenv() { + set +o nounset + # Is virtualenv empty + if [ -z "$VIRTUAL_ENV" ]; then + __create_virtualenv || return 1 + . ${_VIRTUALENV_DIR}/bin/activate || return 1 + echoinfo "Activated virtualenv ${_VIRTUALENV_DIR}" + fi + set -o nounset + return 0 +} # ---------- end of function __activate_virtualenv ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __install_pip_deps +# DESCRIPTION: Return 0 or 1 if successfully able to install pip packages via requirements file +# PARAMETERS: requirements_files +#---------------------------------------------------------------------------------------------------------------------- +__install_pip_deps() { + # Install virtualenv to system pip before activating virtualenv if thats going to be used + # We assume pip pkg is installed since that is distro specific + if [ "$_VIRTUALENV_DIR" != "null" ]; then + if [ "$(which pip)" = "" ]; then + echoerror "Pip not installed: required for -a installs" + exit 1 + fi + pip install -U virtualenv + __activate_virtualenv || return 1 + else + echoerror "Must have virtualenv dir specified for -a installs" + fi + + requirements_file=$1 + if [ ! -f "${requirements_file}" ]; then + echoerror "Requirements file: ${requirements_file} cannot be found, needed for -a (pip pkg) installs" + exit 1 + fi + + __PIP_PACKAGES='' + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + # shellcheck disable=SC2089 + __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" + fi + + # shellcheck disable=SC2086,SC2090 + pip install -U -r ${requirements_file} ${__PIP_PACKAGES} +} + + ####################################################################################################################### # # Distribution install functions @@ -2039,16 +2155,18 @@ install_ubuntu_deps() { # Minimal systems might not have upstart installed, install it __PACKAGES="upstart" + if [ "$_VIRTUALENV_DIR" != "null" ]; then + __PACKAGES="${__PACKAGES} python-virtualenv" + fi # Need python-apt for managing packages via Salt __PACKAGES="${__PACKAGES} python-apt" # requests is still used by many salt modules __PACKAGES="${__PACKAGES} python-requests" - # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" - if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then __check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" if ! __check_command_exists pip; then @@ -2064,6 +2182,9 @@ install_ubuntu_deps() { if [ "${__PIP_PACKAGES}" != "" ]; then # shellcheck disable=SC2086,SC2090 + if [ "$_VIRTUALENV_DIR" != "null" ]; then + __activate_virtualenv + fi pip install -U ${__PIP_PACKAGES} fi @@ -2127,6 +2248,7 @@ install_ubuntu_stable_deps() { install_ubuntu_daily_deps() { install_ubuntu_deps || return 1 + if [ "$DISTRO_MAJOR_VERSION" -ge 12 ]; then # Above Ubuntu 11.10 add-apt-repository is in a different package __apt_get_install_noinput software-properties-common || return 1 @@ -2154,25 +2276,37 @@ install_ubuntu_daily_deps() { } install_ubuntu_git_deps() { - install_ubuntu_deps || return 1 - __apt_get_install_noinput git-core python-yaml python-m2crypto python-crypto \ - msgpack-python python-zmq python-jinja2 || return 1 - + __apt_get_install_noinput git-core || return 1 __git_clone_and_checkout || return 1 __PACKAGES="" - if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" - if [ "${__REQUIRED_TORNADO}" != "" ]; then - __PACKAGES="${__PACKAGES} python-dev" - __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" - if ! __check_command_exists pip; then - __PACKAGES="${__PACKAGES} python-setuptools python-pip" + # See how we are installing packages + if [ ${_PIP_ALL} -eq $BS_TRUE ]; then + __PACKAGES="python-dev swig libssl-dev libzmq3 libzmq3-dev" + if ! __check_command_exists pip; then + __PACKAGES="${__PACKAGES} python-setuptools python-pip" + fi + # Get just the apt packages that are required to build all the pythons + __apt_get_install_noinput $__PACKAGES || return 1 + # Install the pythons from requirements (only zmq for now) + __install_pip_deps "${_SALT_GIT_CHECKOUT_DIR}/requirements/zeromq.txt" || return 1 + else + install_ubuntu_deps || return 1 + __apt_get_install_noinput python-yaml python-m2crypto python-crypto \ + msgpack-python python-zmq python-jinja2 || return 1 + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then + # We're on the develop branch, install whichever tornado is on the requirements file + __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + if [ "${__REQUIRED_TORNADO}" != "" ]; then + __PACKAGES="${__PACKAGES} python-dev" + check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" + if ! __check_command_exists pip; then + __PACKAGES="${__PACKAGES} python-setuptools python-pip" + fi + # shellcheck disable=SC2086 + __apt_get_install_noinput $__PACKAGES || return 1 + pip install -U "${__REQUIRED_TORNADO}" fi - # shellcheck disable=SC2086 - __apt_get_install_noinput $__PACKAGES - pip install -U "${__REQUIRED_TORNADO}" fi fi @@ -2207,6 +2341,11 @@ install_ubuntu_daily() { } install_ubuntu_git() { + # Activate virtualenv before install + if [ "${_VIRTUALENV_DIR}" != "null" ]; then + __activate_virtualenv || return 1 + fi + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --install-layout=deb || return 1 else @@ -2242,6 +2381,10 @@ install_ubuntu_git_post() { 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" + # Set service to know about virtualenv + if [ "${_VIRTUALENV_DIR}" != "null" ]; then + echo "SALT_USE_VIRTUALENV=${_VIRTUALENV_DIR}" > /etc/default/salt-${fname} + fi /sbin/initctl reload-configuration || return 1 fi # No upstart support in Ubuntu!? @@ -2256,7 +2399,7 @@ install_ubuntu_git_post() { update-rc.d salt-$fname defaults else - echoerror "Neither upstart not init.d was setup for salt-$fname" + echoerror "Neither upstart nor init.d was setup for salt-$fname" fi done } @@ -2470,7 +2613,7 @@ _eof apt-get update || return 1 # Python requests is available through Squeeze backports - # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __apt_get_install_noinput python-pip procps pciutils python-requests # Need python-apt for managing packages via Salt From 36939b0dcb8c65890ad1009afef57a623c3a2944 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Apr 2016 02:52:10 -0600 Subject: [PATCH 135/156] fixup lint --- bootstrap-salt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5be5b1b..1f90400 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -498,7 +498,7 @@ if [ "$ITYPE" != "git" ]; then echoerror "Pip installing all python packages with -a is only possible when installing salt via git" exit 1 fi - if [ $_VIRTUALENV_DIR != "null" ]; then + if [ "$_VIRTUALENV_DIR" != "null" ]; then echoerror "Virtualenv installs via -V is only possible when installing salt via git" exit 1 fi @@ -554,7 +554,7 @@ if [ ${_DISABLE_SALT_CHECKS} -eq 0 ]; then fi # Because -a can only be installed into virtualenv -if ([ $_PIP_ALL -eq $BS_TRUE ] && [ $_VIRTUALENV_DIR = "null" ]); then +if ([ $_PIP_ALL -eq $BS_TRUE ] && [ "$_VIRTUALENV_DIR" = "null" ]); then usage # Could possibly set up a default virtualenv location when -a flag is passed echoerror "Using -a requires -V because pip pkgs should be siloed from python system pkgs" @@ -1930,9 +1930,9 @@ __create_virtualenv() { if [ ! -d "$_VIRTUALENV_DIR" ]; then echoinfo "Creating virtualenv ${_VIRTUALENV_DIR}" if [ $_PIP_ALL -eq $BS_TRUE ]; then - virtualenv --no-site-packages ${_VIRTUALENV_DIR} || return 1 + virtualenv --no-site-packages "${_VIRTUALENV_DIR}" || return 1 else - virtualenv --system-site-packages ${_VIRTUALENV_DIR} || return 1 + virtualenv --system-site-packages "${_VIRTUALENV_DIR}" || return 1 fi fi return 0 @@ -1948,7 +1948,7 @@ __activate_virtualenv() { # Is virtualenv empty if [ -z "$VIRTUAL_ENV" ]; then __create_virtualenv || return 1 - . ${_VIRTUALENV_DIR}/bin/activate || return 1 + . "${_VIRTUALENV_DIR}/bin/activate" || return 1 echoinfo "Activated virtualenv ${_VIRTUALENV_DIR}" fi set -o nounset @@ -2185,7 +2185,7 @@ install_ubuntu_deps() { if [ "$_VIRTUALENV_DIR" != "null" ]; then __activate_virtualenv fi - pip install -U ${__PIP_PACKAGES} + pip install -U "${__PIP_PACKAGES}" fi if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then @@ -2287,7 +2287,7 @@ install_ubuntu_git_deps() { __PACKAGES="${__PACKAGES} python-setuptools python-pip" fi # Get just the apt packages that are required to build all the pythons - __apt_get_install_noinput $__PACKAGES || return 1 + __apt_get_install_noinput "$__PACKAGES" || return 1 # Install the pythons from requirements (only zmq for now) __install_pip_deps "${_SALT_GIT_CHECKOUT_DIR}/requirements/zeromq.txt" || return 1 else From 737962f4e850669499412b49076a3b07647a8c03 Mon Sep 17 00:00:00 2001 From: Ken Erwin Date: Wed, 13 Apr 2016 12:46:36 -0400 Subject: [PATCH 136/156] Fixed script to use latest version automatically --- bootstrap-salt.ps1 | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 0ea731b..4bf26f9 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -1,27 +1,34 @@ <# .SYNOPSIS A simple Powershell script to download and install a salt minion on windows. + .DESCRIPTION The script will download the official salt package from saltstack. It will install a specific package version and accept parameters for the master and minion ids. Finally, it can stop and set the windows service to "manual" for local testing. + .EXAMPLE ./bootstrap-salt.ps1 Runs without any parameters. Uses all the default values/settings. + .EXAMPLE ./bootstrap-salt.ps1 -version 2015.4.1-3 Specifies a particular version of the installer. + .EXAMPLE ./bootstrap-salt.ps1 -runservice false Specifies the salt-minion service to stop and be set to manual. Useful for testing locally from the command line with the --local switch + .EXAMPLE ./bootstrap-salt.ps1 -minion minion-box -master master-box Specifies the minion and master ids in the minion config. Defaults to the installer values of "minion" and "master". + .EXAMPLE ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false Specifies all the optional parameters in no particular order. + .PARAMETER version - Default version defined in this script. .PARAMETER runservice - Boolean flag to stop the windows service and set to "manual". @@ -47,7 +54,7 @@ Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "YYYY.M.R-B" [ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')] - [string]$version = "2015.8.8-2", + [string]$version = '', [Parameter(Mandatory=$false,ValueFromPipeline=$true)] [ValidateSet("true","false")] @@ -99,15 +106,33 @@ If ([IntPtr]::Size -eq 4) { $arch = "AMD64" } +# If version isn't supplied, use latest. +if (!$version) { + # Find latest version of Salt Minion + $repo = Invoke-Restmethod 'http://repo.saltstack.com/windows/' + $regex = "<\s*a\s*[^>]*?href\s*=\s*[`"']*([^`"'>]+)[^>]*?>" + $returnMatches = new-object System.Collections.ArrayList + $resultingMatches = [Regex]::Matches($repo, $regex, "IgnoreCase") + foreach($match in $resultingMatches) + { + $cleanedMatch = $match.Groups[1].Value.Trim() + [void] $returnMatches.Add($cleanedMatch) + } + if ($arch -eq 'x86') {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"}} + else {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"}} + + $version = $(($returnMatches | Sort-Object -Descending)[0]).Split('-')[2] +} + # Download minion setup file -Write-Host -NoNewline "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" +Write-Output -NoNewline "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" $webclient = New-Object System.Net.WebClient $url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe" $file = "C:\tmp\salt.exe" $webclient.DownloadFile($url, $file) # Install minion silently -Write-Host -NoNewline "Installing Salt minion" +Write-Output -NoNewline "Installing Salt minion" #Wait for process to exit before continuing. C:\tmp\salt.exe /S /minion-name=$minion /master=$master | Out-Null @@ -141,14 +166,14 @@ If($runservice) { # If the salt-minion service is still not running, something probably # went wrong and user intervention is required - report failure. If ($service.Status -eq "Stopped") { - Write-Host -NoNewline "Failed to start salt minion" + Write-Output -NoNewline "Failed to start salt minion" exit 1 } } Else { - Write-Host -NoNewline "Stopping salt minion and setting it to 'Manual'" + Write-Output -NoNewline "Stopping salt minion and setting it to 'Manual'" Set-Service "salt-minion" -startupType "Manual" Stop-Service "salt-minion" } -Write-Host -NoNewline "Salt minion successfully installed" +Write-Output "Salt minion successfully installed" \ No newline at end of file From e4829148f5eaf3c8b95b8d8262f2dcd8a301d4fb Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Apr 2016 12:58:34 -0600 Subject: [PATCH 137/156] install https transport for debian --- bootstrap-salt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1f90400..c9eab72 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2751,7 +2751,9 @@ install_debian_8_deps() { # shellcheck disable=SC2086 wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 - __apt_get_install_noinput apt-transport-https || return 1 + if [ "${HTTP_VAL}" = "https" ] ; then + __apt_get_install_noinput apt-transport-https || return 1 + fi fi apt-get update || return 1 From 0c3e7e9bd280cd218efdabdc0b0550c1c348ab46 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Apr 2016 13:11:04 -0600 Subject: [PATCH 138/156] disable source shellcheck --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index c9eab72..e7715f6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1948,6 +1948,7 @@ __activate_virtualenv() { # Is virtualenv empty if [ -z "$VIRTUAL_ENV" ]; then __create_virtualenv || return 1 + # shellcheck source=/dev/null . "${_VIRTUALENV_DIR}/bin/activate" || return 1 echoinfo "Activated virtualenv ${_VIRTUALENV_DIR}" fi From d7d45853b33764d0594d91528913e13ad813a815 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Apr 2016 13:54:36 -0600 Subject: [PATCH 139/156] use portable command check Similar to 993e9959. --- bootstrap-salt.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e7715f6..ff6d30b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1966,7 +1966,7 @@ __install_pip_deps() { # Install virtualenv to system pip before activating virtualenv if thats going to be used # We assume pip pkg is installed since that is distro specific if [ "$_VIRTUALENV_DIR" != "null" ]; then - if [ "$(which pip)" = "" ]; then + if __check_command_exists pip; then echoerror "Pip not installed: required for -a installs" exit 1 fi @@ -4763,7 +4763,7 @@ install_openbsd_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ] && continue + [ $fname = "api" ] || ! __check_command_exists "salt-${fname}" && continue [ $fname = "syndic" ] && continue if [ $? -eq 1 ]; then @@ -4867,8 +4867,7 @@ install_smartos_deps() { install_smartos_git_deps() { install_smartos_deps || return 1 - which git > /dev/null 2>&1 - if [ $? -eq 1 ]; then + if ! __check_command_exists git; then pkgin -y install git || return 1 fi @@ -5318,7 +5317,7 @@ install_suse_12_stable_deps() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Syndic uses the same configuration file as the master @@ -5346,7 +5345,7 @@ install_suse_12_stable_deps() { install_suse_12_git_deps() { install_suse_11_stable_deps || return 1 - if [ "$(which git)" = "" ]; then + if ! __check_command_exists git; then __zypper_install git || return 1 fi @@ -5394,7 +5393,7 @@ install_suse_12_stable_post() { # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue + [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then From b2b315bf094df010f3894080cd2509251d897294 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 13 Apr 2016 14:04:00 -0600 Subject: [PATCH 140/156] fix pip check logic (#807) --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ff6d30b..5f0f916 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1966,7 +1966,7 @@ __install_pip_deps() { # Install virtualenv to system pip before activating virtualenv if thats going to be used # We assume pip pkg is installed since that is distro specific if [ "$_VIRTUALENV_DIR" != "null" ]; then - if __check_command_exists pip; then + if ! __check_command_exists pip; then echoerror "Pip not installed: required for -a installs" exit 1 fi From 71f1e0bce3eae67e2c3694f1a036c7ac661278db Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 15 Apr 2016 13:32:42 -0600 Subject: [PATCH 141/156] workaround packages for non-LTS ubuntu --- bootstrap-salt.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f0f916..8d74ec1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2156,6 +2156,9 @@ install_ubuntu_deps() { # Minimal systems might not have upstart installed, install it __PACKAGES="upstart" + if [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + __PACKAGES="${__PACKAGES} python2.7" + fi if [ "$_VIRTUALENV_DIR" != "null" ]; then __PACKAGES="${__PACKAGES} python-virtualenv" fi @@ -2214,17 +2217,29 @@ install_ubuntu_stable_deps() { # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then - # Saltstack's Stable Ubuntu repository + # Workaround for latest non-LTS ubuntu + if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then + echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems" + UBUNTU_VERSION=14.04 + UBUNTU_CODENAME=trusty + else + UBUNTU_VERSION=$DISTRO_VERSION + UBUNTU_CODENAME=$DISTRO_CODENAME + fi + + # SaltStack's stable Ubuntu repository + SALTSTACK_UBUNTU_URL="${HTTP_VAL}://repo.saltstack.com/apt/ubuntu/$UBUNTU_VERSION/$repo_arch/$STABLE_REV" if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" > \ - "/etc/apt/sources.list.d/saltstack.list" + set +o nounset + echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list" + set -o nounset fi # Make sure wget is available __apt_get_install_noinput wget # shellcheck disable=SC2086 - wget $_WGET_ARGS -q $HTTP_VAL://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + wget $_WGET_ARGS -q $SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 From 3962b84dd3571082d94eb29aa9a504b3529186f4 Mon Sep 17 00:00:00 2001 From: RuriRyan Date: Mon, 18 Apr 2016 17:19:17 +0200 Subject: [PATCH 142/156] Update epel-release version number (#810) The new epel version breaks the vagrant salt provisioner, because it uses the bootstrap script. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f0f916..e94b2d6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3281,7 +3281,7 @@ __install_epel_repository() { elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then - rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-5.noarch.rpm" || return 1 + rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-6.noarch.rpm" || return 1 else echoerror "Failed add EPEL repository support." return 1 From e31d7f4495130ff681d150e9712ea71ebcfa62b5 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 18 Apr 2016 18:46:36 +0300 Subject: [PATCH 143/156] Fix Amazon Linux EOL check --- bootstrap-salt.sh | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e94b2d6..b33aeef 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1588,6 +1588,16 @@ __check_end_of_life_versions() { fi ;; + amazon*linux*ami) + # Amazon Linux versions lower than 2012.0X no longer supported + if [ "$DISTRO_MAJOR_VERSION" -lt 2012 ]; then + echoerror "End of life distributions are not supported." + echoerror "Please consider upgrading to the next stable. See:" + echoerror " https://aws.amazon.com/amazon-linux-ami/" + exit 1 + fi + ;; + freebsd) # FreeBSD versions lower than 9.1 are not supported. if ([ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then @@ -3991,23 +4001,6 @@ install_scientific_linux_check_services() { # Amazon Linux AMI Install Functions # -# FIXME: 2010.xx releases are no longer avaliable: https://aws.amazon.com/amazon-linux-ami/ -# Need to add amazon case to __check_end_of_life_versions - -install_amazon_linux_ami_2010_deps() { - # Linux Amazon AMI 2010.xx seems to use EPEL5 but the system is based on CentOS6. - # Supporting this would be quite troublesome and we need to workaround some serious package conflicts - echoerror "Amazon Linux AMI 2010 is not supported. Please use a more recent image (Amazon Linux AMI >= 2011.xx)" - exit 1 -} - -install_amazon_linux_ami_2010_git_deps() { - # Linux Amazon AMI 2010.xx seems to use EPEL5 but the system is based on CentOS6. - # Supporting this would be quite troublesome and we need to workaround some serious package conflicts - echoerror "Amazon Linux AMI 2010 is not supported. Please use a more recent image (Amazon Linux AMI >= 2011.xx)" - exit 1 -} - install_amazon_linux_ami_deps() { # enable the EPEL repo /usr/bin/yum-config-manager --enable epel || return 1 From ad2c35abfdabf714bbab0585d32249a812a34504 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 18 Apr 2016 04:03:38 -0600 Subject: [PATCH 144/156] update AUTHORS.rst for new release --- AUTHORS.rst | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index fc3b023..84b7410 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -7,12 +7,16 @@ order. ========================== ===================== ============================ Name Nick Email ========================== ===================== ============================ +abednarik abednarik alejandro.bednarik@gmail.com +Adam Wright hipikat adam@hipikat.org Alec Koumjian akoumjian akoumjian@gmail.com Alex Van't Hof alexvh Angelo Gründler plueschopath angelo.gruendler@w1r3.net Ari Aosved devaos ari.aosved@gmail.com +Beau Hargis beaucephus beau@customermobile.com Boris Feld Lothiraldan Brad Thurber bradthurber +Brandon Clifford brandon099 brandon.clifford@vivint.com Bret Fisher BretFisher bret@fishbrains.com bruce-one bruce-one C. R. Oldham cro cr@saltstack.com @@ -20,6 +24,7 @@ Cam camereonsparr Chris Rebert cvrebert chris.rebert@hulu.com Chris Buechler cbuechler cmb@pfsense.org Christer Edwards cedwards +Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com Dag Viggo Lokøen dagvl dag.viggo@lokoen.org Dan Mick dmick dan.mick@inktank.com David J. Felix DavidJFelix @@ -34,6 +39,7 @@ EYJ eyj Forrest Alvarez gravyboat Fred Reimer freimer freimer@freimer.org Geoff Garside geoffgarside geoff@geoffgarside.co.uk +gdm85 gdm85 ggillies ggillies Giuseppe Iannello giannello giuseppe.iannello@brokenloop.net Gregory Meno GregMeno gregory.meno@inktank.com @@ -41,26 +47,32 @@ Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be gweis gweis Henrik Holmboe holmboe Howard Mei HowardMei howardleomei@gmail.com +Jared E Stroud jaredestroud jaredestroud@gmail.com Jeff Hui jeffh jeff@jeffhui.net Jeff Strunk jstrunk Juan A. Moyano wincus wincus.public@gmail.com +Justin Anderson jtand janderson@saltstack.com +Justin Findlay jfindlay jfindlay@gmail.com Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke lomeroe lomeroe Liu Xiaohui oreh herolxh@gmail.com Mark Lee malept +Marcus Furlong furlongm furlongm@gmail.com markgaylard markgaylard Matt Black mafrosis Matthew Garrett cingeyedog matt@clemson.edu Matthew Mead-Briggs mattmb Matthew Willson ixela Matthieu Guegan mguegan +Michael A. Smith kojiromike michaels@syapse.com Michael Scherer mscherer Michele Bologna mbologna michele.bologna@gmail.com Mike Carlson m87carlson mike@bayphoto.com Mike Place cachedout mp@saltstack.com nevins-b nevins-b -Niels Abspoel aboe76 +Nicole Thomas rallytime nicole@saltstack.com +Niels Abspoel aboe76 aboe76@gmail.com Nitin Madhok nmadhok nmadhok@clemson.edu panticz panticz Paul Brian lifeisstillgood paul@mikadosoftware.com @@ -68,18 +80,26 @@ Pavel Snagovsky paha Pedro Algarvio s0undt3ch pedro@algarvio.me Pedro Paulo pedropaulovc Peter Tripp notpeter +Prayag Verma pra85 prayag.verma@gmail.com ptonelli ptonelli +Randy Thompson beardedeagle randy@heroictek.com Raymond Barbiero visualphoenix Rob Eden hedinfaok +Robert James Hernandez l2ol33rt l2ol33rt@gmail.com Roberto Aguilar rca roberto@baremetal.io Roman Inflianskas rominf infroma@gmail.com +Roman Mohr rmohr rmohr@redhat.com Ronald van Zantvoort The-Loeki ronald@pcextreme.nl +RuriRyan RuriRyan ryan@btsoft.eu +Ryan Walder ryanwalder ryanwalder@ucds.email Sergey Paramonov serge-p serg.paramonov@s-vp.com +Shawn Butts shawnbutts Skyler Berg skylerberg skylertheberg@gmail.com Stanislav B stanislavb -Steve Groesz wolfpackmars2 +Steve Groesz wolfpackmars2 wolfpackmars2@yahoo.com Tate Eskew tateeskew Thomas S. Hatch thatch45 thatch45@saltstack.com +Tobias Jungel toanju Tobias.Jungel@gmail.com Tony Narlock tony Valentin Bud valentinbud valentin@databus.pro Vladimir Kozhukalov kozhukalov From baa54a64112536a0eac684e4aec9813bc71b6c14 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 18 Apr 2016 10:21:53 -0600 Subject: [PATCH 145/156] workaround start services for non-LTS ubuntu --- bootstrap-salt.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8d74ec1..e1817ae 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2370,6 +2370,36 @@ install_ubuntu_git() { return 0 } +install_ubuntu_stable_post() { + # Workaround for latest LTS packages on latest ubuntu. Normally packages on + # debian-based systems will automatically start the corresponding daemons + if [ "$DISTRO_MAJOR_VERSION" -ne 15 ]; then + return 0 + fi + + for fname in minion master syndic api; do + # Skip if not meant to be installed + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + if [ -f /bin/systemctl ]; then + # Using systemd + /bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || ( + /bin/systemctl preset salt-$fname.service > /dev/null 2>&1 && + /bin/systemctl enable salt-$fname.service > /dev/null 2>&1 + ) + sleep 0.1 + /usr/bin/systemctl daemon-reload + elif [ -f /etc/init.d/salt-$fname ]; then + update-rc.d salt-$fname defaults + fi + done +} install_ubuntu_git_post() { for fname in minion master syndic api; do From d58a5fd2a60a081f7f60bc0abdc342aaf8615c77 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 18 Apr 2016 11:15:27 -0600 Subject: [PATCH 146/156] add issue and pull request templates (#811) --- .github/ISSUE_TEMPLATE.md | 11 +++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..02ede22 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,11 @@ +### Description of Issue/Question + +### Setup +(Please provide relevant configs (Be sure to remove sensitive info).) + +### Steps to Reproduce Issue +(Include debug logs if possible, `bootstrap-salt.sh -D`.) + +### Versions and Systems +(`salt --versions-report`, `bootstrap-salt.sh -v`, system type and version, +cloud/VM provider as appropriate.) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4d38780 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +### What does this PR do? + +### What issues does this PR fix or reference? + +### Previous Behavior +Remove this section if not relevant + +### New Behavior +Remove this section if not relevant + +### Tests written? + +Yes/No From fccd01e4de649c954c33d83ff16494a22d228eb2 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 18 Apr 2016 09:59:31 -0600 Subject: [PATCH 147/156] update ChangeLog for new release --- ChangeLog | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4adc5b8..5b7fcbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,56 @@ -Version 2015.xx.xx: +Version 2016.04.18: * Add support for openSUSE Leap. Thanks Roman Inflianskas(rominf). #693 * Fix missing deps installation on Debian. Thanks Steve Groesz(wolfpackmars2). #699 + * Update SaltStack repo location and latest version for Windows. (brandon099) #711 + * Better EPEL repository detection on RHEL and CentOS. (vutny) #717 + * Fix git invocation fail when `man` command is not available. (vutny) #718 + * Fix `epel-release` package installation on CentOS/RHEL 5. (vutny) #719 + * Removed deprecated cli option. (abednarik) #705 + * Remove RHEL optional repo check and enable. (vutny) #720 + * Remove SaltStack COPR repository configuration for CentOS/RHEL5. (vutny) #721 + * Add opensuse_Tumbleweed support. (aboe76) #725 + * Sometimes bootstrap doesn't install zmq. (jtand) #726 + * Process -s (default sleep for service restarts) in bootstrap-salt.sh. (hipikat) #692 + * Minion keys and /etc/salt/minion should be overwritten on -C. (cro) #541 + * Fix for -C (_CONFIG_ONLY). (beaucephus) #544 + * Fix when using upstream tags. (The-Loeki) #564 + * COPR project moved. (rmohr) #738 + * Update license year range. (pra85) #743 + * Use POSIX-Compliant Command-Exists Test. (kojiromike) #741 + * Add -f option to force shallow cloning. (eyj) #660 + * add SLE 12 support, fix OpenSUSE support. (grep4linux) #748 + * Fix CentOS git setup.py syntax error upon installation. (The-Loeki) #746 + * Enable shallow cloning for version branches by default, not only tags. (vutny) #750 + * do not install copr repo on fedora 22+. (toanju) #751 + * Add support for pegged versions on YUM based OS'ses through repo.saltstack.com. (The-Loeki) #685 + * fix for FreeBSD 11 CURRENT install functions. (serge-p) #723 + * Don't add zypp repo if it already exists. (furlongm) #731 + * switch repositories for suse and sles fixes `#706`_. (aboe76) #734 + * Reformat and correct usage instructions. (vutny) #755 + * fixed missing repo for suse 12. (aboe76) #756 + * fix for Amazon Linux. (shawnbutts) #700 + * adding support for OpenBSD distribution. (serge-p) #722 + * fixing syntax errors. (beardedeagle) #760 + * Import CentOS 7 GPG key on RHEL for installing base dependencies from Salt corp repo. (vutny) #765 + * Fix multiple lint errors (shellcheck) and make some refactoring. (vutny) #768 + * Fix sleep time option to recognize a numeric argument. (vutny) #771 + * Update README. (vutny) #787 + * get tornado from pip on a fedora git install. (jfindlay) #785 + * Remove the Saltstack repo's alias. (cro) #794 + * Ability to change cache dir. (clarkperkins) #761 + * Add config_freebsd_salt func so freebsd puts cfgs in the right place. (ryanwalder) #779 + * Allow archive versions. (clarkperkins) #769 + * Lack of HTTPS for RPM packages. (jaredestroud) #783 + * Ability to change cache dir. (clarkperkins) #761 + * Bootstrap on Docker. (vutny) #793 + * add downstream pkg repo for SUSE. (jfindlay) #791 + * Fixed use of HTTP over HTTPS for anonscm.debian.org. (gdm85) #788 + * Bump Salt version to latest stable in PS bootstrap script for Windows. (vutny) #801 + * Add an -l option to switch https to http links. (rallytime) #795 + * Virtualenv support for Ubuntu. (l2ol33rt) #666 + * Lint. (jfindlay) #805 + * use portable command check. (jfindlay) #806 + * Update epel-release version number (RuriRyan) #809 Version 2015.11.09 @@ -431,5 +481,5 @@ Version 1.5: * FreeBSD 9.0 -# Don't remove the line bellow. +# Don't remove the line below. # vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want ts=4 From 26a73ff8fe8812653fc9b2b6a804948d27f05963 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Mon, 18 Apr 2016 10:15:20 -0600 Subject: [PATCH 148/156] update ScriptVersion for new release --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f0f916..a4663fc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.03.10" +__ScriptVersion="2016.04.18" __ScriptName="bootstrap-salt.sh" #====================================================================================================================== From 41121f8254db1a7c4fc8201a58857049dc8f91f5 Mon Sep 17 00:00:00 2001 From: rallytime Date: Mon, 18 Apr 2016 11:57:24 -0600 Subject: [PATCH 149/156] Add an option (-r) to disable repository configuration --- bootstrap-salt.sh | 355 ++++++++++++++++++++++++++-------------------- 1 file changed, 199 insertions(+), 156 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8c90ee6..83be1a1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -231,6 +231,7 @@ _SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt} _NO_DEPS=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE _DISABLE_SSL=$BS_FALSE +_DISABLE_REPOS=$BS_FALSE #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -330,12 +331,15 @@ __usage() { -a Pip install all python pkg dependencies for salt. Requires -V to install all pip pkgs into the virtualenv(Only available for Ubuntu base distributions) + -r Disable all repository configuration performed by this script. This + option assumes all necessary repository configuration is already present + on the system. EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:a" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:ar" opt do case "${opt}" in @@ -398,6 +402,7 @@ do l ) _DISABLE_SSL=$BS_TRUE ;; V ) _VIRTUALENV_DIR="$OPTARG" ;; a ) _PIP_ALL=$BS_TRUE ;; + r ) _DISABLE_REPOS=$BS_TRUE ;; \?) echo echoerror "Option does not exist : $OPTARG" @@ -2123,30 +2128,33 @@ install_ubuntu_deps() { __apt_get_install_noinput python-software-properties || return 1 fi - __enable_universe_repository || return 1 - # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then - if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then - echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository" - 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:chris-lea/python-requests" || return 1 - add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1 - add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1 - add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1 - else - add-apt-repository "ppa:chris-lea/python-requests" || return 1 - add-apt-repository "ppa:chris-lea/python-chardet" || return 1 - add-apt-repository "ppa:chris-lea/python-urllib3" || return 1 - add-apt-repository "ppa:chris-lea/python-crypto" || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + __enable_universe_repository || return 1 + + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then + if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then + echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository" + 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:chris-lea/python-requests" || return 1 + add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1 + add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1 + add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1 + else + add-apt-repository "ppa:chris-lea/python-requests" || return 1 + add-apt-repository "ppa:chris-lea/python-chardet" || return 1 + add-apt-repository "ppa:chris-lea/python-urllib3" || return 1 + add-apt-repository "ppa:chris-lea/python-crypto" || return 1 + fi fi - fi - if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then - if ([ "$DISTRO_MAJOR_VERSION" -lt 15 ] && [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]); then - echoinfo "Installing ZMQ>=4/PyZMQ>=14 from Chris Lea's PPA repository" - add-apt-repository -y ppa:chris-lea/zeromq || return 1 + if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then + if ([ "$DISTRO_MAJOR_VERSION" -lt 15 ] && [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]); then + echoinfo "Installing ZMQ>=4/PyZMQ>=14 from Chris Lea's PPA repository" + add-apt-repository -y ppa:chris-lea/zeromq || return 1 + fi fi fi fi @@ -2206,56 +2214,61 @@ install_ubuntu_deps() { } install_ubuntu_stable_deps() { - if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then - repo_arch="amd64" - elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then - echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Ubuntu (yet?)" - repo_arch="i386" + + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then + repo_arch="amd64" + elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then + echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Ubuntu (yet?)" + repo_arch="i386" + fi fi install_ubuntu_deps || return 1 - # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then - # Workaround for latest non-LTS ubuntu - if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then - echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems" - UBUNTU_VERSION=14.04 - UBUNTU_CODENAME=trusty + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + # Workaround for latest non-LTS ubuntu + if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then + echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems" + UBUNTU_VERSION=14.04 + UBUNTU_CODENAME=trusty + else + UBUNTU_VERSION=$DISTRO_VERSION + UBUNTU_CODENAME=$DISTRO_CODENAME + fi + + # SaltStack's stable Ubuntu repository + SALTSTACK_UBUNTU_URL="${HTTP_VAL}://repo.saltstack.com/apt/ubuntu/$UBUNTU_VERSION/$repo_arch/$STABLE_REV" + if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then + set +o nounset + echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list" + set -o nounset + fi + + # Make sure wget is available + __apt_get_install_noinput wget + + # shellcheck disable=SC2086 + wget $_WGET_ARGS -q $SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 + else - UBUNTU_VERSION=$DISTRO_VERSION - UBUNTU_CODENAME=$DISTRO_CODENAME - fi + # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 + if [ ! "$(echo "$STABLE_REV" | egrep '^(1\.6|1\.7)$')" = "" ]; then + STABLE_PPA="saltstack/salt$(echo "$STABLE_REV" | tr -d .)" + elif [ ! "$(echo "$STABLE_REV" | egrep '^(2014\.1|2014\.7)$')" = "" ]; then + STABLE_PPA="saltstack/salt$(echo "$STABLE_REV" | tr . -)" + else + STABLE_PPA="saltstack/salt" + fi - # SaltStack's stable Ubuntu repository - SALTSTACK_UBUNTU_URL="${HTTP_VAL}://repo.saltstack.com/apt/ubuntu/$UBUNTU_VERSION/$repo_arch/$STABLE_REV" - if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - set +o nounset - echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list" - set -o nounset - fi - - # Make sure wget is available - __apt_get_install_noinput wget - - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q $SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 - - else - # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 - if [ ! "$(echo "$STABLE_REV" | egrep '^(1\.6|1\.7)$')" = "" ]; then - STABLE_PPA="saltstack/salt$(echo "$STABLE_REV" | tr -d .)" - elif [ ! "$(echo "$STABLE_REV" | egrep '^(2014\.1|2014\.7)$')" = "" ]; then - STABLE_PPA="saltstack/salt$(echo "$STABLE_REV" | tr . -)" - else - STABLE_PPA="saltstack/salt" - 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 + 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 fi fi @@ -2272,18 +2285,20 @@ install_ubuntu_daily_deps() { __apt_get_install_noinput python-software-properties || return 1 fi - __enable_universe_repository || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + __enable_universe_repository || return 1 - # for anything up to and including 11.04 do not use the -y option - 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-daily || return 1 - else - add-apt-repository ppa:saltstack/salt-daily || return 1 + # for anything up to and including 11.04 do not use the -y option + 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-daily || return 1 + else + add-apt-repository ppa:saltstack/salt-daily || return 1 + fi + + apt-get update fi - apt-get update - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then __apt_get_upgrade_noinput || return 1 fi @@ -2637,26 +2652,30 @@ _eof __apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1 __apt_get_install_noinput build-essential python-dev python-pip python-setuptools || return 1 - # Saltstack's Unstable Debian repository - if [ "$(grep -R 'debian.saltstack.com' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian unstable main" >> \ - /etc/apt/sources.list.d/saltstack.list + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Saltstack's Unstable Debian repository + if [ "$(grep -R 'debian.saltstack.com' /etc/apt)" = "" ]; then + echo "deb http://debian.saltstack.com/debian unstable main" >> \ + /etc/apt/sources.list.d/saltstack.list + fi fi return 0 fi - # Debian Backports - if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then - echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \ - /etc/apt/sources.list.d/backports.list - fi + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Debian Backports + if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then + echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \ + /etc/apt/sources.list.d/backports.list + fi - # Saltstack's Stable Debian repository - if [ "$(grep -R 'squeeze-saltstack' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \ - /etc/apt/sources.list.d/saltstack.list + # Saltstack's Stable Debian repository + if [ "$(grep -R 'squeeze-saltstack' /etc/apt)" = "" ]; then + echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \ + /etc/apt/sources.list.d/saltstack.list + fi + apt-get update || return 1 fi - apt-get update || return 1 # Python requests is available through Squeeze backports # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 @@ -2714,16 +2733,18 @@ install_debian_7_deps() { apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 || return 1 fi - # Debian Backports - if [ "$(grep -R 'wheezy-backports' /etc/apt | grep -v "^#")" = "" ]; then - echo "deb http://httpredir.debian.org/debian wheezy-backports main" >> \ - /etc/apt/sources.list.d/backports.list - fi + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Debian Backports + if [ "$(grep -R 'wheezy-backports' /etc/apt | grep -v "^#")" = "" ]; then + echo "deb http://httpredir.debian.org/debian wheezy-backports main" >> \ + /etc/apt/sources.list.d/backports.list + fi - # Saltstack's Stable Debian repository - if [ "$(grep -R 'wheezy-saltstack' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \ - /etc/apt/sources.list.d/saltstack.list + # Saltstack's Stable Debian repository + if [ "$(grep -R 'wheezy-saltstack' /etc/apt)" = "" ]; then + echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \ + /etc/apt/sources.list.d/saltstack.list + fi fi # shellcheck disable=SC2086 @@ -2763,11 +2784,13 @@ install_debian_7_deps() { install_debian_8_deps() { echodebug "install_debian_8_deps" - if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then - repo_arch="amd64" - elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then - echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)" - repo_arch="i386" + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then + repo_arch="amd64" + elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then + echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)" + repo_arch="i386" + fi fi if [ $_START_DAEMONS -eq $BS_FALSE ]; then @@ -2789,16 +2812,18 @@ install_debian_8_deps() { apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1 fi - # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then - SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" - echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" + echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + # shellcheck disable=SC2086 + wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 - if [ "${HTTP_VAL}" = "https" ] ; then - __apt_get_install_noinput apt-transport-https || return 1 + if [ "${HTTP_VAL}" = "https" ] ; then + __apt_get_install_noinput apt-transport-https || return 1 + fi fi fi @@ -3126,11 +3151,14 @@ __fedora_get_package_manager() { install_fedora_deps() { __fedora_get_package_manager - if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then - __install_saltstack_copr_zeromq_repository || return 1 - fi - __install_saltstack_copr_salt_repository || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then + __install_saltstack_copr_zeromq_repository || return 1 + fi + + __install_saltstack_copr_salt_repository || return 1 + fi __PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests" @@ -3411,8 +3439,11 @@ __install_saltstack_copr_salt_repository() { } install_centos_stable_deps() { - __install_epel_repository || return 1 - __install_saltstack_rhel_repository || return 1 + + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + __install_epel_repository || return 1 + __install_saltstack_rhel_repository || return 1 + fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file @@ -4054,16 +4085,18 @@ install_amazon_linux_ami_2010_git_deps() { } install_amazon_linux_ami_deps() { - # enable the EPEL repo - /usr/bin/yum-config-manager --enable epel || return 1 - # exclude Salt and ZeroMQ packages from EPEL - /usr/bin/yum-config-manager epel --setopt "epel.exclude=zeromq* salt* python-zmq*" --save || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # enable the EPEL repo + /usr/bin/yum-config-manager --enable epel || return 1 - __REPO_FILENAME="saltstack-repo.repo" + # exclude Salt and ZeroMQ packages from EPEL + /usr/bin/yum-config-manager epel --setopt "epel.exclude=zeromq* salt* python-zmq*" --save || return 1 - if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then - cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}" + __REPO_FILENAME="saltstack-repo.repo" + + if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then + cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}" [saltstack-repo] disabled=False name=SaltStack repo for RHEL/CentOS 6 @@ -4072,10 +4105,11 @@ gpgkey=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTST baseurl=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/ humanname=SaltStack repo for RHEL/CentOS 6 _eof - fi + fi - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - yum -y update || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + yum -y update || return 1 + fi fi __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" @@ -4437,21 +4471,24 @@ __configure_freebsd_pkg_details() { } install_freebsd_9_stable_deps() { - #make variables available even if pkg already installed - __freebsd_get_packagesite - if [ ! -x /usr/local/sbin/pkg ]; then + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + #make variables available even if pkg already installed + __freebsd_get_packagesite - # install new `pkg` code from its own tarball. - fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1 - tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static" || return 1 - ./pkg-static add ./pkg.txz || return 1 - /usr/local/sbin/pkg2ng || return 1 + if [ ! -x /usr/local/sbin/pkg ]; then + + # install new `pkg` code from its own tarball. + fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1 + tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static" || return 1 + ./pkg-static add ./pkg.txz || return 1 + /usr/local/sbin/pkg2ng || return 1 + fi + + # Configure the pkg repository using new approach + __configure_freebsd_pkg_details || return 1 fi - # Configure the pkg repository using new approach - __configure_freebsd_pkg_details || return 1 - # Now install swig # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig || return 1 @@ -5076,12 +5113,14 @@ install_opensuse_stable_deps() { DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" fi - # Is the repository already known - __set_suse_pkg_repo - __zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Is the repository already known + __set_suse_pkg_repo + __zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 + if [ $? -eq 1 ]; then + # zypper does not yet know anything about systemsmanagement_saltstack + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + fi fi __zypper --gpg-auto-import-keys refresh @@ -5306,12 +5345,14 @@ install_suse_12_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}" - # Is the repository already known - __set_suse_pkg_repo - __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Is the repository already known + __set_suse_pkg_repo + __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 + if [ $? -eq 1 ]; then + # zypper does not yet know nothing about systemsmanagement_saltstack + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + fi fi __zypper --gpg-auto-import-keys refresh || return 1 @@ -5492,12 +5533,14 @@ install_suse_11_stable_deps() { fi DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" - # Is the repository already known - __set_suse_pkg_repo - __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + # Is the repository already known + __set_suse_pkg_repo + __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 + if [ $? -eq 1 ]; then + # zypper does not yet know nothing about systemsmanagement_saltstack + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 + fi fi __zypper --gpg-auto-import-keys refresh || return 1 From 3354a484e0e7d2fd2edb9beaad45b564675ece01 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 20 Apr 2016 11:04:22 +0300 Subject: [PATCH 150/156] Always download and install latest `epel-release` package on RHEL systems --- bootstrap-salt.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 83be1a1..c7dfbf2 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3339,26 +3339,19 @@ __install_epel_repository() { return 0 fi - if [ "$CPU_ARCH_L" = "i686" ]; then - EPEL_ARCH="i386" - else - EPEL_ARCH=$CPU_ARCH_L - fi + # Download latest 'epel-release' package for the distro version directly + epel_repo_url="${HTTP_VAL}://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRO_MAJOR_VERSION}.noarch.rpm" if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - # Install curl which is not included in minimal CentOS 5 images - rpm -q curl > /dev/null 2>&1 || yum -y install curl - # rpm from CentOS/RHEL release 5 does not support HTTP downloads - # properly, especially 3XX code redirects - __fetch_url /tmp/epel-release.rpm "${HTTP_VAL}://download.fedoraproject.org/pub/epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm" || return 1 + __fetch_url /tmp/epel-release.rpm "$epel_repo_url" || return 1 rpm -Uvh --force /tmp/epel-release.rpm || return 1 - elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then - rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1 - elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then - rpm -Uvh --force "${HTTP_VAL}://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-6.noarch.rpm" || return 1 + rm -f /tmp/epel-release.rpm + elif [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then + rpm -Uvh --force "$epel_repo_url" || return 1 else echoerror "Failed add EPEL repository support." return 1 fi + _EPEL_REPOS_INSTALLED=$BS_TRUE return 0 } @@ -3439,6 +3432,10 @@ __install_saltstack_copr_salt_repository() { } install_centos_stable_deps() { + if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then + # Install curl which is not included in @core CentOS 5 installation + __check_command_exists curl || yum -y install "curl.${CPU_ARCH_L}" || return 1 + fi if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then __install_epel_repository || return 1 From 2579facc0ec9941e86a820e34f3b7e7aeb22f2c5 Mon Sep 17 00:00:00 2001 From: Wallace C Ricardo Date: Thu, 21 Apr 2016 15:10:42 -0400 Subject: [PATCH 151/156] Update README.rst Fix typo "docker built" on README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b14912e..d38040f 100644 --- a/README.rst +++ b/README.rst @@ -506,7 +506,7 @@ with the bootstrap script: .. code:: console - docker built -t local/salt-bootstrap . + docker build -t local/salt-bootstrap . Start your new container with Salt services up and running: From 25e295a5eca5261fadc72fc906e94efcc2e3fb0f Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Tue, 26 Apr 2016 10:02:17 -0600 Subject: [PATCH 152/156] Ubuntu 12.04 needs to be updated before installing packages (#829) --- bootstrap-salt.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 83be1a1..ed3741f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2307,6 +2307,9 @@ install_ubuntu_daily_deps() { } install_ubuntu_git_deps() { + if [ "$DISTRO_MAJOR_VERSION" -eq 12 ]; then + apt-get update + fi __apt_get_install_noinput git-core || return 1 __git_clone_and_checkout || return 1 From 234c7f861f3324ae2c6ae572d55c805e03b16154 Mon Sep 17 00:00:00 2001 From: chiefnuts Date: Fri, 6 May 2016 11:05:11 -0600 Subject: [PATCH 153/156] Update bootstrap-salt.ps1 added fix to string split to correct for version numbers have additional hotfix revision numbers. --- bootstrap-salt.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 4bf26f9..c7e0194 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -121,7 +121,7 @@ if (!$version) { if ($arch -eq 'x86') {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"}} else {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"}} - $version = $(($returnMatches | Sort-Object -Descending)[0]).Split('-')[2] + $version = $(($returnMatches | Sort-Object -Descending)[0]).Split(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] } # Download minion setup file @@ -176,4 +176,4 @@ Else { Stop-Service "salt-minion" } -Write-Output "Salt minion successfully installed" \ No newline at end of file +Write-Output "Salt minion successfully installed" From b1a03ea8bc36f9f3a7f8e75a0e381cd02e021818 Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Fri, 6 May 2016 11:22:37 -0600 Subject: [PATCH 154/156] Removed libzmq4 and forking-deamon-patch for Opensuse13 --- bootstrap-salt.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ed3741f..ebfe3d1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5150,7 +5150,7 @@ install_opensuse_stable_deps() { if [ "$DISTRO_MAJOR_VERSION" -lt 13 ]; then __PACKAGES="${__PACKAGES} libzmq3" elif [ "$DISTRO_MAJOR_VERSION" -eq 13 ]; then - __PACKAGES="${__PACKAGES} libzmq4" + __PACKAGES="${__PACKAGES} libzmq3" elif [ "$DISTRO_MAJOR_VERSION" -gt 13 ]; then __PACKAGES="${__PACKAGES} libzmq5" fi @@ -5185,13 +5185,6 @@ install_opensuse_git_deps() { __git_clone_and_checkout || return 1 - if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/suse/use-forking-daemon.patch" ]; then - # shellcheck disable=SC2164 - cd "${_SALT_GIT_CHECKOUT_DIR}" - echowarn "Applying patch to systemd service unit file" - patch -p1 < pkg/suse/use-forking-daemon.patch || return 1 - fi - if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then # We're on the develop branch, install whichever tornado is on the requirements file __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" From 051823337276349140de0344b37327e588649b7b Mon Sep 17 00:00:00 2001 From: rallytime Date: Tue, 10 May 2016 13:28:55 -0600 Subject: [PATCH 155/156] Update ChangleLog for new release --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5b7fcbf..3f87574 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Version 2016.05.10: + * Removed libzmq4 and forking-deamon-patch for Opensuse13. (jtand) #840 + * Ubuntu 12.04 needs to be updated before installing packages. (jtand) #829 + * Always download and install *latest* `epel-release` package on RHEL systems. (vutny) #825 + * Fix Amazon Linux EOL check. (vutny) #818 + Version 2016.04.18: * Add support for openSUSE Leap. Thanks Roman Inflianskas(rominf). #693 * Fix missing deps installation on Debian. Thanks Steve Groesz(wolfpackmars2). #699 From bdbb4c9bd50da49cb1e99b90c8993fd6f564b211 Mon Sep 17 00:00:00 2001 From: rallytime Date: Tue, 10 May 2016 13:31:54 -0600 Subject: [PATCH 156/156] Update ScriptVersion --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 22538ac..2470193 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.04.18" +__ScriptVersion="2016.05.10" __ScriptName="bootstrap-salt.sh" #======================================================================================================================