diff --git a/AUTHORS.rst b/AUTHORS.rst index 75efda4bd..1f824bd44 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -30,13 +30,12 @@ Brandon Clifford brandon099 brandon.clifford@vivint.com Bret Fisher BretFisher bret@fishbrains.com Brian Kruger bkruger99 brian.kruger@elliemae.com bruce-one bruce-one -Вячеслав Спиридонов sp1r +Bryce Larson bryceml C. R. Oldham cro cr@saltstack.com Cam camereonsparr Charles McLaughlin cmclaughlin -Megan Wilhite Ch3LL megan.wilhite@gmail.com -Chris Rebert cvrebert chris.rebert@hulu.com Chris Buechler cbuechler cmb@pfsense.org +Chris Rebert cvrebert chris.rebert@hulu.com Christer Edwards cedwards Christian McHugh mchugh19 Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com @@ -60,13 +59,14 @@ Eric Radman eradman ericshane@eradman.com Erik Ankrom erikankrom Erik Johnson terminalmage erik@saltstack.com EYJ eyj +Felippe Burk felippeb fizmat fizmat Forrest Alvarez gravyboat Fred Reimer freimer freimer@freimer.org Gareth J. Greenaway garethgreenaway gareth@wiked.org +gdm85 gdm85 Geoff Garside geoffgarside geoff@geoffgarside.co.uk George aflat gstock.public@gmail.com -gdm85 gdm85 ggillies ggillies Giuseppe Iannello giannello giuseppe.iannello@brokenloop.net Gregory Meno GregMeno gregory.meno@inktank.com @@ -74,8 +74,9 @@ Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be gweis gweis Henrik Holmboe holmboe Howard Mei HowardMei howardleomei@gmail.com -Jan Heidbrink jheidbrink James Booth absolutejam vvalentine1337@gmail.com +Jan Heidbrink jheidbrink +Jared Bristow jars99 Jared E Stroud jaredestroud jaredestroud@gmail.com Jasper Lievisse Adriaanse jasperla jasper@humppa.nl JD decomposite @@ -89,8 +90,8 @@ Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com Ky-Anh Huynh icy -lomeroe lomeroe Liu Xiaohui oreh herolxh@gmail.com +lomeroe lomeroe Lorenzo Perone lopezio lorenzo.perone@yellowspace.net Lubomir Host lhost luthes luthes steve.luther@gmail.com @@ -106,6 +107,7 @@ Matthew Mead-Briggs mattmb Matthew Richardson mrichar1 Matthew Willson ixela Matthieu Guegan mguegan +Megan Wilhite Ch3LL megan.wilhite@gmail.com mfapouw mfapouw Michael A. Smith kojiromike michaels@syapse.com Michael Scherer mscherer @@ -164,4 +166,6 @@ Wout wfhg Yann Masson ymasson Yoan Blanc greut yoan@dosimple.ch Yushi Nakai nyushi +Zahiar Ahmed zahiar +Вячеслав Спиридонов sp1r ========================== ===================== ============================ diff --git a/ChangeLog b/ChangeLog index afd94dc96..80021962e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ Version TBD (In Progress on the Develop Branch): +Version 2019.10.03: + * Fix possible typo with `gnupg-curl` vs `gnupg curl` (zahiar) + * Install only python3 packges if requested on ubuntu (noelmcloughlin) #1356 + * Fixing debian wheezy (bryceml) #1359 + * Fixed Amazon Linux 2 detection when lsb_release is installed (jars99) #1361 + * Mac OS Support (felippeb) #1363 #1364 #1365 #1366 + Version 2019.05.20: * Allow stable version selection for amazon linux (puluanau) #1328 * FreeBSD 12 support (sticky-note) #1329 diff --git a/README.rst b/README.rst index 9796746e7..ce512eba1 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file. The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: +- 2019.05.20: ``46fb5e4b7815efafd69fd703f033fe86e7b584b6770f7e0b936995bcae1cedd8`` - 2019.02.27: ``23728e4b5e54f564062070e3be53c5602b55c24c9a76671968abbf3d609258cb`` - 2019.01.08: ``ab7f29b75711da4bb79aff98d46654f910d569ebe3e908753a3c5119017bb163`` - 2018.08.15: ``6d414a39439a7335af1b78203f9d37e11c972b3c49c519742c6405e2944c6c4b`` diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a4de8713c..78554484a 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -23,7 +23,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2019.05.20" +__ScriptVersion="2019.10.03" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -601,7 +601,11 @@ elif [ "$ITYPE" = "stable" ]; then STABLE_REV="$1" shift elif [ "$(echo "$1" | grep -E '^([0-9]*\.[0-9]*\.[0-9]*)$')" != "" ]; then - STABLE_REV="archive/$1" + if [ "$(uname)" = "Darwin" ]; then + STABLE_REV="$1" + else + STABLE_REV="archive/$1" + fi shift else echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, 2016.3, 2016.11, 2017.7, 2018.3, 2019.2, latest, \$MAJOR.\$MINOR.\$PATCH)" @@ -667,7 +671,11 @@ fi # Check if we're installing via a different Python executable and set major version variables if [ -n "$_PY_EXE" ]; then - _PY_PKG_VER=$(echo "$_PY_EXE" | sed -r "s/\\.//g") + if [ "$(uname)" = "Darwin" ]; then + _PY_PKG_VER=$(echo "$_PY_EXE" | sed "s/\\.//g") + else + _PY_PKG_VER=$(echo "$_PY_EXE" | sed -r "s/\\.//g") + fi _PY_MAJOR_VERSION=$(echo "$_PY_PKG_VER" | cut -c 7) if [ "$_PY_MAJOR_VERSION" != 3 ] && [ "$_PY_MAJOR_VERSION" != 2 ]; then @@ -1001,7 +1009,7 @@ __gather_linux_system_info() { elif [ "${DISTRO_NAME}" = "OracleServer" ]; then # This the Oracle Linux Server 6.5 DISTRO_NAME="Oracle Linux" - elif [ "${DISTRO_NAME}" = "AmazonAMI" ]; then + elif [ "${DISTRO_NAME}" = "AmazonAMI" ] || [ "${DISTRO_NAME}" = "Amazon" ]; then DISTRO_NAME="Amazon Linux AMI" elif [ "${DISTRO_NAME}" = "ManjaroLinux" ]; then DISTRO_NAME="Arch Linux" @@ -1243,6 +1251,16 @@ __gather_bsd_system_info() { } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __gather_osx_system_info +# DESCRIPTION: Discover MacOS X +#---------------------------------------------------------------------------------------------------------------------- +__gather_osx_system_info() { + DISTRO_NAME="MacOSX" + DISTRO_VERSION=$(sw_vers -productVersion) +} + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __gather_system_info # DESCRIPTION: Discover which system and distribution we are running. @@ -1258,6 +1276,9 @@ __gather_system_info() { openbsd|freebsd|netbsd ) __gather_bsd_system_info ;; + darwin ) + __gather_osx_system_info + ;; * ) echoerror "${OS_NAME} not supported."; exit 1 @@ -1448,6 +1469,7 @@ __debian_derivatives_translation() { linuxmint_1_debian_base="8.0" raspbian_8_debian_base="8.0" raspbian_9_debian_base="9.0" + raspbian_10_debian_base="10.0" bunsenlabs_9_debian_base="9.0" turnkey_9_debian_base="9.0" @@ -2648,13 +2670,12 @@ __install_saltstack_ubuntu_repository() { UBUNTU_CODENAME=${DISTRO_CODENAME} fi - __PACKAGES='' - # Install downloader backend for GPG keys fetching - if [ "$DISTRO_MAJOR_VERSION" -gt 16 ]; then - __PACKAGES="${__PACKAGES} gnupg dirmngr" - else - __PACKAGES="${__PACKAGES} gnupg-curl" + __PACKAGES='wget' + + # Required as it is not installed by default on Ubuntu 18+ + if [ "$DISTRO_MAJOR_VERSION" -ge 18 ]; then + __PACKAGES="${__PACKAGES} gnupg" fi # Make sure https transport is available @@ -2698,6 +2719,12 @@ install_ubuntu_deps() { __PACKAGES="upstart" fi + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + PY_PKG_VER=3 + else + PY_PKG_VER="" + fi + if [ "$DISTRO_MAJOR_VERSION" -ge 16 ] && [ -z "$_PY_EXE" ]; then __PACKAGES="${__PACKAGES} python2.7" fi @@ -2706,13 +2733,13 @@ install_ubuntu_deps() { __PACKAGES="${__PACKAGES} python-virtualenv" fi # Need python-apt for managing packages via Salt - __PACKAGES="${__PACKAGES} python-apt" + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-apt" # requests is still used by many salt modules - __PACKAGES="${__PACKAGES} python-requests" + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-requests" # YAML module is used for generating custom master/minion configs - __PACKAGES="${__PACKAGES} python-yaml" + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-yaml" # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" @@ -3049,13 +3076,12 @@ __install_saltstack_debian_repository() { __PY_VERSION_REPO="py3" fi - __PACKAGES='' - # Install downloader backend for GPG keys fetching + __PACKAGES='wget' + + # Required as it is not installed by default on Debian 9+ if [ "$DISTRO_MAJOR_VERSION" -ge 9 ]; then - __PACKAGES="${__PACKAGES} gnupg2 dirmngr" - else - __PACKAGES="${__PACKAGES} gnupg-curl" + __PACKAGES="${__PACKAGES} gnupg2" fi # Make sure https transport is available @@ -3375,14 +3401,8 @@ install_debian_git_post() { # Install initscripts for Debian 7 "Wheezy" 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}/pkg/salt-$fname.init" ]; then - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.init" "/etc/init.d/salt-${fname}" - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.environment" "/etc/default/salt-${fname}" - else - # Make sure wget is available - __check_command_exists wget || __apt_get_install_noinput wget || return 1 - __fetch_url "/etc/init.d/salt-${fname}" "${HTTP_VAL}://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" - fi + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.init" "/etc/init.d/salt-${fname}" + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.environment" "/etc/default/salt-${fname}" if [ ! -f "/etc/init.d/salt-${fname}" ]; then echowarn "The init script for salt-${fname} was not found, skipping it..." @@ -6611,6 +6631,117 @@ daemons_running_voidlinux() { # ####################################################################################################################### +####################################################################################################################### +# +# OS X / Darwin Install Functions +# + +__macosx_get_packagesite() { + DARWIN_ARCH="x86_64" + + __PY_VERSION_REPO="py2" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __PY_VERSION_REPO="py3" + fi + + PKG="salt-${STABLE_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}.pkg" + SALTPKGCONFURL="https://repo.saltstack.com/osx/${PKG}" +} + +# Using a separate conf step to head for idempotent install... +__configure_macosx_pkg_details() { + __macosx_get_packagesite || return 1 + return 0 +} + +install_macosx_stable_deps() { + __configure_macosx_pkg_details || return 1 + return 0 +} + +install_macosx_git_deps() { + install_macosx_stable_deps || return 1 + + __fetch_url "/tmp/get-pip.py" "https://bootstrap.pypa.io/get-pip.py" || return 1 + + if [ -n "$_PY_EXE" ]; then + _PYEXE=${_PY_EXE} + else + _PYEXE=python2.7 + fi + + # Install PIP + $_PYEXE /tmp/get-pip.py || return 1 + + __git_clone_and_checkout || return 1 + + __PIP_REQUIREMENTS="dev_python27.txt" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __PIP_REQUIREMENTS="dev_python34.txt" + fi + + requirements_file="${_SALT_GIT_CHECKOUT_DIR}/requirements/${__PIP_REQUIREMENTS}" + pip install -U -r "${requirements_file}" --install-option="--prefix=/opt/salt" || return 1 + + return 0 +} + +install_macosx_stable() { + install_macosx_stable_deps || return 1 + + /usr/bin/curl "${SALTPKGCONFURL}" > "/tmp/${PKG}" || return 1 + + /usr/sbin/installer -pkg "/tmp/${PKG}" -target / || return 1 + + return 0 +} + +install_macosx_git() { + + if [ -n "$_PY_EXE" ]; then + _PYEXE=${_PY_EXE} + else + _PYEXE=python2.7 + 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 --prefix=/opt/salt || return 1 + else + $_PYEXE setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/opt/salt || return 1 + fi + + return 0 +} + +install_macosx_stable_post() { + if [ ! -f /etc/paths.d/salt ]; then + print "%s\n" "/opt/salt/bin" "/usr/local/sbin" > /etc/paths.d/salt + fi + + # shellcheck disable=SC1091 + . /etc/profile + + return 0 +} + +install_macosx_git_post() { + install_macosx_stable_post || return 1 + return 0 +} + +install_macosx_restart_daemons() { + [ $_START_DAEMONS -eq $BS_FALSE ] && return + + /bin/launchctl unload -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist || return 1 + /bin/launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist || return 1 + + return 0 +} +# +# Ended OS X / Darwin Install Functions +# +####################################################################################################################### + ####################################################################################################################### # # Default minion configuration function. Matches ANY distribution as long as