Skip to content

Commit e235b82

Browse files
saltbot-opens0undt3ch
authored andcommitted
Update the bootstrap script to v2023.06.28
(cherry picked from commit 1ef02f5)
1 parent 2fa9684 commit e235b82

File tree

1 file changed

+97
-27
lines changed

1 file changed

+97
-27
lines changed

salt/cloud/deploy/bootstrap-salt.sh

Lines changed: 97 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#======================================================================================================================
2424
set -o nounset # Treat unset variables as an error
2525

26-
__ScriptVersion="2023.04.26"
26+
__ScriptVersion="2023.06.28"
2727
__ScriptName="bootstrap-salt.sh"
2828

2929
__ScriptFullName="$0"
@@ -224,7 +224,6 @@ _KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE}
224224
_TEMP_CONFIG_DIR="null"
225225
_SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git"
226226
_SALT_REPO_URL=${_SALTSTACK_REPO_URL}
227-
_DOWNSTREAM_PKG_REPO=$BS_FALSE
228227
_TEMP_KEYS_DIR="null"
229228
_SLEEP="${__DEFAULT_SLEEP}"
230229
_INSTALL_MASTER=$BS_FALSE
@@ -311,21 +310,31 @@ __usage() {
311310
- onedir_rc Install latest onedir RC release.
312311
- onedir_rc [version] Install a specific version. Only supported for
313312
onedir RC packages available at repo.saltproject.io
313+
- old-stable Install latest old stable release.
314+
- old-stable [branch] Install latest version on a branch. Only supported
315+
for packages available at repo.saltproject.io
316+
- old-stable [version] Install a specific version. Only supported for
317+
packages available at repo.saltproject.io
318+
To pin a 3xxx minor version, specify it as 3xxx.0
314319
315320
Examples:
316321
- ${__ScriptName}
317322
- ${__ScriptName} stable
318-
- ${__ScriptName} stable 2017.7
319-
- ${__ScriptName} stable 2017.7.2
323+
- ${__ScriptName} stable 3006
324+
- ${__ScriptName} stable 3006.1
320325
- ${__ScriptName} testing
321326
- ${__ScriptName} git
322327
- ${__ScriptName} git 2017.7
323328
- ${__ScriptName} git v2017.7.2
324329
- ${__ScriptName} git 06f249901a2e2f1ed310d58ea3921a129f214358
325330
- ${__ScriptName} onedir
326-
- ${__ScriptName} onedir 3005
331+
- ${__ScriptName} onedir 3006
327332
- ${__ScriptName} onedir_rc
328-
- ${__ScriptName} onedir_rc 3005
333+
- ${__ScriptName} onedir_rc 3006
334+
- ${__ScriptName} old-stable
335+
- ${__ScriptName} old-stable 3005
336+
- ${__ScriptName} old-stable 3005.1
337+
329338
330339
Options:
331340
-a Pip install all Python pkg dependencies for Salt. Requires -V to install
@@ -401,9 +410,6 @@ __usage() {
401410
-v Display script version
402411
-V Install Salt into virtualenv
403412
(only available for Ubuntu based distributions)
404-
-w Install packages from downstream package repository rather than
405-
upstream, saltstack package repository. This is currently only
406-
implemented for SUSE.
407413
-x Changes the Python version used to install Salt.
408414
For CentOS 6 git installations python2.7 is supported.
409415
Fedora git installation, CentOS 7, Ubuntu 18.04 support python3.
@@ -420,7 +426,7 @@ EOT
420426
} # ---------- end of function __usage ----------
421427

422428

423-
while getopts ':hvnDc:g:Gyx:wk:s:MSNXCPFUKIA:i:Lp:dH:bflV:J:j:rR:aq' opt
429+
while getopts ':hvnDc:g:Gyx:k:s:MSNXCPFUKIA:i:Lp:dH:bflV:J:j:rR:aq' opt
424430
do
425431
case "${opt}" in
426432

@@ -436,7 +442,6 @@ do
436442
echowarn "No need to provide this option anymore, now it is a default behavior."
437443
;;
438444

439-
w ) _DOWNSTREAM_PKG_REPO=$BS_TRUE ;;
440445
k ) _TEMP_KEYS_DIR="$OPTARG" ;;
441446
s ) _SLEEP=$OPTARG ;;
442447
M ) _INSTALL_MASTER=$BS_TRUE ;;
@@ -595,7 +600,7 @@ if [ "$#" -gt 0 ];then
595600
fi
596601

