Update to latest stable bootstrap script, v1.5.9

This commit is contained in:
Pedro Algarvio 2013-11-14 18:07:37 +00:00
parent 2c53c11793
commit d34439d616

View File

@ -17,7 +17,7 @@
# CREATED: 10/15/2012 09:49:37 PM WEST
#===============================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="1.5.8"
__ScriptVersion="1.5.9"
__ScriptName="bootstrap-salt.sh"
#===============================================================================
@ -133,6 +133,7 @@ usage() {
$ ${__ScriptName} daily
$ ${__ScriptName} git
$ ${__ScriptName} git develop
$ ${__ScriptName} git v0.17.0
$ ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357
Options:
@ -146,6 +147,7 @@ usage() {
-M Also install salt-master
-S Also install salt-syndic
-N Do not install salt-minion
-X Do not start daemons after installation
-C Only run the configuration function. This option automatically
bypasses any installation.
-P Allow pip based installations. On some distributions the required salt
@ -229,6 +231,7 @@ _TEMP_KEYS_DIR="null"
_INSTALL_MASTER=$BS_FALSE
_INSTALL_SYNDIC=$BS_FALSE
_INSTALL_MINION=$BS_TRUE
_START_DAEMONS=$BS_TRUE
_ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE}
_CONFIG_ONLY=$BS_FALSE
_PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE}
@ -241,7 +244,7 @@ _UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE}
# __SIMPLIFY_VERSION is mostly used in Solaris based distributions
__SIMPLIFY_VERSION=$BS_TRUE
while getopts ":hvnDc:k:MSNCPFUK" opt
while getopts ":hvnDc:k:MSNXCPFUK" opt
do
case "${opt}" in
@ -271,6 +274,7 @@ do
M ) _INSTALL_MASTER=$BS_TRUE ;;
S ) _INSTALL_SYNDIC=$BS_TRUE ;;
N ) _INSTALL_MINION=$BS_FALSE ;;
X ) _START_DAEMONS=$BS_FALSE ;;
C ) _CONFIG_ONLY=$BS_TRUE ;;
P ) _PIP_ALLOWED=$BS_TRUE ;;
F ) _FORCE_OVERWRITE=$BS_TRUE ;;
@ -858,6 +862,10 @@ if [ $_INSTALL_SYNDIC -eq $BS_TRUE ]; then
fi
fi
if [ $_START_DAEMONS -eq $BS_FALSE ]; then
echoinfo "Daemons will not be started"
fi
# Simplify distro name naming on functions
DISTRO_NAME_L=$(echo $DISTRO_NAME | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -re 's/([[:space:]])+/_/g')
@ -1189,13 +1197,13 @@ movefile() {
#
# Optionally, define a salt master pre-seed function, which will be called if
# the -k (pre-seed master keys) option is passed. One of:
# 1. pressed_<distro>_<major_version>_<install_type>_master
# 2. pressed_<distro>_<major_version>_<minor_version>_<install_type>_master
# 3. pressed_<distro>_<major_version>_master
# 4 pressed_<distro>_<major_version>_<minor_version>_master
# 5. pressed_<distro>_<install_type>_master
# 6. pressed_<distro>_master
# 7. pressed_master [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
# 1. preseed_<distro>_<major_version>_<install_type>_master
# 2. preseed_<distro>_<major_version>_<minor_version>_<install_type>_master
# 3. preseed_<distro>_<major_version>_master
# 4 preseed_<distro>_<major_version>_<minor_version>_master
# 5. preseed_<distro>_<install_type>_master
# 6. preseed_<distro>_master
# 7. preseed_master [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
#
# To install salt, which, of course, is required, one of:
# 1. install_<distro>_<major_version>_<install_type>
@ -1251,8 +1259,8 @@ __enable_universe_repository() {
install_ubuntu_deps() {
apt-get update
if [ $DISTRO_MAJOR_VERSION -gt 12 ] || [ $DISTRO_MAJOR_VERSION -eq 12 && $DISTRO_MINOR_VERSION -eq 10 ]; then
# Above Ubuntu 11.10 add-apt-repository is in a different package
if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -eq 10 ]); then
# Above Ubuntu 12.04 add-apt-repository is in a different package
__apt_get_install_noinput software-properties-common || return 1
else
__apt_get_install_noinput python-software-properties || return 1
@ -1377,6 +1385,8 @@ install_ubuntu_git_post() {
}
install_ubuntu_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
# Ensure upstart configs are loaded
[ -f /sbin/initctl ] && /sbin/initctl reload-configuration
for fname in minion master syndic; do
@ -1440,7 +1450,7 @@ install_debian_6_deps() {
if [ $_PIP_ALLOWED -eq $BS_TRUE ]; then
echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3"
echowarn "This is required for long term stable minion connections to the master."
echowarn "YOU WILL END UP WILL QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE"
echowarn "YOU WILL END UP WITH QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE"
echowarn "Sleeping for 3 seconds so you can cancel..."
sleep 3
@ -1511,7 +1521,7 @@ install_debian_7_deps() {
if [ $_PIP_ALLOWED -eq $BS_TRUE ]; then
echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3"
echowarn "This is required for long term stable minion connections to the master."
echowarn "YOU WILL END UP WILL QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE"
echowarn "YOU WILL END UP WITH QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE"
echowarn "Sleeping for 3 seconds so you can cancel..."
sleep 3
@ -1676,6 +1686,8 @@ install_debian_git_post() {
}
install_debian_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -1756,6 +1768,8 @@ install_fedora_git_post() {
}
install_fedora_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -1881,6 +1895,8 @@ install_centos_git_post() {
}
install_centos_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $_INSTALL_MINION -eq $BS_FALSE ] && continue
@ -2183,7 +2199,8 @@ install_arch_linux_git_deps() {
install_arch_linux_stable_deps
pacman -Sy --noconfirm pacman || return 1
pacman -R --noconfirm python2-distribute || return 1
# Don't fail if un-installing python2-distribute threw an error
pacman -R --noconfirm python2-distribute
pacman -Sy --noconfirm git python2-crypto python2-setuptools \
python2-jinja python2-m2crypto python2-markupsafe python2-msgpack \
python2-psutil python2-yaml python2-pyzmq zeromq || return 1
@ -2275,6 +2292,8 @@ install_arch_linux_git_post() {
}
install_arch_linux_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -2465,6 +2484,8 @@ install_freebsd_git_post() {
}
install_freebsd_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -2590,6 +2611,8 @@ install_smartos_git_post() {
}
install_smartos_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -2637,7 +2660,7 @@ install_opensuse_stable_deps() {
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
python-Jinja2 python-M2Crypto python-PyYAML python-msgpack-python \
python-pycrypto python-pyzmq || return 1
python-pycrypto python-pyzmq python-xml || return 1
return 0
}
@ -2719,6 +2742,8 @@ install_opensuse_git_post() {
}
install_opensuse_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -2767,13 +2792,13 @@ install_suse_11_stable_deps() {
echowarn "PyYaml will be installed using pip"
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
python-Jinja2 'python-M2Crypto>=0.21' python-msgpack-python \
python-pycrypto python-pyzmq python-pip || return 1
python-pycrypto python-pyzmq python-pip python-xml || return 1
# There's no python-PyYaml in SP1, let's install it using pip
pip install PyYaml || return 1
else
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
python-Jinja2 'python-M2Crypto>=0.21' python-PyYAML python-msgpack-python \
python-pycrypto python-pyzmq || return 1
python-pycrypto python-pyzmq python-xml || return 1
fi
# PIP based installs need to copy configuration files "by hand".
@ -2961,6 +2986,8 @@ install_gentoo_post() {
}
install_gentoo_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic; do
# Skip if not meant to be installed
@ -3105,6 +3132,8 @@ preseed_master() {
# This function checks if all of the installed daemons are running or not.
#
daemons_running() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
FAILED_DAEMONS=0
for fname in minion master syndic; do
@ -3348,7 +3377,7 @@ if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then
fi
# Check if the installed daemons are running or not
if [ "$DAEMONS_RUNNING_FUNC" != "null" ]; then
if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; then
sleep 3 # Sleep a little bit to let daemons start
echoinfo "Running ${DAEMONS_RUNNING_FUNC}()"
$DAEMONS_RUNNING_FUNC