|
17 | 17 | # CREATED: 10/15/2012 09:49:37 PM WEST |
18 | 18 | #====================================================================================================================== |
19 | 19 | set -o nounset # Treat unset variables as an error |
20 | | -__ScriptVersion="2014.10.14" |
| 20 | + |
| 21 | +__ScriptVersion="2014.10.21" |
21 | 22 | __ScriptName="bootstrap-salt.sh" |
22 | 23 |
|
23 | 24 | #====================================================================================================================== |
@@ -202,6 +203,7 @@ _INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE} |
202 | 203 | _WGET_ARGS=${BS_WGET_ARGS:-} |
203 | 204 | _CURL_ARGS=${BS_CURL_ARGS:-} |
204 | 205 | _FETCH_ARGS=${BS_FETCH_ARGS:-} |
| 206 | +_ENABLE_EXTERNAL_ZMQ_REPOS=${BS_ENABLE_EXTERNAL_ZMQ_REPOS:-$BS_FALSE} |
205 | 207 | _SALT_MASTER_ADDRESS=${BS_SALT_MASTER_ADDRESS:-null} |
206 | 208 | _SALT_MINION_ID="null" |
207 | 209 | # __SIMPLIFY_VERSION is mostly used in Solaris based distributions |
@@ -271,12 +273,13 @@ usage() { |
271 | 273 | -p Extra-package to install while installing salt dependencies. One package |
272 | 274 | per -p flag. You're responsible for providing the proper package name. |
273 | 275 | -H Use the specified http proxy for the installation |
| 276 | + -Z Enable external software source for newer ZeroMQ(Only available for RHEL/CentOS/Fedora based distributions) |
274 | 277 |
|
275 | 278 | EOT |
276 | 279 | } # ---------- end of function usage ---------- |
277 | 280 |
|
278 | 281 |
|
279 | | -while getopts ":hvnDc:g:k:MSNXCPFUKIA:i:Lp:H:" opt |
| 282 | +while getopts ":hvnDc:g:k:MSNXCPFUKIA:i:Lp:H:Z" opt |
280 | 283 | do |
281 | 284 | case "${opt}" in |
282 | 285 |
|
|
319 | 322 | L ) _INSTALL_CLOUD=$BS_TRUE ;; |
320 | 323 | p ) _EXTRA_PACKAGES="$_EXTRA_PACKAGES $OPTARG" ;; |
321 | 324 | H ) _HTTP_PROXY="$OPTARG" ;; |
| 325 | + Z) _ENABLE_EXTERNAL_ZMQ_REPOS=$BS_TRUE ;; |
322 | 326 |
|
323 | 327 |
|
324 | 328 | \?) echo |
@@ -1124,7 +1128,10 @@ __git_clone_and_checkout() { |
1124 | 1128 |
|
1125 | 1129 | echodebug "Installed git version: $(git --version | awk '{ print $3 }')" |
1126 | 1130 |
|
1127 | | - __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}") |
| 1131 | + local __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null) |
| 1132 | + __SALT_GIT_CHECKOUT_PARENT_DIR="${__SALT_GIT_CHECKOUT_PARENT_DIR:-/tmp/git}" |
| 1133 | + local __SALT_CHECKOUT_REPONAME="$(basename "${__SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)" |
| 1134 | + __SALT_CHECKOUT_REPONAME="${__SALT_CHECKOUT_REPONAME:-salt}" |
1128 | 1135 | [ -d "${__SALT_GIT_CHECKOUT_PARENT_DIR}" ] || mkdir "${__SALT_GIT_CHECKOUT_PARENT_DIR}" |
1129 | 1136 | cd "${__SALT_GIT_CHECKOUT_PARENT_DIR}" |
1130 | 1137 | if [ -d "${__SALT_GIT_CHECKOUT_DIR}" ]; then |
@@ -1170,25 +1177,25 @@ __git_clone_and_checkout() { |
1170 | 1177 | if [ "$(git clone --help | grep 'single-branch')" != "" ]; then |
1171 | 1178 | # The "--single-branch" option is supported, attempt shallow cloning |
1172 | 1179 | echoinfo "Attempting to shallow clone $GIT_REV from Salt's repository ${_SALT_REPO_URL}" |
1173 | | - git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" |
| 1180 | + git clone --depth 1 --branch "$GIT_REV" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" |
1174 | 1181 | if [ $? -eq 0 ]; then |
1175 | 1182 | cd "${__SALT_GIT_CHECKOUT_DIR}" |
1176 | 1183 | __SHALLOW_CLONE="${BS_TRUE}" |
1177 | 1184 | else |
1178 | 1185 | # Shallow clone above failed(missing upstream tags???), let's resume the old behaviour. |
1179 | 1186 | echowarn "Failed to shallow clone." |
1180 | 1187 | echoinfo "Resuming regular git clone and remote SaltStack repository addition procedure" |
1181 | | - git clone "$_SALT_REPO_URL" || return 1 |
| 1188 | + git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 |
1182 | 1189 | cd "${__SALT_GIT_CHECKOUT_DIR}" |
1183 | 1190 | fi |
1184 | 1191 | else |
1185 | 1192 | echodebug "Shallow cloning not possible. Required git version not met." |
1186 | | - git clone "$_SALT_REPO_URL" || return 1 |
| 1193 | + git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 |
1187 | 1194 | cd "${__SALT_GIT_CHECKOUT_DIR}" |
1188 | 1195 | fi |
1189 | 1196 | else |
1190 | 1197 | echowarn "The git revision being installed does not match a Salt version tag. Shallow cloning disabled" |
1191 | | - git clone "$_SALT_REPO_URL" || return 1 |
| 1198 | + git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 |
1192 | 1199 | cd "${__SALT_GIT_CHECKOUT_DIR}" |
1193 | 1200 | fi |
1194 | 1201 |
|
@@ -1540,7 +1547,7 @@ __check_services_debian() { |
1540 | 1547 | servicename=$1 |
1541 | 1548 | echodebug "Checking if service ${servicename} is enabled" |
1542 | 1549 |
|
1543 | | - # shellcheck disable=SC2086,SC2046 |
| 1550 | + # shellcheck disable=SC2086,SC2046,SC2144 |
1544 | 1551 | if [ -f /etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename} ]; then |
1545 | 1552 | echodebug "Service ${servicename} is enabled" |
1546 | 1553 | return 0 |
@@ -1695,6 +1702,10 @@ install_ubuntu_deps() { |
1695 | 1702 | __apt_get_install_noinput python-apt |
1696 | 1703 |
|
1697 | 1704 | if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 03 ]); then |
| 1705 | + if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then |
| 1706 | + echoinfo "Installing ZMQ>=4/PyZMQ>=14 from Chris Lea's PPA repository" |
| 1707 | + add-apt-repository -y ppa:chris-lea/zeromq || return 1 |
| 1708 | + fi |
1698 | 1709 | __apt_get_install_noinput python-requests |
1699 | 1710 | __PIP_PACKAGES="" |
1700 | 1711 | else |
@@ -2360,6 +2371,10 @@ install_debian_check_services() { |
2360 | 2371 | # Fedora Install Functions |
2361 | 2372 | # |
2362 | 2373 | install_fedora_deps() { |
| 2374 | + if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then |
| 2375 | + __install_saltstack_copr_zeromq_repository || return 1 |
| 2376 | + fi |
| 2377 | + |
2363 | 2378 | __PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests" |
2364 | 2379 |
|
2365 | 2380 | if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then |
@@ -2531,9 +2546,28 @@ __install_epel_repository() { |
2531 | 2546 | return 0 |
2532 | 2547 | } |
2533 | 2548 |
|
| 2549 | +__install_saltstack_copr_zeromq_repository() { |
| 2550 | + echoinfo "Installing Zeromq >=4 and PyZMQ>=14 from SaltStack's COPR repository" |
| 2551 | + if [ ! -f /etc/yum.repos.d/saltstack-zeromq4.repo ]; then |
| 2552 | + if [ "${DISTRO_NAME_L}" = "fedora" ]; then |
| 2553 | + __REPOTYPE="${DISTRO_NAME_L}" |
| 2554 | + else |
| 2555 | + __REPOTYPE="epel" |
| 2556 | + fi |
| 2557 | + wget -O /etc/yum.repos.d/saltstack-zeromq4.repo \ |
| 2558 | + "https://copr.fedoraproject.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1 |
| 2559 | + fi |
| 2560 | + return 0 |
| 2561 | +} |
| 2562 | + |
| 2563 | + |
2534 | 2564 | install_centos_stable_deps() { |
2535 | 2565 | __install_epel_repository || return 1 |
2536 | 2566 |
|
| 2567 | + if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then |
| 2568 | + __install_saltstack_copr_zeromq_repository || return 1 |
| 2569 | + fi |
| 2570 | + |
2537 | 2571 | if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then |
2538 | 2572 | yum -y update || return 1 |
2539 | 2573 | fi |
@@ -2674,7 +2708,7 @@ install_centos_git() { |
2674 | 2708 | } |
2675 | 2709 |
|
2676 | 2710 | install_centos_git_post() { |
2677 | | - for fname in minion master minion api; do |
| 2711 | + for fname in minion master syndic api; do |
2678 | 2712 |
|
2679 | 2713 | # Skip if not meant to be installed |
2680 | 2714 | [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue |
@@ -3656,9 +3690,9 @@ install_freebsd_git() { |
3656 | 3690 | # Install from git |
3657 | 3691 | if [ ! -f salt/syspaths.py ]; then |
3658 | 3692 | # We still can't provide the system paths, salt 0.16.x |
3659 | | - /usr/local/bin/python setup.py install || return 1 |
| 3693 | + /usr/local/bin/python2 setup.py install || return 1 |
3660 | 3694 | else |
3661 | | - /usr/local/bin/python setup.py install \ |
| 3695 | + /usr/local/bin/python2 setup.py install \ |
3662 | 3696 | --salt-root-dir=/usr/local \ |
3663 | 3697 | --salt-config-dir="${_SALT_ETC_DIR}" \ |
3664 | 3698 | --salt-cache-dir=/var/cache/salt \ |
|
0 commit comments