Merge pull request #843 from rallytime/merge-stable

[stable] Merge develop into stable branch
This commit is contained in:
Nicole Thomas 2016-05-10 16:38:55 -06:00
commit 7e4aaef801
4 changed files with 293 additions and 188 deletions

View file

@ -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: Version 2016.04.18:
* Add support for openSUSE Leap. Thanks Roman Inflianskas(rominf). #693 * Add support for openSUSE Leap. Thanks Roman Inflianskas(rominf). #693
* Fix missing deps installation on Debian. Thanks Steve Groesz(wolfpackmars2). #699 * Fix missing deps installation on Debian. Thanks Steve Groesz(wolfpackmars2). #699

View file

@ -506,7 +506,7 @@ with the bootstrap script:
.. code:: console .. code:: console
docker built -t local/salt-bootstrap . docker build -t local/salt-bootstrap .
Start your new container with Salt services up and running: Start your new container with Salt services up and running:

View file

@ -1,27 +1,34 @@
<# <#
.SYNOPSIS .SYNOPSIS
A simple Powershell script to download and install a salt minion on windows. A simple Powershell script to download and install a salt minion on windows.
.DESCRIPTION .DESCRIPTION
The script will download the official salt package from saltstack. It will install a specific 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 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. set the windows service to "manual" for local testing.
.EXAMPLE .EXAMPLE
./bootstrap-salt.ps1 ./bootstrap-salt.ps1
Runs without any parameters. Uses all the default values/settings. Runs without any parameters. Uses all the default values/settings.
.EXAMPLE .EXAMPLE
./bootstrap-salt.ps1 -version 2015.4.1-3 ./bootstrap-salt.ps1 -version 2015.4.1-3
Specifies a particular version of the installer. Specifies a particular version of the installer.
.EXAMPLE .EXAMPLE
./bootstrap-salt.ps1 -runservice false ./bootstrap-salt.ps1 -runservice false
Specifies the salt-minion service to stop and be set to manual. Specifies the salt-minion service to stop and be set to manual.
Useful for testing locally from the command line with the --local switch Useful for testing locally from the command line with the --local switch
.EXAMPLE .EXAMPLE
./bootstrap-salt.ps1 -minion minion-box -master master-box ./bootstrap-salt.ps1 -minion minion-box -master master-box
Specifies the minion and master ids in the minion config. Specifies the minion and master ids in the minion config.
Defaults to the installer values of "minion" and "master". Defaults to the installer values of "minion" and "master".
.EXAMPLE .EXAMPLE
./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false
Specifies all the optional parameters in no particular order. Specifies all the optional parameters in no particular order.
.PARAMETER version - Default version defined in this script. .PARAMETER version - Default version defined in this script.
.PARAMETER runservice - Boolean flag to stop the windows service and set to "manual". .PARAMETER runservice - Boolean flag to stop the windows service and set to "manual".
@ -47,7 +54,7 @@ Param(
[Parameter(Mandatory=$false,ValueFromPipeline=$true)] [Parameter(Mandatory=$false,ValueFromPipeline=$true)]
# Doesn't support versions prior to "YYYY.M.R-B" # Doesn't support versions prior to "YYYY.M.R-B"
[ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')] [ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')]
[string]$version = "2015.8.8-2", [string]$version = '',
[Parameter(Mandatory=$false,ValueFromPipeline=$true)] [Parameter(Mandatory=$false,ValueFromPipeline=$true)]
[ValidateSet("true","false")] [ValidateSet("true","false")]
@ -99,15 +106,33 @@ If ([IntPtr]::Size -eq 4) {
$arch = "AMD64" $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(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1]
}
# Download minion setup file # 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 $webclient = New-Object System.Net.WebClient
$url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe" $url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe"
$file = "C:\tmp\salt.exe" $file = "C:\tmp\salt.exe"
$webclient.DownloadFile($url, $file) $webclient.DownloadFile($url, $file)
# Install minion silently # Install minion silently
Write-Host -NoNewline "Installing Salt minion" Write-Output -NoNewline "Installing Salt minion"
#Wait for process to exit before continuing. #Wait for process to exit before continuing.
C:\tmp\salt.exe /S /minion-name=$minion /master=$master | Out-Null 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 # If the salt-minion service is still not running, something probably
# went wrong and user intervention is required - report failure. # went wrong and user intervention is required - report failure.
If ($service.Status -eq "Stopped") { If ($service.Status -eq "Stopped") {
Write-Host -NoNewline "Failed to start salt minion" Write-Output -NoNewline "Failed to start salt minion"
exit 1 exit 1
} }
} }
Else { 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" Set-Service "salt-minion" -startupType "Manual"
Stop-Service "salt-minion" Stop-Service "salt-minion"
} }
Write-Host -NoNewline "Salt minion successfully installed" Write-Output "Salt minion successfully installed"