597602
# Check installation type
598-
if [ "$(echo "$ITYPE" | grep -E '(stable|testing|git|onedir|onedir_rc)')" = "" ]; then
603+
if [ "$(echo "$ITYPE" | grep -E '(stable|testing|git|onedir|onedir_rc|old-stable)')" = "" ]; then
599604
echoerror "Installation type \"$ITYPE\" is not known..."
600605
exit 1
601606
fi
@@ -619,28 +624,41 @@ elif [ "$ITYPE" = "stable" ]; then
619624
_ONEDIR_REV="latest"
620625
ITYPE="onedir"
621626
else
622-
if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then
627+
if [ "$(echo "$1" | grep -E '^(nightly|latest|3005|3006)$')" != "" ]; then
623628
ONEDIR_REV="$1"
624629
_ONEDIR_REV="$1"
625630
ITYPE="onedir"
626631
shift
627-
elif [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then
628-
STABLE_REV="$1"
629-
shift
630-
elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
632+
elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{2}[5-9](\.[0-9]*)?)')" != "" ]; then
631633
ONEDIR_REV="minor/$1"
632634
_ONEDIR_REV="$1"
633635
ITYPE="onedir"
634636
shift
637+
else
638+
echo "Unknown stable version: $1 (valid: 3005, 3006, latest)"
639+
exit 1
640+
fi
641+
fi
642+
643+
# If doing old-stable install, check if version specified
644+
elif [ "$ITYPE" = "old-stable" ]; then
645+
if [ "$#" -eq 0 ];then
646+
ITYPE="stable"
647+
else
648+
if [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then
649+
STABLE_REV="$1"
650+
ITYPE="stable"
651+
shift
635652
elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{3}(\.[0-9]*)?)$')" != "" ]; then
636653
# Handle the 3xxx.0 version as 3xxx archive (pin to minor) and strip the fake ".0" suffix
654+
ITYPE="stable"
637655
STABLE_REV=$(echo "$1" | sed -E 's/^([3-9][0-9]{3})\.0$/\1/')
638656
if [ "$(uname)" != "Darwin" ]; then
639657
STABLE_REV="archive/$STABLE_REV"
640658
fi
641659
shift
642660
else
643-
echo "Unknown stable version: $1 (valid: 3003, 3004, 3005, 3006, latest)"
661+
echo "Unknown old stable version: $1 (valid: 3003, 3004, 3005)"
644662
exit 1
645663
fi
646664
fi
@@ -4573,6 +4591,12 @@ install_fedora_onedir_post() {
45734591
# CentOS Install Functions
45744592
#
45754593
__install_saltstack_rhel_repository() {
4594+
if [ "${DISTRO_MAJOR_VERSION}" -ge 9 ]; then
4595+
echoerror "Old stable repository unavailable on RH variants greater than or equal to 9"
4596+
echoerror "Use the stable install type."
4597+
exit 1
4598+
fi
4599+
45764600
if [ "$ITYPE" = "stable" ]; then
45774601
repo_rev="$STABLE_REV"
45784602
else
@@ -4827,7 +4851,6 @@ install_centos_git_deps() {
48274851
# Set ONEDIR_REV to STABLE_REV in case we
48284852
# end up calling install_centos_onedir_deps
48294853
ONEDIR_REV=${STABLE_REV}
4830-
install_centos_stable_deps || \
48314854
install_centos_onedir_deps || \
48324855
return 1
48334856

@@ -7698,13 +7721,8 @@ __set_suse_pkg_repo() {
76987721
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}_SP${SUSE_PATCHLEVEL}"
76997722
fi
77007723

7701-
if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then
7702-
suse_pkg_url_base="https://download.opensuse.org/repositories/systemsmanagement:/saltstack"
7703-
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo"
7704-
else
7705-
suse_pkg_url_base="${HTTP_VAL}://repo.saltproject.io/opensuse"
7706-
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack:products.repo"
7707-
fi
7724+
suse_pkg_url_base="https://download.opensuse.org/repositories/systemsmanagement:/saltstack"
7725+
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo"
77087726
SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path"
77097727
}
77107728

@@ -7724,7 +7742,7 @@ __version_lte() {
77247742
zypper --non-interactive install --auto-agree-with-licenses python || return 1
77257743
fi
77267744

7727-
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
7745+
if [ "$(${_PY_EXE} -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
77287746
__ZYPPER_REQUIRES_REPLACE_FILES=${BS_TRUE}
77297747
else
77307748
__ZYPPER_REQUIRES_REPLACE_FILES=${BS_FALSE}
@@ -8130,6 +8148,11 @@ install_opensuse_15_git() {
81308148
return 0
81318149
}
81328150

8151+
install_opensuse_15_onedir_deps() {
8152+
__opensuse_prep_install || return 1
8153+
return 0
8154+
}
8155+
81338156
#
81348157
# End of openSUSE Leap 15
81358158
#
@@ -8159,6 +8182,13 @@ install_suse_15_git_deps() {
81598182
return 0
81608183
}
81618184

8185+
install_suse_15_onedir_deps() {
8186+
__opensuse_prep_install || return 1
8187+
install_opensuse_15_onedir_deps || return 1
8188+
8189+
return 0
8190+
}
8191+
81628192
install_suse_15_stable() {
81638193
install_opensuse_stable || return 1
81648194
return 0
@@ -8169,6 +8199,11 @@ install_suse_15_git() {
81698199
return 0
81708200
}
81718201

8202+
install_suse_15_onedir() {
8203+
install_opensuse_stable || return 1
8204+
return 0
8205+
}
8206+
81728207
install_suse_15_stable_post() {
81738208
install_opensuse_stable_post || return 1
81748209
return 0
@@ -8179,6 +8214,11 @@ install_suse_15_git_post() {
81798214
return 0
81808215
}
81818216

8217+
install_suse_15_onedir_post() {
8218+
install_opensuse_stable_post || return 1
8219+
return 0
8220+
}
8221+
81828222
install_suse_15_restart_daemons() {
81838223
install_opensuse_restart_daemons || return 1
81848224
return 0
@@ -8261,6 +8301,11 @@ install_suse_12_git_deps() {
82618301
return 0
82628302
}
82638303

8304+
install_suse_12_onedir_deps() {
8305+
install_suse_12_stable_deps || return 1
8306+
return 0
8307+
}
8308+
82648309
install_suse_12_stable() {
82658310
install_opensuse_stable || return 1
82668311
return 0
@@ -8271,6 +8316,11 @@ install_suse_12_git() {
82718316
return 0
82728317
}
82738318

8319+
install_suse_12_onedir() {
8320+
install_opensuse_stable || return 1
8321+
return 0
8322+
}
8323+
82748324
install_suse_12_stable_post() {
82758325
install_opensuse_stable_post || return 1
82768326
return 0
@@ -8281,6 +8331,11 @@ install_suse_12_git_post() {
82818331
return 0
82828332
}
82838333

8334+
install_suse_12_onedir_post() {
8335+
install_opensuse_stable_post || return 1
8336+
return 0
8337+
}
8338+
82848339
install_suse_12_restart_daemons() {
82858340
install_opensuse_restart_daemons || return 1
82868341
return 0
@@ -8357,6 +8412,11 @@ install_suse_11_git_deps() {
83578412
return 0
83588413
}
83598414

8415+
install_suse_11_onedir_deps() {
8416+
install_suse_11_stable_deps || return 1
8417+
return 0
8418+
}
8419+
83608420
install_suse_11_stable() {
83618421
install_opensuse_stable || return 1
83628422
return 0
@@ -8367,6 +8427,11 @@ install_suse_11_git() {
83678427
return 0
83688428
}
83698429

8430+
install_suse_11_onedir() {
8431+
install_opensuse_stable || return 1
8432+
return 0
8433+
}
8434+
83708435
install_suse_11_stable_post() {
83718436
install_opensuse_stable_post || return 1
83728437
return 0
@@ -8377,6 +8442,11 @@ install_suse_11_git_post() {
83778442
return 0
83788443
}
83798444

8445+
install_suse_11_onedir_post() {
8446+
install_opensuse_stable_post || return 1
8447+
return 0
8448+
}
8449+
83808450
install_suse_11_restart_daemons() {
83818451
install_opensuse_restart_daemons || return 1
83828452
return 0

0 commit comments

Comments
 (0)