mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Update to the latest stable release of the bootstrap script v2015.05.04
* Fix the configuration path for FreeBSD. #567/#552. Thanks Ronald van Zantvoort(The-Loeki). * Fix non grouping support in POSIX sed. Thanks Ronald van Zantvoort(The-Loeki). * Add Debian 8 support. Thanks Matt Black(mafrosis) * Improve Debian version parsing. Thanks Mark Lee(malept) * Make sure we update packages list one Chris Lea's PPA repository is added. * Hard code the Debian Squeeze backports to the DE mirror since the main repository is down. Thanks @panticz. saltstack/salt-bootstrap#589. * Only install git if not already installed. saltstack/salt-bootstrap#560 * Fix openSUSE 13.2 where we need to pass --replaceflags. Thanks Roman Inflianskas(rominf). saltstack/salt-bootstrap#504. * Make sure that a recent enough requests package is installed in Debian/Ubuntu. * Install tornado on git installs for the develop branch if necessary. saltstack/salt-bootstrap#580 * Add support for Ubuntu 15.04
This commit is contained in:
parent
ea2017672d
commit
6643e47ce5
@ -17,7 +17,7 @@
|
||||
# CREATED: 10/15/2012 09:49:37 PM WEST
|
||||
#======================================================================================================================
|
||||
set -o nounset # Treat unset variables as an error
|
||||
__ScriptVersion="2015.03.15"
|
||||
__ScriptVersion="2015.05.04"
|
||||
__ScriptName="bootstrap-salt.sh"
|
||||
|
||||
#======================================================================================================================
|
||||
@ -208,6 +208,7 @@ _SALT_MINION_ID="null"
|
||||
# __SIMPLIFY_VERSION is mostly used in Solaris based distributions
|
||||
__SIMPLIFY_VERSION=$BS_TRUE
|
||||
_LIBCLOUD_MIN_VERSION="0.14.0"
|
||||
_PY_REQUESTS_MIN_VERSION="2.4.3"
|
||||
_EXTRA_PACKAGES=""
|
||||
_HTTP_PROXY=""
|
||||
__SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt}
|
||||
@ -612,6 +613,33 @@ __parse_version_string() {
|
||||
}
|
||||
|
||||
|
||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __derive_debian_numeric_version
|
||||
# DESCRIPTION: Derive the numeric version from a Debian version string.
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
__derive_debian_numeric_version() {
|
||||
NUMERIC_VERSION=""
|
||||
INPUT_VERSION="$1"
|
||||
if echo "$INPUT_VERSION" | grep -q '^[0-9]'; then
|
||||
NUMERIC_VERSION="$INPUT_VERSION"
|
||||
elif [ -z "$INPUT_VERSION" -a -f "/etc/debian_version" ]; then
|
||||
INPUT_VERSION="$(cat /etc/debian_version)"
|
||||
fi
|
||||
if [ -z "$NUMERIC_VERSION" ]; then
|
||||
if [ "$INPUT_VERSION" = "wheezy/sid" ]; then
|
||||
# I've found an EC2 wheezy image which did not tell its version
|
||||
NUMERIC_VERSION=$(__parse_version_string "7.0")
|
||||
elif [ "$INPUT_VERSION" = "jessie/sid" ]; then
|
||||
# Let's start detecting the upcoming Debian 8 (Jessie)
|
||||
NUMERIC_VERSION=$(__parse_version_string "8.0")
|
||||
else
|
||||
echowarn "Unable to parse the Debian Version (codename: '$INPUT_VERSION')"
|
||||
fi
|
||||
fi
|
||||
echo "$NUMERIC_VERSION"
|
||||
}
|
||||
|
||||
|
||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __unquote_string
|
||||
# DESCRIPTION: Strip single or double quotes from the provided string.
|
||||
@ -743,7 +771,11 @@ __gather_linux_system_info() {
|
||||
|
||||
n=$(echo "${rsource}" | sed -e 's/[_-]release$//' -e 's/[_-]version$//')
|
||||
shortname=$(echo "${n}" | tr '[:upper:]' '[:lower:]')
|
||||
if [ "$shortname" = "debian" ]; then
|
||||
rv=$(__derive_debian_numeric_version "$(cat /etc/${rsource})")
|
||||
else
|
||||
rv=$( (grep VERSION "/etc/${rsource}"; cat "/etc/${rsource}") | grep '[0-9]' | sed -e 'q' )
|
||||
fi
|
||||
[ "${rv}" = "" ] && [ "$shortname" != "arch" ] && continue # There's no version information. Continue to next rsource
|
||||
v=$(__parse_version_string "$rv")
|
||||
case $shortname in
|
||||
@ -795,17 +827,7 @@ __gather_linux_system_info() {
|
||||
;;
|
||||
debian )
|
||||
n="Debian"
|
||||
if [ "${v}" = "" ]; then
|
||||
if [ "$(cat /etc/debian_version)" = "wheezy/sid" ]; then
|
||||
# I've found an EC2 wheezy image which did not tell its version
|
||||
v=$(__parse_version_string "7.0")
|
||||
elif [ "$(cat /etc/debian_version)" = "jessie/sid" ]; then
|
||||
# Let's start detecting the upcoming Debian 8 (Jessie)
|
||||
v=$(__parse_version_string "8.0")
|
||||
fi
|
||||
else
|
||||
echowarn "Unable to parse the Debian Version"
|
||||
fi
|
||||
v=$(__derive_debian_numeric_version "$v")
|
||||
;;
|
||||
* )
|
||||
n=${nn}
|
||||
@ -960,6 +982,10 @@ __ubuntu_derivatives_translation() {
|
||||
"elementary_os")
|
||||
_major=$(echo "$DISTRO_VERSION" | sed 's/\.//g')
|
||||
;;
|
||||
"linuxmint")
|
||||
export LSB_ETC_LSB_RELEASE=/etc/upstream-release/lsb-release
|
||||
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
|
||||
;;
|
||||
*)
|
||||
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
|
||||
;;
|
||||
@ -1140,9 +1166,9 @@ __git_clone_and_checkout() {
|
||||
|
||||
echodebug "Installed git version: $(git --version | awk '{ print $3 }')"
|
||||
|
||||
local __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}"
|
||||
local __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}"
|
||||
cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}"
|
||||
@ -1211,7 +1237,7 @@ __git_clone_and_checkout() {
|
||||
cd "${__SALT_GIT_CHECKOUT_DIR}"
|
||||
fi
|
||||
|
||||
if [ "$(echo "$_SALT_REPO_URL" | sed 's/^\(\(git\|https\)\:\/\/github\.com\/saltstack\/salt\.git\|git@github.com\:saltstack\/salt\.git\)$/MATCH/')" != "MATCH" ]; then
|
||||
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
|
||||
@ -1533,7 +1559,7 @@ __check_services_sysvinit() {
|
||||
servicename=$1
|
||||
echodebug "Checking if service ${servicename} is enabled"
|
||||
|
||||
if [ "$(/sbin/chkconfig --list | grep salt-"$fname" | grep '[2-5]:on')" != "" ]; then
|
||||
if [ "$(LC_ALL=C /sbin/chkconfig --list | grep salt-"$fname" | grep '[2-5]:on')" != "" ]; then
|
||||
echodebug "Service ${servicename} is enabled"
|
||||
return 0
|
||||
else
|
||||
@ -1674,7 +1700,7 @@ __enable_universe_repository() {
|
||||
}
|
||||
|
||||
install_ubuntu_deps() {
|
||||
if [ "${__DEFAULT_SLEEP}" -eq "${__DEFAULT_SLEEP_ORIGINAL}" ]; then
|
||||
if ([ "${__DEFAULT_SLEEP}" -eq "${__DEFAULT_SLEEP_ORIGINAL}" ] && [ "$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."
|
||||
@ -1683,6 +1709,8 @@ install_ubuntu_deps() {
|
||||
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
|
||||
# No user interaction, libc6 restart services for example
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get update
|
||||
|
||||
@ -1713,18 +1741,22 @@ install_ubuntu_deps() {
|
||||
# Need python-apt for managing packages via Salt
|
||||
__apt_get_install_noinput python-apt
|
||||
|
||||
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" -lt 15 ]) || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then
|
||||
if [ "$_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
|
||||
apt-get update
|
||||
fi
|
||||
__apt_get_install_noinput python-requests
|
||||
__PIP_PACKAGES=""
|
||||
else
|
||||
elif [ "$DISTRO_MAJOR_VERSION" -lt 15 ]; then
|
||||
check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package 'requests'"
|
||||
__apt_get_install_noinput python-setuptools python-pip
|
||||
__PIP_PACKAGES="requests"
|
||||
pip install requests
|
||||
# shellcheck disable=SC2089
|
||||
__PIP_PACKAGES="'requests>=$_PY_REQUESTS_MIN_VERSION'"
|
||||
elif [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then
|
||||
__apt_get_install_noinput python-requests
|
||||
__PIP_PACKAGES=""
|
||||
fi
|
||||
|
||||
# Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813
|
||||
@ -1792,6 +1824,18 @@ install_ubuntu_git_deps() {
|
||||
|
||||
__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
|
||||
check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'"
|
||||
if [ "$(which pip)" = "" ]; then
|
||||
__apt_get_install_noinput python-setuptools python-pip
|
||||
fi
|
||||
pip install -U "'${__REQUIRED_TORNADO}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -1840,7 +1884,16 @@ install_ubuntu_git_post() {
|
||||
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
|
||||
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
|
||||
|
||||
if [ -f /sbin/initctl ]; then
|
||||
if [ -f /bin/systemctl ]; then
|
||||
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
|
||||
|
||||
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
|
||||
sleep 0.1
|
||||
systemctl daemon-reload
|
||||
elif [ -f /sbin/initctl ]; then
|
||||
_upstart_conf="/etc/init/salt-$fname.conf"
|
||||
# We have upstart support
|
||||
echodebug "There's upstart support"
|
||||
@ -1871,7 +1924,11 @@ install_ubuntu_restart_daemons() {
|
||||
[ $_START_DAEMONS -eq $BS_FALSE ] && return
|
||||
|
||||
# Ensure upstart configs are loaded
|
||||
[ -f /sbin/initctl ] && /sbin/initctl reload-configuration
|
||||
if [ -f /bin/systemctl ]; then
|
||||
systemctl daemon-reload
|
||||
elif [ -f /sbin/initctl ]; then
|
||||
/sbin/initctl reload-configuration
|
||||
fi
|
||||
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
|
||||
@ -1882,6 +1939,15 @@ install_ubuntu_restart_daemons() {
|
||||
#[ $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
|
||||
echodebug "There's systemd support while checking salt-$fname"
|
||||
systemctl stop salt-$fname > /dev/null 2>&1
|
||||
systemctl start salt-$fname.service
|
||||
[ $? -eq 0 ] && continue
|
||||
# We failed to start the service, let's test the SysV code below
|
||||
echodebug "Failed to start salt-$fname using systemd"
|
||||
fi
|
||||
|
||||
if [ -f /sbin/initctl ]; then
|
||||
echodebug "There's upstart support while checking salt-$fname"
|
||||
|
||||
@ -1917,7 +1983,10 @@ install_ubuntu_check_services() {
|
||||
[ $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 /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then
|
||||
|
||||
if [ -f /bin/systemctl ]; then
|
||||
__check_services_systemd salt-$fname || return 1
|
||||
elif [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then
|
||||
__check_services_upstart salt-$fname || return 1
|
||||
elif [ -f /etc/init.d/salt-$fname ]; then
|
||||
__check_services_debian salt-$fname || return 1
|
||||
@ -1956,7 +2025,8 @@ install_debian_deps() {
|
||||
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"
|
||||
__PIP_PACKAGES="${__PIP_PACKAGES} requests"
|
||||
# shellcheck disable=SC2089
|
||||
__PIP_PACKAGES="${__PIP_PACKAGES} 'requests>=$_PY_REQUESTS_MIN_VERSION'"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
@ -1997,6 +2067,11 @@ install_debian_6_deps() {
|
||||
# Install Keys
|
||||
__apt_get_install_noinput debian-archive-keyring && apt-get update
|
||||
|
||||
# Install Debian Archive Automatic Signing Key (6.0/squeeze), see #557
|
||||
if [ "$(apt-key finger | grep '9FED 2BCB DCD2 9CDF 7626 78CB AED4 B06F 4730 41FA')" = "" ]; then
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AED4B06F473041FA || return 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1
|
||||
|
||||
@ -2040,7 +2115,7 @@ _eof
|
||||
|
||||
# Debian Backports
|
||||
if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then
|
||||
echo "deb http://http.debian.net/debian-backports squeeze-backports main" >> \
|
||||
echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \
|
||||
/etc/apt/sources.list.d/backports.list
|
||||
fi
|
||||
|
||||
@ -2053,15 +2128,16 @@ _eof
|
||||
|
||||
# Python requests is available through Squeeze backports
|
||||
# Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813
|
||||
__apt_get_install_noinput python-requests python-pip procps pciutils
|
||||
__apt_get_install_noinput python-pip procps pciutils
|
||||
|
||||
# Need python-apt for managing packages via Salt
|
||||
__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"
|
||||
check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud/requests"
|
||||
__apt_get_install_noinput python-pip
|
||||
pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION"
|
||||
pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION 'requests>=$_PY_REQUESTS_MIN_VERSION'"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
@ -2094,6 +2170,11 @@ install_debian_7_deps() {
|
||||
# Install Keys
|
||||
__apt_get_install_noinput debian-archive-keyring && apt-get update
|
||||
|
||||
# Install Debian Archive Automatic Signing Key (7.0/wheezy), see #557
|
||||
if [ "$(apt-key finger | grep 'A1BD 8E9D 78F7 FE5C 3E65 D8AF 8B48 AD62 4692 5553')" = "" ]; then
|
||||
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://http.debian.net/debian wheezy-backports main" >> \
|
||||
@ -2110,7 +2191,78 @@ install_debian_7_deps() {
|
||||
wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1
|
||||
|
||||
apt-get update || return 1
|
||||
__apt_get_install_noinput -t wheezy-backports libzmq3 libzmq3-dev python-zmq python-requests python-apt || 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
|
||||
__PACKAGES="procps pciutils"
|
||||
# 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 requests"
|
||||
__PACKAGES="build-essential python-dev python-pip"
|
||||
# shellcheck disable=SC2086
|
||||
__apt_get_install_noinput ${__PACKAGES} || return 1
|
||||
pip install -U "requests>=$_PY_REQUESTS_MIN_VERSION"
|
||||
|
||||
|
||||
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
|
||||
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
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
__apt_get_upgrade_noinput || return 1
|
||||
fi
|
||||
|
||||
if [ "${_EXTRA_PACKAGES}" != "" ]; then
|
||||
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
|
||||
# shellcheck disable=SC2086
|
||||
__apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_debian_8_deps() {
|
||||
echodebug "install_debian_8_deps"
|
||||
|
||||
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
|
||||
# No user interaction, libc6 restart services for example
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get update
|
||||
|
||||
# Make sure wget is available
|
||||
__apt_get_install_noinput wget
|
||||
|
||||
# Install Keys
|
||||
__apt_get_install_noinput debian-archive-keyring && apt-get update
|
||||
|
||||
# Install Debian Archive Automatic Signing Key (8/jessie), see #557
|
||||
if [ "$(apt-key finger | grep '126C 0D24 BD8A 2942 CC7D F8AC 7638 D044 2B90 D010')" = "" ]; then
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1
|
||||
fi
|
||||
|
||||
# Debian Backports
|
||||
if [ "$(grep -R 'jessie-backports' /etc/apt | grep -v "^#")" = "" ]; then
|
||||
echo "deb http://http.debian.net/debian jessie-backports main" >> \
|
||||
/etc/apt/sources.list.d/backports.list
|
||||
fi
|
||||
|
||||
# Saltstack's Stable Debian repository
|
||||
if [ "$(grep -R 'jessie-saltstack' /etc/apt)" = "" ]; then
|
||||
echo "deb http://debian.saltstack.com/debian jessie-saltstack main" >> \
|
||||
/etc/apt/sources.list.d/saltstack.list
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1
|
||||
|
||||
apt-get update || return 1
|
||||
__apt_get_install_noinput -t jessie-backports libzmq3 libzmq3-dev python-zmq python-requests python-apt || return 1
|
||||
|
||||
# Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813
|
||||
__PACKAGES="procps pciutils"
|
||||
# shellcheck disable=SC2086
|
||||
@ -2137,11 +2289,6 @@ install_debian_7_deps() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install_debian_8_deps__DISABLED() {
|
||||
install_debian_7_deps || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_debian_git_deps() {
|
||||
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."
|
||||
@ -2154,12 +2301,24 @@ install_debian_git_deps() {
|
||||
# Install Keys
|
||||
__apt_get_install_noinput debian-archive-keyring && apt-get update
|
||||
|
||||
if [ "$(which git)" = "" ]; then
|
||||
__apt_get_install_noinput git || 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 \
|
||||
git || return 1
|
||||
python-jinja2 python-m2crypto python-yaml msgpack-python python-pip || return 1
|
||||
|
||||
__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
|
||||
check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'"
|
||||
pip install -U "'${__REQUIRED_TORNADO}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -2188,8 +2347,13 @@ install_debian_6_git_deps() {
|
||||
install_debian_6_deps || return 1
|
||||
if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then
|
||||
easy_install -U Jinja2 || return 1
|
||||
|
||||
if [ "$(which git)" = "" ]; then
|
||||
__apt_get_install_noinput git || return 1
|
||||
fi
|
||||
|
||||
__apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \
|
||||
python-m2crypto python-yaml msgpack-python python-pip git || return 1
|
||||
python-m2crypto python-yaml msgpack-python python-pip || return 1
|
||||
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
@ -2216,7 +2380,8 @@ install_debian_7_git_deps() {
|
||||
}
|
||||
|
||||
install_debian_8_git_deps() {
|
||||
install_debian_7_git_deps || return 1
|
||||
install_debian_8_deps || return 1
|
||||
install_debian_git_deps || return 1 # Grab the actual deps
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -2301,6 +2466,18 @@ install_debian_git_post() {
|
||||
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
|
||||
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
|
||||
|
||||
if [ -f /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
|
||||
fi
|
||||
|
||||
# Skip salt-api since the service should be opt-in and not necessarily started on boot
|
||||
[ $fname = "api" ] && continue
|
||||
|
||||
/bin/systemctl enable salt-${fname}.service
|
||||
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"
|
||||
fi
|
||||
@ -2314,6 +2491,8 @@ install_debian_git_post() {
|
||||
[ $fname = "api" ] && continue
|
||||
|
||||
update-rc.d "salt-$fname" defaults
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
@ -2329,9 +2508,15 @@ install_debian_restart_daemons() {
|
||||
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
|
||||
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue
|
||||
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
|
||||
|
||||
if [ -f /bin/systemctl ]; then
|
||||
# Debian 8 uses systemd
|
||||
/bin/systemctl stop salt-$fname > /dev/null 2>&1
|
||||
/bin/systemctl start salt-$fname.service
|
||||
elif [ -f /etc/init.d/salt-$fname ]; then
|
||||
# Still in SysV init
|
||||
/etc/init.d/salt-$fname stop > /dev/null 2>&1
|
||||
/etc/init.d/salt-$fname start
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -2345,7 +2530,11 @@ install_debian_check_services() {
|
||||
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
|
||||
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue
|
||||
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
|
||||
if [ -f /bin/systemctl ]; then
|
||||
__check_services_systemd salt-$fname || return 1
|
||||
elif [ -f /etc/init.d/salt-$fname ]; then
|
||||
__check_services_debian salt-$fname || return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@ -2363,6 +2552,8 @@ install_fedora_deps() {
|
||||
__install_saltstack_copr_zeromq_repository || return 1
|
||||
fi
|
||||
|
||||
__install_saltstack_copr_salt_repository || return 1
|
||||
|
||||
__PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests"
|
||||
|
||||
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
|
||||
@ -2418,10 +2609,22 @@ install_fedora_stable_post() {
|
||||
install_fedora_git_deps() {
|
||||
install_fedora_deps || return 1
|
||||
|
||||
yum install -y git systemd-python || return 1
|
||||
if [ "$(which git)" = "" ]; then
|
||||
yum install -y git || return 1
|
||||
fi
|
||||
|
||||
yum install -y systemd-python || return 1
|
||||
|
||||
__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
|
||||
yum install -y python-tornado
|
||||
fi
|
||||
fi
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -2506,6 +2709,13 @@ __install_epel_repository() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if epel repo is already enabled and flag it accordingly
|
||||
yum repolist | grep -i "epel" > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
__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
|
||||
@ -2556,17 +2766,45 @@ __install_saltstack_copr_salt_el5_repository() {
|
||||
return 0
|
||||
}
|
||||
|
||||
__install_saltstack_copr_salt_repository() {
|
||||
echoinfo "Adding SaltStack's COPR repository"
|
||||
|
||||
if [ "${DISTRO_NAME_L}" = "fedora" ]; then
|
||||
__REPOTYPE="${DISTRO_NAME_L}"
|
||||
else
|
||||
__REPOTYPE="epel"
|
||||
fi
|
||||
|
||||
__REPO_FILENAME="saltstack-salt-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo"
|
||||
|
||||
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
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
install_centos_stable_deps() {
|
||||
__install_epel_repository || return 1
|
||||
if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then
|
||||
__install_saltstack_copr_salt_el5_repository || return 1
|
||||
fi
|
||||
|
||||
__install_saltstack_copr_salt_repository || return 1
|
||||
|
||||
if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ] && [ "$DISTRO_MAJOR_VERSION" -gt 5 ]; then
|
||||
yum -y install python-hashlib || return 1
|
||||
__install_saltstack_copr_zeromq_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
|
||||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
yum install -y python-tornado
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
yum -y update || return 1
|
||||
fi
|
||||
@ -2678,15 +2916,34 @@ install_centos_stable_post() {
|
||||
|
||||
install_centos_git_deps() {
|
||||
install_centos_stable_deps || return 1
|
||||
if [ "$(which 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!!!!
|
||||
yum install -y git systemd-python || yum install -y git systemd-python --enablerepo=${_EPEL_REPO} || return 1
|
||||
yum install -y git || yum install -y git --enablerepo=${_EPEL_REPO} || return 1
|
||||
else
|
||||
yum install -y git systemd-python --enablerepo=${_EPEL_REPO} || return 1
|
||||
yum install -y git --enablerepo=${_EPEL_REPO} || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DISTRO_MAJOR_VERSION" -gt 6 ]; then
|
||||
if [ "$DISTRO_NAME_L" != "oracle_linux" ]; then
|
||||
yum install -y systemd-python || yum install -y systemd-python --enablerepo=${_EPEL_REPO} || return 1
|
||||
else
|
||||
yum install -y systemd-python --enablerepo=${_EPEL_REPO} || return 1
|
||||
fi
|
||||
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
|
||||
yum install -y python-tornado
|
||||
fi
|
||||
fi
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -3271,6 +3528,7 @@ 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 6 repo
|
||||
if [ "$CPU_ARCH_L" = "i686" ]; then
|
||||
EPEL_ARCH="i386"
|
||||
@ -3279,6 +3537,14 @@ install_amazon_linux_ami_deps() {
|
||||
fi
|
||||
rpm -Uvh --force "http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1
|
||||
|
||||
__REPO_FILENAME="saltstack-salt-epel-6.repo"
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
yum -y update || return 1
|
||||
fi
|
||||
@ -3308,10 +3574,22 @@ install_amazon_linux_ami_deps() {
|
||||
|
||||
install_amazon_linux_ami_git_deps() {
|
||||
install_amazon_linux_ami_deps || return 1
|
||||
|
||||
if [ "$(which git)" = "" ]; then
|
||||
yum -y install git --enablerepo=${_EPEL_REPO} || 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
|
||||
yum install -y python-tornado
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -3397,13 +3675,25 @@ 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
|
||||
pacman -Sy --noconfirm --needed git || return 1
|
||||
fi
|
||||
pacman -R --noconfirm python2-distribute
|
||||
pacman -Sy --noconfirm --needed git python2-crypto python2-setuptools python2-jinja \
|
||||
pacman -Sy --noconfirm --needed python2-crypto python2-setuptools python2-jinja \
|
||||
python2-m2crypto python2-markupsafe python2-msgpack python2-psutil python2-yaml \
|
||||
python2-pyzmq zeromq python2-requests python2-systemd || return 1
|
||||
|
||||
__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
|
||||
pacman -Sy --noconfirm --needed python2-tornado
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Let's trigger config_salt()
|
||||
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
|
||||
_TEMP_CONFIG_DIR="${__SALT_GIT_CHECKOUT_DIR}/conf/"
|
||||
@ -3651,10 +3941,22 @@ config_freebsd_salt() {
|
||||
install_freebsd_git_deps() {
|
||||
install_freebsd_9_stable_deps || return 1
|
||||
|
||||
/usr/local/sbin/pkg install -y git www/py-requests || return 1
|
||||
if [ "$(which git)" = "" ]; then
|
||||
/usr/local/sbin/pkg install -y git || return 1
|
||||
fi
|
||||
|
||||
/usr/local/sbin/pkg install -y www/py-requests || return 1
|
||||
|
||||
__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
|
||||
/usr/local/sbin/pkg install -y www/py-tornado || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echodebug "Adapting paths to FreeBSD"
|
||||
# The list of files was taken from Salt's BSD port Makefile
|
||||
for file in doc/man/salt-key.1 doc/man/salt-cp.1 doc/man/salt-minion.1 \
|
||||
@ -3662,23 +3964,23 @@ install_freebsd_git_deps() {
|
||||
doc/man/salt.7 doc/man/salt.1 doc/man/salt-call.1; do
|
||||
[ ! -f $file ] && continue
|
||||
echodebug "Patching ${file}"
|
||||
sed -in -e "s|/etc/salt|/usr/local/etc/salt|" \
|
||||
-e "s|/srv/salt|/usr/local/etc/salt/states|" \
|
||||
-e "s|/srv/pillar|/usr/local/etc/salt/pillar|" ${file}
|
||||
sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \
|
||||
-e "s|/srv/salt|${_SALT_ETC_DIR}/states|" \
|
||||
-e "s|/srv/pillar|${_SALT_ETC_DIR}/pillar|" ${file}
|
||||
done
|
||||
if [ ! -f salt/syspaths.py ]; then
|
||||
# We still can't provide the system paths, salt 0.16.x
|
||||
# Let's patch salt's source and adapt paths to what's expected on FreeBSD
|
||||
echodebug "Replacing occurrences of '/etc/salt' with '/usr/local/etc/salt'"
|
||||
echodebug "Replacing occurrences of '/etc/salt' with \'${_SALT_ETC_DIR}\'"
|
||||
# The list of files was taken from Salt's BSD port Makefile
|
||||
for file in conf/minion conf/master salt/config.py salt/client.py \
|
||||
salt/modules/mysql.py salt/utils/parsers.py salt/modules/tls.py \
|
||||
salt/modules/postgres.py salt/utils/migrations.py; do
|
||||
[ ! -f $file ] && continue
|
||||
echodebug "Patching ${file}"
|
||||
sed -in -e "s|/etc/salt|/usr/local/etc/salt|" \
|
||||
-e "s|/srv/salt|/usr/local/etc/salt/states|" \
|
||||
-e "s|/srv/pillar|/usr/local/etc/salt/pillar|" ${file}
|
||||
sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \
|
||||
-e "s|/srv/salt|${_SALT_ETC_DIR}/states|" \
|
||||
-e "s|/srv/pillar|${_SALT_ETC_DIR}/pillar|" ${file}
|
||||
done
|
||||
fi
|
||||
echodebug "Finished patching"
|
||||
@ -3686,7 +3988,7 @@ 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_salt"
|
||||
CONFIG_SALT_FUNC="config_freebsd_salt"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -3724,9 +4026,9 @@ install_freebsd_git() {
|
||||
--salt-cache-dir=/var/cache/salt \
|
||||
--salt-sock-dir=/var/run/salt \
|
||||
--salt-srv-root-dir=/srv \
|
||||
--salt-base-file-roots-dir=/usr/local/etc/salt/states \
|
||||
--salt-base-pillar-roots-dir=/usr/local/etc/salt/pillar \
|
||||
--salt-base-master-roots-dir=/usr/local/etc/salt/salt-master \
|
||||
--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 \
|
||||
|| return 1
|
||||
@ -3758,7 +4060,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 /usr/local/etc/salt/${fname}.sample ] && copyfile /usr/local/etc/salt/${fname}.sample /usr/local/etc/salt/${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
|
||||
@ -3837,7 +4139,22 @@ install_smartos_deps() {
|
||||
|
||||
install_smartos_git_deps() {
|
||||
install_smartos_deps || return 1
|
||||
|
||||
if [ "$(which git)" = "" ]; then
|
||||
pkgin -y install scmgit || 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")"
|
||||
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
|
||||
pkgin -y install py27-pip
|
||||
fi
|
||||
pip install -U "'${__REQUIRED_TORNADO}'"
|
||||
fi
|
||||
fi
|
||||
|
||||
__git_clone_and_checkout || return 1
|
||||
# Let's trigger config_salt()
|
||||
@ -3944,18 +4261,52 @@ install_smartos_restart_daemons() {
|
||||
#
|
||||
# openSUSE Install Functions.
|
||||
#
|
||||
|
||||
__ZYPPER_REQUIRES_REPLACE_FILES=-1
|
||||
|
||||
__version_lte() {
|
||||
if [ "$(which 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
|
||||
|
||||
if [ "$(python -c 'import sys; V1=tuple([int(i) for i in sys.argv[1].split(".")]); V2=tuple([int(i) for i in sys.argv[2].split(".")]); print V1<=V2' "$1" "$2")" = "True" ]; then
|
||||
__ZYPPER_REQUIRES_REPLACE_FILES=${BS_TRUE}
|
||||
else
|
||||
__ZYPPER_REQUIRES_REPLACE_FILES=${BS_FALSE}
|
||||
fi
|
||||
}
|
||||
|
||||
__zypper() {
|
||||
zypper --non-interactive "${@}"; return $?
|
||||
}
|
||||
|
||||
__zypper_install() {
|
||||
if [ "${__ZYPPER_REQUIRES_REPLACE_FILES}" = "-1" ]; then
|
||||
__version_lte "1.10.4" "$(zypper --version | awk '{ print $2 }')"
|
||||
fi
|
||||
if [ "${__ZYPPER_REQUIRES_REPLACE_FILES}" = "${BS_TRUE}" ]; then
|
||||
# In case of file conflicts replace old files.
|
||||
# Option present in zypper 1.10.4 and newer:
|
||||
# https://github.com/openSUSE/zypper/blob/95655728d26d6d5aef7796b675f4cc69bc0c05c0/package/zypper.changes#L253
|
||||
__zypper install --auto-agree-with-licenses --replacefiles "${@}"; return $?
|
||||
else
|
||||
__zypper install --auto-agree-with-licenses "${@}"; return $?
|
||||
fi
|
||||
}
|
||||
|
||||
install_opensuse_stable_deps() {
|
||||
DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
|
||||
|
||||
# Is the repository already known
|
||||
zypper repos | grep devel_languages_python >/dev/null 2>&1
|
||||
__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 --non-interactive addrepo --refresh \
|
||||
__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 --non-interactive refresh
|
||||
__zypper --gpg-auto-import-keys refresh
|
||||
if [ $? -ne 0 ] && [ $? -ne 4 ]; then
|
||||
# If the exit code is not 0, and it's not 4 (failed to update a
|
||||
# repository) return a failure. Otherwise continue.
|
||||
@ -3964,11 +4315,11 @@ install_opensuse_stable_deps() {
|
||||
|
||||
if [ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 3 ]; then
|
||||
# Because patterns-openSUSE-minimal_base-conflicts conflicts with python, lets remove the first one
|
||||
zypper --non-interactive remove patterns-openSUSE-minimal_base-conflicts
|
||||
__zypper remove patterns-openSUSE-minimal_base-conflicts
|
||||
fi
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
zypper --gpg-auto-import-keys --non-interactive update || return 1
|
||||
__zypper --gpg-auto-import-keys update || return 1
|
||||
fi
|
||||
|
||||
# Salt needs python-zypp installed in order to use the zypper module
|
||||
@ -3981,12 +4332,12 @@ install_opensuse_stable_deps() {
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
zypper --non-interactive install --auto-agree-with-licenses ${__PACKAGES} || return 1
|
||||
__zypper_install ${__PACKAGES} || return 1
|
||||
|
||||
if [ "${_EXTRA_PACKAGES}" != "" ]; then
|
||||
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
|
||||
# shellcheck disable=SC2086
|
||||
zypper --non-interactive install --auto-agree-with-licenses ${_EXTRA_PACKAGES} || return 1
|
||||
__zypper_install ${_EXTRA_PACKAGES} || return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -3994,7 +4345,12 @@ install_opensuse_stable_deps() {
|
||||
|
||||
install_opensuse_git_deps() {
|
||||
install_opensuse_stable_deps || return 1
|
||||
zypper --non-interactive install --auto-agree-with-licenses git || return 1
|
||||
|
||||
if [ "$(which git)" = "" ]; then
|
||||
__zypper_install git || return 1
|
||||
fi
|
||||
|
||||
__zypper_install patch || return 1
|
||||
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
@ -4004,6 +4360,15 @@ install_opensuse_git_deps() {
|
||||
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")"
|
||||
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/"
|
||||
@ -4025,7 +4390,7 @@ install_opensuse_stable() {
|
||||
__PACKAGES="${__PACKAGES} salt-syndic"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
zypper --non-interactive install --auto-agree-with-licenses $__PACKAGES || return 1
|
||||
__zypper_install $__PACKAGES || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -4068,7 +4433,11 @@ install_opensuse_git_post() {
|
||||
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
|
||||
|
||||
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"
|
||||
else
|
||||
copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -4142,17 +4511,17 @@ 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 devel_languages_python >/dev/null 2>&1
|
||||
if [ $? -eq 1 ]; then
|
||||
# zypper does not yet know nothing about devel_languages_python
|
||||
zypper --non-interactive addrepo --refresh \
|
||||
__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 --non-interactive refresh || return 1
|
||||
__zypper --gpg-auto-import-keys refresh || return 1
|
||||
|
||||
if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then
|
||||
zypper --gpg-auto-import-keys --non-interactive update || return 1
|
||||
__zypper --gpg-auto-import-keys update || return 1
|
||||
fi
|
||||
|
||||
# Salt needs python-zypp installed in order to use the zypper module
|
||||
@ -4175,10 +4544,9 @@ install_suse_11_stable_deps() {
|
||||
# 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 --non-interactive install --auto-agree-with-licenses 'python-M2Crypto>=0.22' || \
|
||||
zypper --non-interactive install --auto-agree-with-licenses 'python-M2Crypto>=0.21' || return 1
|
||||
__zypper_install 'python-M2Crypto>=0.22' || __zypper_install 'python-M2Crypto>=0.21' || return 1
|
||||
# shellcheck disable=SC2086,SC2090
|
||||
zypper --non-interactive install --auto-agree-with-licenses ${__PACKAGES} || return 1
|
||||
__zypper_install ${__PACKAGES} || return 1
|
||||
|
||||
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
|
||||
# There's no python-PyYaml in SP1, let's install it using pip
|
||||
@ -4217,7 +4585,7 @@ install_suse_11_stable_deps() {
|
||||
if [ "${_EXTRA_PACKAGES}" != "" ]; then
|
||||
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
|
||||
# shellcheck disable=SC2086
|
||||
zypper --non-interactive install --auto-agree-with-licenses ${_EXTRA_PACKAGES} || return 1
|
||||
__zypper_install ${_EXTRA_PACKAGES} || return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -4225,10 +4593,21 @@ install_suse_11_stable_deps() {
|
||||
|
||||
install_suse_11_git_deps() {
|
||||
install_suse_11_stable_deps || return 1
|
||||
zypper --non-interactive install --auto-agree-with-licenses git || 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/"
|
||||
@ -4380,12 +4759,12 @@ __gentoo_post_dep() {
|
||||
|
||||
install_gentoo_deps() {
|
||||
__gentoo_pre_dep || return 1
|
||||
__gentoo_post_dep
|
||||
__gentoo_post_dep || return 1
|
||||
}
|
||||
|
||||
install_gentoo_git_deps() {
|
||||
__gentoo_pre_dep || return 1
|
||||
__gentoo_post_dep
|
||||
__gentoo_post_dep || return 1
|
||||
}
|
||||
|
||||
install_gentoo_stable() {
|
||||
|
Loading…
Reference in New Issue
Block a user