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

View file

@ -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:

View file

@ -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(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1]
}
# 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"

View file

@ -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"
#======================================================================================================================
@ -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"
@ -1588,6 +1593,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
@ -2123,30 +2138,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
@ -2156,6 +2174,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
@ -2203,44 +2224,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
# 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"
fi
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
# Make sure wget is available
__apt_get_install_noinput wget
# 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
# 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
# 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
# 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
@ -2257,18 +2295,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
@ -2277,6 +2317,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
@ -2355,6 +2398,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
@ -2592,26 +2665,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
@ -2669,16 +2746,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
@ -2718,11 +2797,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
@ -2744,16 +2825,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
@ -3081,11 +3164,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"
@ -3266,26 +3352,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
}
@ -3366,8 +3445,15 @@ __install_saltstack_copr_salt_repository() {
}
install_centos_stable_deps() {
__install_epel_repository || return 1
__install_saltstack_rhel_repository || return 1
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
__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
@ -3991,34 +4077,19 @@ 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
# 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
@ -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/
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"
@ -4392,21 +4464,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
@ -5031,12 +5106,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
@ -5063,7 +5140,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
@ -5098,13 +5175,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")"
@ -5261,12 +5331,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
@ -5447,12 +5519,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