View file

@ -18,7 +18,7 @@
#====================================================================================================================== #======================================================================================================================
set -o nounset # Treat unset variables as an error set -o nounset # Treat unset variables as an error
__ScriptVersion="2016.04.18" __ScriptVersion="2016.05.10"
__ScriptName="bootstrap-salt.sh" __ScriptName="bootstrap-salt.sh"
#====================================================================================================================== #======================================================================================================================
@ -231,6 +231,7 @@ _SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt}
_NO_DEPS=$BS_FALSE _NO_DEPS=$BS_FALSE
_FORCE_SHALLOW_CLONE=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE
_DISABLE_SSL=$BS_FALSE _DISABLE_SSL=$BS_FALSE
_DISABLE_REPOS=$BS_FALSE
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
@ -330,12 +331,15 @@ __usage() {
-a Pip install all python pkg dependencies for salt. Requires -V to install -a Pip install all python pkg dependencies for salt. Requires -V to install
all pip pkgs into the virtualenv(Only available for Ubuntu base all pip pkgs into the virtualenv(Only available for Ubuntu base
distributions) distributions)
-r Disable all repository configuration performed by this script. This
option assumes all necessary repository configuration is already present
on the system.
EOT EOT
} # ---------- end of function __usage ---------- } # ---------- 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 do
case "${opt}" in case "${opt}" in
@ -398,6 +402,7 @@ do
l ) _DISABLE_SSL=$BS_TRUE ;; l ) _DISABLE_SSL=$BS_TRUE ;;
V ) _VIRTUALENV_DIR="$OPTARG" ;; V ) _VIRTUALENV_DIR="$OPTARG" ;;
a ) _PIP_ALL=$BS_TRUE ;; a ) _PIP_ALL=$BS_TRUE ;;
r ) _DISABLE_REPOS=$BS_TRUE ;;
\?) echo \?) echo
echoerror "Option does not exist : $OPTARG" echoerror "Option does not exist : $OPTARG"
@ -1588,6 +1593,16 @@ __check_end_of_life_versions() {
fi 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)
# FreeBSD versions lower than 9.1 are not supported. # 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 if ([ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then
@ -2123,30 +2138,33 @@ install_ubuntu_deps() {
__apt_get_install_noinput python-software-properties || return 1 __apt_get_install_noinput python-software-properties || return 1
fi fi
__enable_universe_repository || return 1
# Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then __enable_universe_repository || return 1
if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then
echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository" # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com
if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then
# Above Ubuntu 11.04 add a -y flag if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then
add-apt-repository -y "ppa:chris-lea/python-requests" || return 1 echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository"
add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1 if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then
add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1 # Above Ubuntu 11.04 add a -y flag
add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1 add-apt-repository -y "ppa:chris-lea/python-requests" || return 1
else add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1
add-apt-repository "ppa:chris-lea/python-requests" || return 1 add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1
add-apt-repository "ppa:chris-lea/python-chardet" || return 1 add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1
add-apt-repository "ppa:chris-lea/python-urllib3" || return 1 else
add-apt-repository "ppa:chris-lea/python-crypto" || return 1 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
fi
if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then 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 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" echoinfo "Installing ZMQ>=4/PyZMQ>=14 from Chris Lea's PPA repository"
add-apt-repository -y ppa:chris-lea/zeromq || return 1 add-apt-repository -y ppa:chris-lea/zeromq || return 1
fi
fi fi
fi fi
fi fi
@ -2156,6 +2174,9 @@ install_ubuntu_deps() {
# Minimal systems might not have upstart installed, install it # Minimal systems might not have upstart installed, install it
__PACKAGES="upstart" __PACKAGES="upstart"
if [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then
__PACKAGES="${__PACKAGES} python2.7"
fi
if [ "$_VIRTUALENV_DIR" != "null" ]; then if [ "$_VIRTUALENV_DIR" != "null" ]; then
__PACKAGES="${__PACKAGES} python-virtualenv" __PACKAGES="${__PACKAGES} python-virtualenv"
fi fi
@ -2203,44 +2224,61 @@ install_ubuntu_deps() {
} }
install_ubuntu_stable_deps() { install_ubuntu_stable_deps() {
if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then
repo_arch="amd64" if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then
echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Ubuntu (yet?)" repo_arch="amd64"
repo_arch="i386" 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 fi
install_ubuntu_deps || return 1 install_ubuntu_deps || return 1
# Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com
# Saltstack's Stable Ubuntu repository if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then
if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then # Workaround for latest non-LTS ubuntu
echo "deb http://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV $DISTRO_CODENAME main" > \ if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then
"/etc/apt/sources.list.d/saltstack.list" echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems"
fi UBUNTU_VERSION=14.04
UBUNTU_CODENAME=trusty
else
UBUNTU_VERSION=$DISTRO_VERSION
UBUNTU_CODENAME=$DISTRO_CODENAME
fi
# Make sure wget is available # SaltStack's stable Ubuntu repository
__apt_get_install_noinput wget 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
# shellcheck disable=SC2086 # Make sure wget is available
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 __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 else
STABLE_PPA="saltstack/salt" # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7
fi 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 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 # Above Ubuntu 11.04 add a -y flag
add-apt-repository -y "ppa:$STABLE_PPA" || return 1 add-apt-repository -y "ppa:$STABLE_PPA" || return 1
else else
add-apt-repository "ppa:$STABLE_PPA" || return 1 add-apt-repository "ppa:$STABLE_PPA" || return 1
fi
fi fi
fi fi
@ -2257,18 +2295,20 @@ install_ubuntu_daily_deps() {
__apt_get_install_noinput python-software-properties || return 1 __apt_get_install_noinput python-software-properties || return 1
fi 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 # 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 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 # Above Ubuntu 11.04 add a -y flag
add-apt-repository -y ppa:saltstack/salt-daily || return 1 add-apt-repository -y ppa:saltstack/salt-daily || return 1
else else
add-apt-repository ppa:saltstack/salt-daily || return 1 add-apt-repository ppa:saltstack/salt-daily || return 1
fi
apt-get update
fi fi
apt-get update
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
__apt_get_upgrade_noinput || return 1 __apt_get_upgrade_noinput || return 1
fi fi
@ -2277,6 +2317,9 @@ install_ubuntu_daily_deps() {
} }
install_ubuntu_git_deps() { install_ubuntu_git_deps() {
if [ "$DISTRO_MAJOR_VERSION" -eq 12 ]; then
apt-get update
fi
__apt_get_install_noinput git-core || return 1 __apt_get_install_noinput git-core || return 1
__git_clone_and_checkout || return 1 __git_clone_and_checkout || return 1
@ -2355,6 +2398,36 @@ install_ubuntu_git() {
return 0 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() { install_ubuntu_git_post() {
for fname in minion master syndic api; do for fname in minion master syndic api; do
@ -2592,26 +2665,30 @@ _eof
__apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1 __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 __apt_get_install_noinput build-essential python-dev python-pip python-setuptools || return 1
# Saltstack's Unstable Debian repository if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(grep -R 'debian.saltstack.com' /etc/apt)" = "" ]; then # Saltstack's Unstable Debian repository
echo "deb http://debian.saltstack.com/debian unstable main" >> \ if [ "$(grep -R 'debian.saltstack.com' /etc/apt)" = "" ]; then
/etc/apt/sources.list.d/saltstack.list echo "deb http://debian.saltstack.com/debian unstable main" >> \
/etc/apt/sources.list.d/saltstack.list
fi
fi fi
return 0 return 0
fi fi
# Debian Backports if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then # Debian Backports
echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \ if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then
/etc/apt/sources.list.d/backports.list echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \
fi /etc/apt/sources.list.d/backports.list
fi
# Saltstack's Stable Debian repository # Saltstack's Stable Debian repository
if [ "$(grep -R 'squeeze-saltstack' /etc/apt)" = "" ]; then if [ "$(grep -R 'squeeze-saltstack' /etc/apt)" = "" ]; then
echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \ echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \
/etc/apt/sources.list.d/saltstack.list /etc/apt/sources.list.d/saltstack.list
fi
apt-get update || return 1
fi fi
apt-get update || return 1
# Python requests is available through Squeeze backports # Python requests is available through Squeeze backports
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
@ -2669,16 +2746,18 @@ install_debian_7_deps() {
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 || return 1 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 || return 1
fi fi
# Debian Backports if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(grep -R 'wheezy-backports' /etc/apt | grep -v "^#")" = "" ]; then # Debian Backports
echo "deb http://httpredir.debian.org/debian wheezy-backports main" >> \ if [ "$(grep -R 'wheezy-backports' /etc/apt | grep -v "^#")" = "" ]; then
/etc/apt/sources.list.d/backports.list echo "deb http://httpredir.debian.org/debian wheezy-backports main" >> \
fi /etc/apt/sources.list.d/backports.list
fi
# Saltstack's Stable Debian repository # Saltstack's Stable Debian repository
if [ "$(grep -R 'wheezy-saltstack' /etc/apt)" = "" ]; then if [ "$(grep -R 'wheezy-saltstack' /etc/apt)" = "" ]; then
echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \ echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \
/etc/apt/sources.list.d/saltstack.list /etc/apt/sources.list.d/saltstack.list
fi
fi fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
@ -2718,11 +2797,13 @@ install_debian_7_deps() {
install_debian_8_deps() { install_debian_8_deps() {
echodebug "install_debian_8_deps" echodebug "install_debian_8_deps"
if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
repo_arch="amd64" if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then
elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then repo_arch="amd64"
echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)" elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then
repo_arch="i386" echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)"
repo_arch="i386"
fi
fi fi
if [ $_START_DAEMONS -eq $BS_FALSE ]; then if [ $_START_DAEMONS -eq $BS_FALSE ]; then
@ -2744,16 +2825,18 @@ install_debian_8_deps() {
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1
fi fi
# Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com
SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then
echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" 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 # shellcheck disable=SC2086
wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1
if [ "${HTTP_VAL}" = "https" ] ; then if [ "${HTTP_VAL}" = "https" ] ; then
__apt_get_install_noinput apt-transport-https || return 1 __apt_get_install_noinput apt-transport-https || return 1
fi
fi fi
fi fi
@ -3081,11 +3164,14 @@ __fedora_get_package_manager() {
install_fedora_deps() { install_fedora_deps() {
__fedora_get_package_manager __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" __PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests"
@ -3266,26 +3352,19 @@ __install_epel_repository() {
return 0 return 0
fi fi
if [ "$CPU_ARCH_L" = "i686" ]; then # Download latest 'epel-release' package for the distro version directly
EPEL_ARCH="i386" epel_repo_url="${HTTP_VAL}://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRO_MAJOR_VERSION}.noarch.rpm"
else
EPEL_ARCH=$CPU_ARCH_L
fi
if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then
# Install curl which is not included in minimal CentOS 5 images __fetch_url /tmp/epel-release.rpm "$epel_repo_url" || return 1
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
rpm -Uvh --force /tmp/epel-release.rpm || return 1 rpm -Uvh --force /tmp/epel-release.rpm || return 1
elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then rm -f /tmp/epel-release.rpm
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" -ge 6 ]; then
elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then rpm -Uvh --force "$epel_repo_url" || 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 else
echoerror "Failed add EPEL repository support." echoerror "Failed add EPEL repository support."
return 1 return 1
fi fi
_EPEL_REPOS_INSTALLED=$BS_TRUE _EPEL_REPOS_INSTALLED=$BS_TRUE
return 0 return 0
} }
@ -3366,8 +3445,15 @@ __install_saltstack_copr_salt_repository() {
} }
install_centos_stable_deps() { install_centos_stable_deps() {
__install_epel_repository || return 1 if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then
__install_saltstack_rhel_repository || return 1 # 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
__install_saltstack_rhel_repository || 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 # We're on the develop branch, install whichever tornado is on the requirements file
@ -3991,34 +4077,19 @@ install_scientific_linux_check_services() {
# Amazon Linux AMI Install Functions # 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() { 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 if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
/usr/bin/yum-config-manager epel --setopt "epel.exclude=zeromq* salt* python-zmq*" --save || return 1 # 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 __REPO_FILENAME="saltstack-repo.repo"
cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}"
if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then
cat <<_eof > "/etc/yum.repos.d/${__REPO_FILENAME}"
[saltstack-repo] [saltstack-repo]
disabled=False disabled=False
name=SaltStack repo for RHEL/CentOS 6 name=SaltStack repo for RHEL/CentOS 6
@ -4027,10 +4098,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/ baseurl=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/
humanname=SaltStack repo for RHEL/CentOS 6 humanname=SaltStack repo for RHEL/CentOS 6
_eof _eof
fi fi
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
yum -y update || return 1 yum -y update || return 1
fi
fi fi
__PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests"
@ -4392,21 +4464,24 @@ __configure_freebsd_pkg_details() {
} }
install_freebsd_9_stable_deps() { 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. if [ ! -x /usr/local/sbin/pkg ]; then
fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static" || return 1 # install new `pkg` code from its own tarball.
./pkg-static add ./pkg.txz || return 1 fetch "${_PACKAGESITE}/Latest/pkg.txz" || return 1
/usr/local/sbin/pkg2ng || 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 fi
# Configure the pkg repository using new approach
__configure_freebsd_pkg_details || return 1
# Now install swig # Now install swig
# shellcheck disable=SC2086 # shellcheck disable=SC2086
/usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig || return 1 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig || return 1
@ -5031,12 +5106,14 @@ install_opensuse_stable_deps() {
DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
fi fi
# Is the repository already known if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
__set_suse_pkg_repo # Is the repository already known
__zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 __set_suse_pkg_repo
if [ $? -eq 1 ]; then __zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1
# zypper does not yet know nothing about systemsmanagement_saltstack if [ $? -eq 1 ]; then
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 # zypper does not yet know anything about systemsmanagement_saltstack
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1
fi
fi fi
__zypper --gpg-auto-import-keys refresh __zypper --gpg-auto-import-keys refresh
@ -5063,7 +5140,7 @@ install_opensuse_stable_deps() {
if [ "$DISTRO_MAJOR_VERSION" -lt 13 ]; then if [ "$DISTRO_MAJOR_VERSION" -lt 13 ]; then
__PACKAGES="${__PACKAGES} libzmq3" __PACKAGES="${__PACKAGES} libzmq3"
elif [ "$DISTRO_MAJOR_VERSION" -eq 13 ]; then elif [ "$DISTRO_MAJOR_VERSION" -eq 13 ]; then
__PACKAGES="${__PACKAGES} libzmq4" __PACKAGES="${__PACKAGES} libzmq3"
elif [ "$DISTRO_MAJOR_VERSION" -gt 13 ]; then elif [ "$DISTRO_MAJOR_VERSION" -gt 13 ]; then
__PACKAGES="${__PACKAGES} libzmq5" __PACKAGES="${__PACKAGES} libzmq5"
fi fi
@ -5098,13 +5175,6 @@ install_opensuse_git_deps() {
__git_clone_and_checkout || return 1 __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 if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file # 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")"
@ -5261,12 +5331,14 @@ install_suse_12_stable_deps() {
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}" DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}"
# Is the repository already known if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
__set_suse_pkg_repo # Is the repository already known
__zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 __set_suse_pkg_repo
if [ $? -eq 1 ]; then __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1
# zypper does not yet know nothing about systemsmanagement_saltstack if [ $? -eq 1 ]; then
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 # zypper does not yet know nothing about systemsmanagement_saltstack
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1
fi
fi fi
__zypper --gpg-auto-import-keys refresh || return 1 __zypper --gpg-auto-import-keys refresh || return 1
@ -5447,12 +5519,14 @@ install_suse_11_stable_deps() {
fi fi
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"
# Is the repository already known if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
__set_suse_pkg_repo # Is the repository already known
__zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 __set_suse_pkg_repo
if [ $? -eq 1 ]; then __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1
# zypper does not yet know nothing about systemsmanagement_saltstack if [ $? -eq 1 ]; then
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 # zypper does not yet know nothing about systemsmanagement_saltstack
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1
fi
fi fi
__zypper --gpg-auto-import-keys refresh || return 1 __zypper --gpg-auto-import-keys refresh || return 1