"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/cloud/deploy/bootstrap-salt.sh" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

bootstrap-salt.sh  (salt-3002.1):bootstrap-salt.sh  (salt-3002.2)
skipping to change at line 26 skipping to change at line 26
# #
# COPYRIGHT: (c) 2012-2018 by the SaltStack Team, see AUTHORS.rst for more # COPYRIGHT: (c) 2012-2018 by the SaltStack Team, see AUTHORS.rst for more
# details. # details.
# #
# LICENSE: Apache 2.0 # LICENSE: Apache 2.0
# ORGANIZATION: SaltStack (saltstack.com) # ORGANIZATION: SaltStack (saltstack.com)
# CREATED: 10/15/2012 09:49:37 PM WEST # CREATED: 10/15/2012 09:49:37 PM WEST
#=============================================================================== ======================================= #=============================================================================== =======================================
set -o nounset # Treat unset variables as an error set -o nounset # Treat unset variables as an error
__ScriptVersion="2020.06.23" __ScriptVersion="2020.10.20"
__ScriptName="bootstrap-salt.sh" __ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0" __ScriptFullName="$0"
__ScriptArgs="$*" __ScriptArgs="$*"
#=============================================================================== ======================================= #=============================================================================== =======================================
# Environment variables taken into account. # Environment variables taken into account.
#------------------------------------------------------------------------------- --------------------------------------- #------------------------------------------------------------------------------- ---------------------------------------
# * BS_COLORS: If 0 disables colour support # * BS_COLORS: If 0 disables colour support
# * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed) # * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed)
skipping to change at line 295 skipping to change at line 295
Usage : ${__ScriptName} [options] <install-type> [install-type-args] Usage : ${__ScriptName} [options] <install-type> [install-type-args]
Installation types: Installation types:
- stable Install latest stable release. This is the default - stable Install latest stable release. This is the default
install type install type
- stable [branch] Install latest version on a branch. Only supported - stable [branch] Install latest version on a branch. Only supported
for packages available at repo.saltstack.com for packages available at repo.saltstack.com
- stable [version] Install a specific version. Only supported for - stable [version] Install a specific version. Only supported for
packages available at repo.saltstack.com packages available at repo.saltstack.com
To pin a 3xxx minor version, specify it as 3xxx.0
- testing RHEL-family specific: configure EPEL testing repo - testing RHEL-family specific: configure EPEL testing repo
- git Install from the head of the master branch - git Install from the head of the master branch
- git [ref] Install from any git ref (such as a branch, tag, or - git [ref] Install from any git ref (such as a branch, tag, or
commit) commit)
Examples: Examples:
- ${__ScriptName} - ${__ScriptName}
- ${__ScriptName} stable - ${__ScriptName} stable
- ${__ScriptName} stable 2017.7 - ${__ScriptName} stable 2017.7
- ${__ScriptName} stable 2017.7.2 - ${__ScriptName} stable 2017.7.2
skipping to change at line 598 skipping to change at line 599
fi fi
# Disable shell warning about unbound variable during git install # Disable shell warning about unbound variable during git install
STABLE_REV="latest" STABLE_REV="latest"
# If doing stable install, check if version specified # If doing stable install, check if version specified
elif [ "$ITYPE" = "stable" ]; then elif [ "$ITYPE" = "stable" ]; then
if [ "$#" -eq 0 ];then if [ "$#" -eq 0 ];then
STABLE_REV="latest" STABLE_REV="latest"
else else
if [ "$(echo "$1" | grep -E '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5| 2015\.8|2016\.3|2016\.11|2017\.7|2018\.3|2019\.2|3000|3001)$')" != "" ]; then if [ "$(echo "$1" | grep -E '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5| 2015\.8|2016\.3|2016\.11|2017\.7|2018\.3|2019\.2|3000|3001|3002)$')" != "" ]; th en
STABLE_REV="$1" STABLE_REV="$1"
shift shift
elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}*( elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}(\
\.[0-9]*)?)$')" != "" ]; then .[0-9]*)?)$')" != "" ]; then
if [ "$(uname)" = "Darwin" ]; then # Handle the 3xxx.0 version as 3xxx archive (pin to minor) and strip
STABLE_REV="$1" the fake ".0" suffix
else STABLE_REV=$(echo "$1" | sed -E 's/^([3-9][0-9]{3})\.0$/\1/')
STABLE_REV="archive/$1" if [ "$(uname)" != "Darwin" ]; then
STABLE_REV="archive/$STABLE_REV"
fi fi
shift shift
else else
echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2 015.5, 2015.8, 2016.3, 2016.11, 2017.7, 2018.3, 2019.2, 3000, 3001, latest, \$MA JOR.\$MINOR.\$PATCH until 2019.2, \$MAJOR or \$MAJOR.\$PATCH starting from 3000) " echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2 015.5, 2015.8, 2016.3, 2016.11, 2017.7, 2018.3, 2019.2, 3000, 3001 3002, latest, \$MAJOR.\$MINOR.\$PATCH until 2019.2, \$MAJOR or \$MAJOR.\$PATCH starting from 3000)"
exit 1 exit 1
fi fi
fi fi
fi fi
# Check for any unparsed arguments. Should be an error. # Check for any unparsed arguments. Should be an error.
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
__usage __usage
echo echo
echoerror "Too many arguments." echoerror "Too many arguments."
skipping to change at line 1294 skipping to change at line 1295
#------------------------------------------------------------------------------- --------------------------------------- #------------------------------------------------------------------------------- ---------------------------------------
# shellcheck disable=SC2034 # shellcheck disable=SC2034
__ubuntu_derivatives_translation() { __ubuntu_derivatives_translation() {
UBUNTU_DERIVATIVES="(trisquel|linuxmint|linaro|elementary_os|neon)" UBUNTU_DERIVATIVES="(trisquel|linuxmint|linaro|elementary_os|neon)"
# Mappings # Mappings
trisquel_6_ubuntu_base="12.04" trisquel_6_ubuntu_base="12.04"
linuxmint_13_ubuntu_base="12.04" linuxmint_13_ubuntu_base="12.04"
linuxmint_17_ubuntu_base="14.04" linuxmint_17_ubuntu_base="14.04"
linuxmint_18_ubuntu_base="16.04" linuxmint_18_ubuntu_base="16.04"
linuxmint_19_ubuntu_base="18.04" linuxmint_19_ubuntu_base="18.04"
linuxmint_20_ubuntu_base="20.04"
linaro_12_ubuntu_base="12.04" linaro_12_ubuntu_base="12.04"
elementary_os_02_ubuntu_base="12.04" elementary_os_02_ubuntu_base="12.04"
neon_16_ubuntu_base="16.04" neon_16_ubuntu_base="16.04"
neon_18_ubuntu_base="18.04" neon_18_ubuntu_base="18.04"
neon_20_ubuntu_base="20.04" neon_20_ubuntu_base="20.04"
# Translate Ubuntu derivatives to their base Ubuntu version # Translate Ubuntu derivatives to their base Ubuntu version
match=$(echo "$DISTRO_NAME_L" | grep -E ${UBUNTU_DERIVATIVES}) match=$(echo "$DISTRO_NAME_L" | grep -E ${UBUNTU_DERIVATIVES})
if [ "${match}" != "" ]; then if [ "${match}" != "" ]; then
skipping to change at line 1783 skipping to change at line 1785
fi fi
if [ "${DISTRO_NAME_L}" = "ubuntu" ]; then if [ "${DISTRO_NAME_L}" = "ubuntu" ]; then
# For ubuntu versions, obtain the codename from the release version # For ubuntu versions, obtain the codename from the release version
__ubuntu_codename_translation __ubuntu_codename_translation
elif [ "${DISTRO_NAME_L}" = "debian" ]; then elif [ "${DISTRO_NAME_L}" = "debian" ]; then
# For debian versions, obtain the codename from the release version # For debian versions, obtain the codename from the release version
__debian_codename_translation __debian_codename_translation
fi fi
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle| scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STA BLE_REV" != "latest" ]; then if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|gentoo|red_hat| oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
echoerror "${DISTRO_NAME} does not have major version pegged packages suppor t" echoerror "${DISTRO_NAME} does not have major version pegged packages suppor t"
exit 1 exit 1
fi fi
# Only RedHat based distros have testing support # Only RedHat based distros have testing support
if [ "${ITYPE}" = "testing" ]; then if [ "${ITYPE}" = "testing" ]; then
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(centos|red_hat|amazon|oracle)')" = "" ]; then if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(centos|red_hat|amazon|oracle)')" = "" ]; then
echoerror "${DISTRO_NAME} does not have testing packages support" echoerror "${DISTRO_NAME} does not have testing packages support"
exit 1 exit 1
fi fi
skipping to change at line 2475 skipping to change at line 2477
if rcctl get ${servicename} status; then if rcctl get ${servicename} status; then
echodebug "Service ${servicename} is enabled" echodebug "Service ${servicename} is enabled"
return 0 return 0
else else
echodebug "Service ${servicename} is NOT enabled" echodebug "Service ${servicename} is NOT enabled"
return 1 return 1
fi fi
} # ---------- end of function __check_services_openbsd ---------- } # ---------- end of function __check_services_openbsd ----------
#--- FUNCTION ---------------------------------------------------------------- --------------------------------------- #--- FUNCTION ---------------------------------------------------------------- ---------------------------------------
# NAME: __check_services_alpine # NAME: __check_services_openrc
# DESCRIPTION: Return 0 or 1 in case the service is enabled or not # DESCRIPTION: Return 0 or 1 in case the service is enabled or not
# PARAMETERS: servicename # PARAMETERS: servicename
#------------------------------------------------------------------------------- --------------------------------------- #------------------------------------------------------------------------------- ---------------------------------------
__check_services_alpine() { __check_services_openrc() {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echoerror "You need to pass a service name to check!" echoerror "You need to pass a service name to check!"
exit 1 exit 1
elif [ $# -ne 1 ]; then elif [ $# -ne 1 ]; then
echoerror "You need to pass a service name to check as the single argume nt to the function" echoerror "You need to pass a service name to check as the single argume nt to the function"
fi fi
servicename=$1 servicename=$1
echodebug "Checking if service ${servicename} is enabled" echodebug "Checking if service ${servicename} is enabled"
# shellcheck disable=SC2086,SC2046,SC2144 # shellcheck disable=SC2086,SC2046,SC2144
if rc-status $(rc-status -r) | tail -n +2 | grep -q "\\<$servicename\\>"; th en if rc-status $(rc-status -r) | tail -n +2 | grep -q "\\<$servicename\\>"; th en
echodebug "Service ${servicename} is enabled" echodebug "Service ${servicename} is enabled"
return 0 return 0
else else
echodebug "Service ${servicename} is NOT enabled" echodebug "Service ${servicename} is NOT enabled"
return 1 return 1
fi fi
} # ---------- end of function __check_services_openbsd ---------- } # ---------- end of function __check_services_openrc ----------
#--- FUNCTION ---------------------------------------------------------------- --------------------------------------- #--- FUNCTION ---------------------------------------------------------------- ---------------------------------------
# NAME: __create_virtualenv # NAME: __create_virtualenv
# DESCRIPTION: Return 0 or 1 depending on successful creation of virtualenv # DESCRIPTION: Return 0 or 1 depending on successful creation of virtualenv
#------------------------------------------------------------------------------- --------------------------------------- #------------------------------------------------------------------------------- ---------------------------------------
__create_virtualenv() { __create_virtualenv() {
if [ ! -d "$_VIRTUALENV_DIR" ]; then if [ ! -d "$_VIRTUALENV_DIR" ]; then
echoinfo "Creating virtualenv ${_VIRTUALENV_DIR}" echoinfo "Creating virtualenv ${_VIRTUALENV_DIR}"
if [ $_PIP_ALL -eq $BS_TRUE ]; then if [ $_PIP_ALL -eq $BS_TRUE ]; then
virtualenv --no-site-packages "${_VIRTUALENV_DIR}" || return 1 virtualenv --no-site-packages "${_VIRTUALENV_DIR}" || return 1
skipping to change at line 4500 skipping to change at line 4502
install_red_hat_linux_stable_deps() { install_red_hat_linux_stable_deps() {
install_centos_stable_deps || return 1 install_centos_stable_deps || return 1
return 0 return 0
} }
install_red_hat_linux_git_deps() { install_red_hat_linux_git_deps() {
install_centos_git_deps || return 1 install_centos_git_deps || return 1
return 0 return 0
} }
install_red_hat_enterprise_stable_deps() {
install_red_hat_linux_stable_deps || return 1
return 0
}
install_red_hat_enterprise_git_deps() {
install_red_hat_linux_git_deps || return 1
return 0
}
install_red_hat_enterprise_linux_stable_deps() { install_red_hat_enterprise_linux_stable_deps() {
install_red_hat_linux_stable_deps || return 1 install_red_hat_linux_stable_deps || return 1
return 0 return 0
} }
install_red_hat_enterprise_linux_git_deps() { install_red_hat_enterprise_linux_git_deps() {
install_red_hat_linux_git_deps || return 1 install_red_hat_linux_git_deps || return 1
return 0 return 0
} }
skipping to change at line 4540 skipping to change at line 4552
install_red_hat_linux_stable() { install_red_hat_linux_stable() {
install_centos_stable || return 1 install_centos_stable || return 1
return 0 return 0
} }
install_red_hat_linux_git() { install_red_hat_linux_git() {
install_centos_git || return 1 install_centos_git || return 1
return 0 return 0
} }
install_red_hat_enterprise_stable() {
install_red_hat_linux_stable || return 1
return 0
}
install_red_hat_enterprise_git() {
install_red_hat_linux_git || return 1
return 0
}
install_red_hat_enterprise_linux_stable() { install_red_hat_enterprise_linux_stable() {
install_red_hat_linux_stable || return 1 install_red_hat_linux_stable || return 1
return 0 return 0
} }
install_red_hat_enterprise_linux_git() { install_red_hat_enterprise_linux_git() {
install_red_hat_linux_git || return 1 install_red_hat_linux_git || return 1
return 0 return 0
} }
skipping to change at line 4585 skipping to change at line 4607
install_red_hat_linux_restart_daemons() { install_red_hat_linux_restart_daemons() {
install_centos_restart_daemons || return 1 install_centos_restart_daemons || return 1
return 0 return 0
} }
install_red_hat_linux_git_post() { install_red_hat_linux_git_post() {
install_centos_git_post || return 1 install_centos_git_post || return 1
return 0 return 0
} }
install_red_hat_enterprise_stable_post() {
install_red_hat_linux_stable_post || return 1
return 0
}
install_red_hat_enterprise_restart_daemons() {
install_red_hat_linux_restart_daemons || return 1
return 0
}
install_red_hat_enterprise_git_post() {
install_red_hat_linux_git_post || return 1
return 0
}
install_red_hat_enterprise_linux_stable_post() { install_red_hat_enterprise_linux_stable_post() {
install_red_hat_linux_stable_post || return 1 install_red_hat_linux_stable_post || return 1
return 0 return 0
} }
install_red_hat_enterprise_linux_restart_daemons() { install_red_hat_enterprise_linux_restart_daemons() {
install_red_hat_linux_restart_daemons || return 1 install_red_hat_linux_restart_daemons || return 1
return 0 return 0
} }
skipping to change at line 4645 skipping to change at line 4682
install_red_hat_linux_testing() { install_red_hat_linux_testing() {
install_centos_testing || return 1 install_centos_testing || return 1
return 0 return 0
} }
install_red_hat_linux_testing_post() { install_red_hat_linux_testing_post() {
install_centos_testing_post || return 1 install_centos_testing_post || return 1
return 0 return 0
} }
install_red_hat_enterprise_testing_deps() {
install_centos_testing_deps || return 1
return 0
}
install_red_hat_enterprise_testing() {
install_centos_testing || return 1
return 0
}
install_red_hat_enterprise_testing_post() {
install_centos_testing_post || return 1
return 0
}
install_red_hat_enterprise_server_testing_deps() { install_red_hat_enterprise_server_testing_deps() {
install_centos_testing_deps || return 1 install_centos_testing_deps || return 1
return 0 return 0
} }
install_red_hat_enterprise_server_testing() { install_red_hat_enterprise_server_testing() {
install_centos_testing || return 1 install_centos_testing || return 1
return 0 return 0
} }
skipping to change at line 5016 skipping to change at line 5068
install_alpine_linux_check_services() { install_alpine_linux_check_services() {
for fname in api master minion syndic; do for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily s tarted on boot # Skip salt-api since the service should be opt-in and not necessarily s tarted on boot
[ $fname = "api" ] && continue [ $fname = "api" ] && continue
# Skip if not meant to be installed # Skip if not meant to be installed
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e
__check_services_alpine salt-$fname || return 1 __check_services_openrc salt-$fname || return 1
done done
return 0 return 0
} }
daemons_running_alpine_linux() { daemons_running_alpine_linux() {
[ "${_START_DAEMONS}" -eq $BS_FALSE ] && return [ "${_START_DAEMONS}" -eq $BS_FALSE ] && return
FAILED_DAEMONS=0 FAILED_DAEMONS=0
for fname in api master minion syndic; do for fname in api master minion syndic; do
skipping to change at line 5704 skipping to change at line 5756
################################################################################ ####################################### ################################################################################ #######################################
################################################################################ ####################################### ################################################################################ #######################################
# #
# FreeBSD Install Functions # FreeBSD Install Functions
# #
# Using a separate conf step to head for idempotent install... # Using a separate conf step to head for idempotent install...
__configure_freebsd_pkg_details() { __configure_freebsd_pkg_details() {
_SALT_ETC_DIR="/usr/local/etc/salt" _SALT_ETC_DIR="/usr/local/etc/salt"
_POST_NEON_PIP_INSTALL_ARGS="--prefix=/usr/local"
} }
install_freebsd_deps() { install_freebsd_deps() {
__configure_freebsd_pkg_details __configure_freebsd_pkg_details
pkg install -y pkg pkg install -y pkg
} }
install_freebsd_git_deps() { install_freebsd_git_deps() {
install_freebsd_deps || return 1 install_freebsd_deps || return 1
skipping to change at line 5727 skipping to change at line 5780
__git_clone_and_checkout || return 1 __git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
SALT_DEPENDENCIES=$(/usr/local/sbin/pkg rquery %dn py37-salt) SALT_DEPENDENCIES=$(/usr/local/sbin/pkg rquery %dn py37-salt)
# shellcheck disable=SC2086 # shellcheck disable=SC2086
/usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} python || return 1 /usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} python || return 1
/usr/local/sbin/pkg install -y py37-requests || return 1 /usr/local/sbin/pkg install -y py37-requests || return 1
else else
/usr/local/sbin/pkg install -y python python-pip python-setuptools || re turn 1 /usr/local/sbin/pkg install -y python py37-pip py37-setuptools libzmq4 l ibunwind || return 1
fi fi
echodebug "Adapting paths to FreeBSD" echodebug "Adapting paths to FreeBSD"
# The list of files was taken from Salt's BSD port Makefile # 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 \ for file in doc/man/salt-key.1 doc/man/salt-cp.1 doc/man/salt-minion.1 \
doc/man/salt-syndic.1 doc/man/salt-master.1 doc/man/salt-run.1 \ doc/man/salt-syndic.1 doc/man/salt-master.1 doc/man/salt-run.1 \
doc/man/salt.7 doc/man/salt.1 doc/man/salt-call.1; do doc/man/salt.7 doc/man/salt.1 doc/man/salt-call.1; do
[ ! -f $file ] && continue [ ! -f $file ] && continue
echodebug "Patching ${file}" echodebug "Patching ${file}"
sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \ sed -in -e "s|/etc/salt|${_SALT_ETC_DIR}|" \
skipping to change at line 5786 skipping to change at line 5839
} }
install_freebsd_git() { install_freebsd_git() {
# /usr/local/bin/python3 in FreeBSD is a symlink to /usr/local/bin/python3.7 # /usr/local/bin/python3 in FreeBSD is a symlink to /usr/local/bin/python3.7
__PYTHON_PATH=$(readlink -f "$(command -v python3)") __PYTHON_PATH=$(readlink -f "$(command -v python3)")
__ESCAPED_PYTHON_PATH=$(echo "${__PYTHON_PATH}" | sed 's/\//\\\//g') __ESCAPED_PYTHON_PATH=$(echo "${__PYTHON_PATH}" | sed 's/\//\\\//g')
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${__PYTHON_PATH}" || return 1 __install_salt_from_repo_post_neon "${__PYTHON_PATH}" || return 1
for script in salt_api salt_master salt_minion salt_proxy salt_syndic; do
__fetch_url "/usr/local/etc/rc.d/${script}" "https://raw.githubuserconte
nt.com/freebsd/freebsd-ports/master/sysutils/py-salt/files/${script}.in" || retu
rn 1
sed -i '' 's/%%PREFIX%%/\/usr\/local/g' /usr/local/etc/rc.d/${script}
sed -i '' "s/%%PYTHON_CMD%%/${__ESCAPED_PYTHON_PATH}/g" /usr/local/etc/r
c.d/${script}
chmod +x /usr/local/etc/rc.d/${script} || return 1
done
return 0 return 0
fi fi
# Install from git # Install from git
if [ ! -f salt/syspaths.py ]; then if [ ! -f salt/syspaths.py ]; then
# We still can't provide the system paths, salt 0.16.x # We still can't provide the system paths, salt 0.16.x
${__PYTHON_PATH} setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1 ${__PYTHON_PATH} setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1
else else
${__PYTHON_PATH} setup.py \ ${__PYTHON_PATH} setup.py \
--salt-root-dir=/ \ --salt-root-dir=/ \
skipping to change at line 6902 skipping to change at line 6962
# #
# End of SUSE Enterprise General Functions # End of SUSE Enterprise General Functions
# #
################################################################################ ####################################### ################################################################################ #######################################
################################################################################ ####################################### ################################################################################ #######################################
# #
# Gentoo Install Functions. # Gentoo Install Functions.
# #
__autounmask() { __autounmask() {
emerge --autounmask-write --autounmask-only "${@}"; return $? # Unmask package(s) and accept changes
#
# Usually it's a good thing to have config files protected by portage, but
# in this case this would require to interrupt the bootstrapping script at
# this point, manually merge the changes using etc-update/dispatch-conf/
# cfg-update and then restart the bootstrapping script, so instead we allow
# at this point to modify certain config files directly
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-}
/etc/portage/package.accept_keywords
/etc/portage/package.keywords
/etc/portage/package.license
/etc/portage/package.unmask
/etc/portage/package.use"
emerge --autounmask --autounmask-continue --autounmask-only --autounmask-wri
te "${@}"; return $?
} }
__emerge() { __emerge() {
if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then EMERGE_FLAGS='-q'
emerge --getbinpkg "${@}"; return $? if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
EMERGE_FLAGS='-v'
fi fi
emerge "${@}"; return $?
}
__gentoo_config_protection() { # Do not re-emerge packages that are already installed
# usually it's a good thing to have config files protected by portage, but EMERGE_FLAGS="${EMERGE_FLAGS} --noreplace"
# in this case this would require to interrupt the bootstrapping script at
# this point, manually merge the changes using etc-update/dispatch-conf/
# cfg-update and then restart the bootstrapping script, so instead we allow
# at this point to modify certain config files directly
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-} /etc/portage/package.ac
cept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/po
rtage/package.unmask /etc/portage/package.use"
# emerge currently won't write to files that aren't there, so we need to ens if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then
ure their presence EMERGE_FLAGS="${EMERGE_FLAGS} --getbinpkg"
touch /etc/portage/package.accept_keywords /etc/portage/package.keywords /et fi
c/portage/package.license /etc/portage/package.unmask /etc/portage/package.use
# shellcheck disable=SC2086
emerge ${EMERGE_FLAGS} "${@}"; return $?
} }
__gentoo_pre_dep() { __gentoo_pre_dep() {
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
if __check_command_exists eix; then if __check_command_exists eix; then
eix-sync eix-sync
else else
emerge --sync emerge --sync
fi fi
else else
if __check_command_exists eix; then if __check_command_exists eix; then
eix-sync -q eix-sync -q
else else
emerge --sync --quiet emerge --sync --quiet
fi fi
fi fi
if [ ! -d /etc/portage ]; then if [ ! -d /etc/portage ]; then
mkdir /etc/portage mkdir /etc/portage
fi fi
}
__gentoo_post_dep() {
# ensures dev-lib/crypto++ compiles happily
__emerge --oneshot 'sys-devel/libtool'
# the -o option asks it to emerge the deps but not the package.
__gentoo_config_protection
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Enable python 3.6 if installing pre Neon Salt release
__autounmask 'dev-python/libcloud' if echo "${STABLE_REV}" | grep -q "2019" || [ "${ITYPE}" = "git" ] && [ "${_
__emerge -v 'dev-python/libcloud' POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
if ! emerge --info | sed 's/.*\(PYTHON_TARGETS="[^"]*"\).*/\1/' | grep -
q 'python3_6' ; then
echo "PYTHON_TARGETS=\"\${PYTHON_TARGETS} python3_6\"" >> /etc/porta
ge/make.conf
fi
fi fi
}
__autounmask 'dev-python/requests' __gentoo_post_dep() {
__autounmask 'app-admin/salt'
__emerge -vo 'dev-python/requests'
__emerge -vo 'app-admin/salt'
if [ "${_EXTRA_PACKAGES}" != "" ]; then if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA _PACKAGES}" echoinfo "Installing the following extra packages as requested: ${_EXTRA _PACKAGES}"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
__autounmask ${_EXTRA_PACKAGES} || return 1 __autounmask ${_EXTRA_PACKAGES} || return 1
# shellcheck disable=SC2086 # shellcheck disable=SC2086
__emerge -v ${_EXTRA_PACKAGES} || return 1 __emerge ${_EXTRA_PACKAGES} || return 1
fi fi
return 0
} }
install_gentoo_deps() { install_gentoo_deps() {
__gentoo_pre_dep || return 1 __gentoo_pre_dep || return 1
# Make sure that the 'libcloud' use flag is set when Salt Cloud support is r
equested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
SALT_USE_FILE='/etc/portage/package.use'
if [ -d '/etc/portage/package.use' ]; then
SALT_USE_FILE='/etc/portage/package.use/salt'
fi
SALT_USE_FLAGS="$(grep -E '^[<>=~]*app-admin/salt.*' ${SALT_USE_FILE} 2>
/dev/null)"
SALT_USE_FLAG_LIBCLOUD="$(echo "${SALT_USE_FLAGS}" | grep ' libcloud' 2>
/dev/null)"
# Set the libcloud use flag, if it is not set yet
if [ -z "${SALT_USE_FLAGS}" ]; then
echo "app-admin/salt libcloud" >> ${SALT_USE_FILE}
elif [ -z "${SALT_USE_FLAG_LIBCLOUD}" ]; then
sed 's#^\([<>=~]*app-admin/salt[^ ]*\)\(.*\)#\1 libcloud\2#g' -i ${S
ALT_USE_FILE}
fi
fi
__gentoo_post_dep || return 1 __gentoo_post_dep || return 1
} }
install_gentoo_git_deps() { install_gentoo_git_deps() {
__gentoo_pre_dep || return 1 __gentoo_pre_dep || return 1
GENTOO_GIT_PACKAGES=""
# Install pip if it does not exist
if ! __check_command_exists pip ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/pip"
fi
# Install GIT if it does not exist
if ! __check_command_exists git ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-vcs/git"
fi
# Salt <3000 does not automatically install dependencies. It has to be done
manually.
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
# Install Python 3.6 if it does not exist
if ! __check_command_exists python3.6 ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-lang/python:3.6"
fi
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES}
sys-apps/pciutils
dev-python/pyyaml
dev-python/pyzmq
dev-python/libnacl
dev-python/pycryptodome
dev-python/py
dev-python/requests
dev-python/msgpack
dev-python/jinja
dev-python/pyasn1
dev-python/markupsafe
dev-python/cython
dev-python/six
dev-python/idna
dev-python/pycurl
<www-servers/tornado-5.0"
fi
# Install libcloud when Salt Cloud support was requested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/libcloud"
fi
if [ -n "${GENTOO_GIT_PACKAGES}" ]; then
# shellcheck disable=SC2086
__autounmask ${GENTOO_GIT_PACKAGES} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_GIT_PACKAGES} || return 1
fi
__git_clone_and_checkout || return 1
__gentoo_post_dep || return 1 __gentoo_post_dep || return 1
} }
install_gentoo_stable() { install_gentoo_stable() {
__gentoo_config_protection GENTOO_SALT_PACKAGE="app-admin/salt"
__emerge -v 'app-admin/salt' || return 1
STABLE_REV_WITHOUT_PREFIX=$(echo "${STABLE_REV}" | sed 's#archive/##')
if [ "${STABLE_REV_WITHOUT_PREFIX}" != "latest" ]; then
GENTOO_SALT_PACKAGE="=app-admin/salt-${STABLE_REV_WITHOUT_PREFIX}*"
fi
# shellcheck disable=SC2086
__autounmask ${GENTOO_SALT_PACKAGE} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_SALT_PACKAGE} || return 1
} }
install_gentoo_git() { install_gentoo_git() {
__gentoo_config_protection if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__emerge -v '=app-admin/salt-9999' || return 1 __install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
# Tornado 4.3 ebuild supports only Python 3.6, use Python 3.6 as the default
Python 3 interpreter
if [ "$_PY_EXE" = "python3" ] || [ -z "$_PY_EXE" ]; then
_PYEXE=python3.6
else
_PYEXE=${_PY_EXE}
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
"${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir
="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1
else
"${_PYEXE}" setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1
fi
return 0
} }
install_gentoo_post() { install_gentoo_post() {
for fname in api master minion syndic; do for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily s tarted on boot # Skip salt-api since the service should be opt-in and not necessarily s tarted on boot
[ $fname = "api" ] && continue [ $fname = "api" ] && continue
# Skip if not meant to be installed # Skip if not meant to be installed
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e
if [ -d "/run/systemd/system" ]; then if __check_command_exists systemctl ; then
systemctl enable salt-$fname.service systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl start salt-$fname.service systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else else
rc-update add salt-$fname default # Salt minion cannot start in a docker container because the "net" s
/etc/init.d/salt-$fname start ervice is not available
if [ $fname = "minion" ] && [ -f /.dockerenv ]; then
sed '/need net/d' -i /etc/init.d/salt-$fname
fi
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi
done
}
install_gentoo_git_post() {
for fname in api master minion syndic; do
# Skip if not meant to be installed
[ $fname = "api" ] && \
([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "s
alt-${fname}") && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu
e
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu
e
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu
e
if __check_command_exists systemctl ; then
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/l
ib/systemd/system/salt-${fname}.service"
# Skip salt-api since the service should be opt-in and not necessari
ly started on boot
[ $fname = "api" ] && continue
systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else
cat <<_eof > "/etc/init.d/salt-${fname}"
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-${fname}"
command_args="\${SALT_OPTS}"
command_background="1"
pidfile="/var/run/salt-${fname}.pid"
name="SALT ${fname} daemon"
retry="20"
depend() {
use net logger
}
_eof
chmod +x /etc/init.d/salt-$fname
cat <<_eof > "/etc/conf.d/salt-${fname}"
# /etc/conf.d/salt-${fname}: config file for /etc/init.d/salt-master
# see man pages for salt-${fname} or run 'salt-${fname} --help'
# for valid cmdline options
SALT_OPTS="--log-level=warning"
_eof
# Skip salt-api since the service should be opt-in and not necessari
ly started on boot
[ $fname = "api" ] && continue
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi fi
done done
return 0
} }
install_gentoo_restart_daemons() { install_gentoo_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return [ $_START_DAEMONS -eq $BS_FALSE ] && return
# Ensure upstart configs / systemd units are loaded
if __check_command_exists systemctl ; then
systemctl daemon-reload
fi
for fname in api master minion syndic; do for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily s tarted on boot # Skip salt-api since the service should be opt-in and not necessarily s tarted on boot
[ $fname = "api" ] && continue [ $fname = "api" ] && continue
# Skip if not meant to be installed # Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e
if [ -d "/run/systemd/system" ]; then if __check_command_exists systemctl ; then
systemctl stop salt-$fname > /dev/null 2>&1 systemctl stop salt-$fname > /dev/null 2>&1
systemctl start salt-$fname.service && continue systemctl start salt-$fname.service && continue
echodebug "Failed to start salt-$fname using systemd" echodebug "Failed to start salt-$fname using systemd"
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
systemctl status salt-$fname.service systemctl status salt-$fname.service
journalctl -xe journalctl -xe
fi fi
else else
/etc/init.d/salt-$fname stop > /dev/null 2>&1 # Disable stdin to fix shell session hang on killing tee pipe
/etc/init.d/salt-$fname start rc-service salt-$fname stop < /dev/null > /dev/null 2>&1
rc-service salt-$fname start < /dev/null || return 1
fi fi
done done
return 0
} }
install_gentoo_check_services() { install_gentoo_check_services() {
if [ ! -d "/run/systemd/system" ]; then
# Not running systemd!? Don't check!
return 0
fi
for fname in api master minion syndic; do for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily s tarted on boot # Skip salt-api since the service should be opt-in and not necessarily s tarted on boot
[ $fname = "api" ] && continue [ $fname = "api" ] && continue
# Skip if not meant to be installed # Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continu e
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continu e
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continu e
__check_services_systemd salt-$fname || return 1 if __check_command_exists systemctl ; then
__check_services_systemd salt-$fname || return 1
else
__check_services_openrc salt-$fname || return 1
fi
done done
return 0 return 0
} }
# #
# End of Gentoo Install Functions. # End of Gentoo Install Functions.
# #
################################################################################ ####################################### ################################################################################ #######################################
################################################################################ ####################################### ################################################################################ #######################################
 End of changes. 42 change blocks. 
68 lines changed or deleted 317 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)