From baebf629412e1f2f4eab45a7102b477d1653dfef Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Wed, 29 Mar 2023 14:57:31 -0700 Subject: [PATCH 01/21] Adding support for installing 3006 via bootstrap. Updating stable type to install onedir packages starting in 3006. --- bootstrap-salt.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index df4697445..e668c4578 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -617,11 +617,20 @@ if [ "$ITYPE" = "git" ]; then elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then STABLE_REV="latest" + ITYPE="onedir" 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|3002|3003|3004|3005)$')" != "" ]; then + if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then + ONEDIR_REV="$1" + ITYPE="onedir" + shift + elif [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then STABLE_REV="$1" shift - elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}(\.[0-9]*)?)$')" != "" ]; then + elif [ "$(echo "$1" | grep -E '^([3-9][6-9]{3}(\.[0-9]*)?)')" != "" ]; then + ONEDIR_REV="minor/$1" + ITYPE="onedir" + shift + elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{3}(\.[0-9]*)?)$')" != "" ]; then # Handle the 3xxx.0 version as 3xxx archive (pin to minor) and strip the fake ".0" suffix STABLE_REV=$(echo "$1" | sed -E 's/^([3-9][0-9]{3})\.0$/\1/') if [ "$(uname)" != "Darwin" ]; then @@ -629,7 +638,7 @@ elif [ "$ITYPE" = "stable" ]; then 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, 3000, 3001, 3002, 3003, 3004, 3005, latest, \$MAJOR.\$MINOR.\$PATCH until 2019.2, \$MAJOR or \$MAJOR.\$PATCH starting from 3000)" + echo "Unknown stable version: $1 (valid: 3003, 3004, 3005, 3006, latest)" exit 1 fi fi @@ -638,7 +647,7 @@ elif [ "$ITYPE" = "onedir" ]; then if [ "$#" -eq 0 ];then ONEDIR_REV="latest" else - if [ "$(echo "$1" | grep -E '^(nightly|latest|3005)$')" != "" ]; then + if [ "$(echo "$1" | grep -E '^(nightly|latest|3005|3006)$')" != "" ]; then ONEDIR_REV="$1" shift elif [ "$(echo "$1" | grep -E '^(3005(\.[0-9]*)?)')" != "" ]; then @@ -650,7 +659,7 @@ elif [ "$ITYPE" = "onedir" ]; then ONEDIR_REV="minor/$1" shift else - echo "Unknown onedir version: $1 (valid: 3005, latest, nightly.)" + echo "Unknown onedir version: $1 (valid: 3005, 3006, latest, nightly.)" exit 1 fi fi From 1a7a7087f203a5feeae2bd1942810a24fa28ef09 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Wed, 29 Mar 2023 15:52:05 -0700 Subject: [PATCH 02/21] Fix REV variable to be ONEDIR_REV to match ITYPE --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e668c4578..8b5bf1961 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -616,7 +616,7 @@ if [ "$ITYPE" = "git" ]; then # If doing stable install, check if version specified elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then - STABLE_REV="latest" + ONEDIR_REV="latest" ITYPE="onedir" else if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then From 829094e3fcdb4770240a71967d2313a3e2dd416f Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 30 Mar 2023 12:31:47 -0700 Subject: [PATCH 03/21] account for the older key in latest until latest points to 3006 and is using the newer key. --- bootstrap-salt.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8b5bf1961..884a3db42 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3087,8 +3087,11 @@ __install_saltstack_ubuntu_onedir_repository() { fi echo "$__REPO_ARCH_DEB $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > /etc/apt/sources.list.d/salt.list - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005|nightly)')" != "" ]; then + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then __apt_key_fetch "${SALTSTACK_UBUNTU_URL}salt-archive-keyring.gpg" || return 1 + elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then + __apt_key_fetch "${SALTSTACK_UBUNTU_URL}salt-archive-keyring.gpg" || \ + __apt_key_fetch "${SALTSTACK_UBUNTU_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 else __apt_key_fetch "${SALTSTACK_UBUNTU_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 fi @@ -3631,8 +3634,11 @@ __install_saltstack_debian_onedir_repository() { fi echo "$__REPO_ARCH_DEB $SALTSTACK_DEBIAN_URL $DEBIAN_CODENAME main" > "/etc/apt/sources.list.d/salt.list" - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005|nightly)')" != "" ]; then + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then __apt_key_fetch "${SALTSTACK_DEBIAN_URL}salt-archive-keyring.gpg" || return 1 + elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then + __apt_key_fetch "${SALTSTACK_UBUNTU_URL}salt-archive-keyring.gpg" || \ + __apt_key_fetch "${SALTSTACK_UBUNTU_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 else __apt_key_fetch "${SALTSTACK_DEBIAN_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 fi @@ -4519,12 +4525,18 @@ __install_saltstack_rhel_onedir_repository() { if [ "${ONEDIR_REV}" = "nightly" ] ; then base_url="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/redhat/${DISTRO_MAJOR_VERSION}/\$basearch/" fi - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005|nightly)')" != "" ]; then + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then gpg_key="SALTSTACK-GPG-KEY2.pub" else gpg_key="SALTSTACK-GPG-KEY.pub" fi + elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then + if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then + gpg_key="SALTSTACK-GPG-KEY2.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + else + gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + fi else gpg_key="SALT-PROJECT-GPG-PUBKEY-2023.pub" fi @@ -6312,11 +6324,13 @@ install_amazon_linux_ami_2_onedir_deps() { base_url="$HTTP_VAL://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/amazon/2/\$basearch/" fi - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005|nightly)')" != "" ]; then + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then gpg_key="${base_url}SALTSTACK-GPG-KEY.pub,${base_url}base/RPM-GPG-KEY-CentOS-7" if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then gpg_key="${base_url}SALTSTACK-GPG-KEY.pub" fi + elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then + gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" else gpg_key="${base_url}SALT-PROJECT-GPG-PUBKEY-2023.pub" fi From 88319abee8be09f43e89ccdceb67b36506c61569 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 30 Mar 2023 12:57:20 -0700 Subject: [PATCH 04/21] add some dummy install onedir functions to call the stable version for certain OSes, eg. freebsd, openbsd, smartos. --- bootstrap-salt.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 884a3db42..eef7df2d6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4442,6 +4442,11 @@ install_fedora_check_services() { return 0 } +install_fedora_onedir() { + install_fedora_stable || return 1 + + return 0 +} # # Ended Fedora Install Functions # @@ -6881,6 +6886,15 @@ install_freebsd_restart_daemons() { service salt_$fname start done } + +install_freebsd_onedir() { +# +# call install_freebsd_stable +# + install_freebsd_stable || return 1 + + return 0 +} # # Ended FreeBSD Install Functions # @@ -6999,6 +7013,14 @@ install_openbsd_restart_daemons() { return 0 } +install_openbsd_onedir() { +# +# Call install_openbsd_stable +# + install_openbsd_stable || return 1 + + return 0 +} # # Ended OpenBSD Install Functions # @@ -7199,6 +7221,14 @@ install_smartos_restart_daemons() { return 0 } +install_smartos_onedir() { +# +# call install_smartos_stable +# + install_smartos_stable || return 1 + + return 0 +} # # Ended SmartOS Install Functions # From 40eb43e2efdfa49b331e9b449e38dd95fe10b32f Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 30 Mar 2023 15:29:56 -0700 Subject: [PATCH 05/21] on RH based systems, check that the updated GPG key exists otherwise fall back to the previous GPG key. --- bootstrap-salt.sh | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index eef7df2d6..b9c915472 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -897,6 +897,18 @@ __fetch_verify() { return 1 } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __check_url_exists +# DESCRIPTION: Checks if a URL exists +#---------------------------------------------------------------------------------------------------------------------- +__check_url_exists() { + _URL="$1" + if curl --output /dev/null --silent --fail "${_URL}"; then + return 0 + else + return 1 + fi +} #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __gather_hardware_info # DESCRIPTION: Discover hardware information @@ -3637,8 +3649,8 @@ __install_saltstack_debian_onedir_repository() { if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then __apt_key_fetch "${SALTSTACK_DEBIAN_URL}salt-archive-keyring.gpg" || return 1 elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then - __apt_key_fetch "${SALTSTACK_UBUNTU_URL}salt-archive-keyring.gpg" || \ - __apt_key_fetch "${SALTSTACK_UBUNTU_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 + __apt_key_fetch "${SALTSTACK_DEBIAN_URL}salt-archive-keyring.gpg" || \ + __apt_key_fetch "${SALTSTACK_DEBIAN_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 else __apt_key_fetch "${SALTSTACK_DEBIAN_URL}SALT-PROJECT-GPG-PUBKEY-2023.gpg" || return 1 fi @@ -4537,10 +4549,14 @@ __install_saltstack_rhel_onedir_repository() { gpg_key="SALTSTACK-GPG-KEY.pub" fi elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then - if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then - gpg_key="SALTSTACK-GPG-KEY2.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + if __check_url_exists "${base_url}SALT-PROJECT-GPG-PUBKEY-2023.pub"; then + gpg_key="SALT-PROJECT-GPG-PUBKEY-2023.pub" else - gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then + gpg_key="SALTSTACK-GPG-KEY2.pub" + else + gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + fi fi else gpg_key="SALT-PROJECT-GPG-PUBKEY-2023.pub" @@ -6335,7 +6351,11 @@ install_amazon_linux_ami_2_onedir_deps() { gpg_key="${base_url}SALTSTACK-GPG-KEY.pub" fi elif [ "$(echo "${ONEDIR_REV}" | grep -E '(latest|nightly)')" != "" ]; then - gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + if __check_url_exists "${base_url}SALT-PROJECT-GPG-PUBKEY-2023.pub"; then + gpg_key="${base_url}SALT-PROJECT-GPG-PUBKEY-2023.pub" + else + gpg_key="${base_url}SALTSTACK-GPG-KEY.pub" + fi else gpg_key="${base_url}SALT-PROJECT-GPG-PUBKEY-2023.pub" fi From edd4b6fbe6632164016cf27450ff323f2251f054 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 30 Mar 2023 15:51:38 -0700 Subject: [PATCH 06/21] Ensure STABLE_REV is still set for a couple functions that still use it, eg. Fedora. --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b9c915472..2c122b2ac 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -617,6 +617,7 @@ if [ "$ITYPE" = "git" ]; then elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then ONEDIR_REV="latest" + STABLE_REV="latest" ITYPE="onedir" else if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then From 4eaf22fc59754a8e68833f5c1789285f3eba6ea6 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 30 Mar 2023 17:21:59 -0700 Subject: [PATCH 07/21] Don't include SALT-PROJECT-GPG-PUBKEY-2023.pub if it's not found. --- bootstrap-salt.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 2c122b2ac..1cb87fc8d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4556,7 +4556,7 @@ __install_saltstack_rhel_onedir_repository() { if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then gpg_key="SALTSTACK-GPG-KEY2.pub" else - gpg_key="SALTSTACK-GPG-KEY.pub SALT-PROJECT-GPG-PUBKEY-2023.pub" + gpg_key="SALTSTACK-GPG-KEY.pub" fi fi else @@ -6729,6 +6729,12 @@ install_arch_check_services() { return 0 } + +install_arch_linux_onedir() { + install_arch_linux_stable || return 1 + + return 0 +} # # Ended Arch Install Functions # From 499f895baeafd230cb49abf017d08568281e916c Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 31 Mar 2023 12:57:37 -0700 Subject: [PATCH 08/21] Adding +install_macosx_onedir and friends --- bootstrap-salt.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1cb87fc8d..261df2576 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -617,7 +617,6 @@ if [ "$ITYPE" = "git" ]; then elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then ONEDIR_REV="latest" - STABLE_REV="latest" ITYPE="onedir" else if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then @@ -629,6 +628,7 @@ elif [ "$ITYPE" = "stable" ]; then shift elif [ "$(echo "$1" | grep -E '^([3-9][6-9]{3}(\.[0-9]*)?)')" != "" ]; then ONEDIR_REV="minor/$1" + _ONEDIR_REV="$1" ITYPE="onedir" shift elif [ "$(echo "$1" | grep -E '^([3-9][0-5]{3}(\.[0-9]*)?)$')" != "" ]; then @@ -4456,6 +4456,7 @@ install_fedora_check_services() { return 0 } install_fedora_onedir() { + STABLE_REV=$ONEDIR_REV install_fedora_stable || return 1 return 0 @@ -8439,17 +8440,49 @@ __macosx_get_packagesite() { SALTPKGCONFURL="https://${_REPO_URL}/osx/${PKG}" } +__macosx_get_packagesite_onedir() { + DARWIN_ARCH="x86_64" + + __PY_VERSION_REPO="py2" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __PY_VERSION_REPO="py3" + fi + + if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)$')" != "" ]; then + PKG="salt-${_ONEDIR_REV}-macos-${DARWIN_ARCH}.pkg" + SALTPKGCONFURL="https://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/macos/${_ONEDIR_REV}/${PKG}" + else + if [ "$(echo "$_ONEDIR_REV" | grep -E '(salt_rc)$')" != "" ]; then + UNSIGNED="-unsigned" + else + UNSIGNED="" + fi + PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" + SALTPKGCONFURL="https://${_REPO_URL}/${ONEDIR_REV}/${PKG}" + fi +} + # Using a separate conf step to head for idempotent install... __configure_macosx_pkg_details() { __macosx_get_packagesite || return 1 return 0 } +__configure_macosx_pkg_details_onedir() { + __macosx_get_packagesite_onedir || return 1 + return 0 +} + install_macosx_stable_deps() { __configure_macosx_pkg_details || return 1 return 0 } +install_macosx_onedir_deps() { + __configure_macosx_pkg_details_onedir || return 1 + return 0 +} + install_macosx_git_deps() { install_macosx_stable_deps || return 1 @@ -8496,6 +8529,16 @@ install_macosx_stable() { return 0 } +install_macosx_onedir() { + install_macosx_onedir_deps || return 1 + + __fetch_url "/tmp/${PKG}" "${SALTPKGCONFURL}" || return 1 + + /usr/sbin/installer -pkg "/tmp/${PKG}" -target / || return 1 + + return 0 +} + install_macosx_git() { if [ -n "$_PY_EXE" ]; then @@ -8533,6 +8576,11 @@ install_macosx_stable_post() { return 0 } +install_macosx_onedir_post() { + install_macosx_stable_post || return 1 + return 0 +} + install_macosx_git_post() { install_macosx_stable_post || return 1 return 0 From 07ab70922ca1edc4eb8aba4354b18cb850d71001 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 31 Mar 2023 16:00:31 -0700 Subject: [PATCH 09/21] need a dummy install_fedora_onedir_post that calls install_fedora_stable_post. --- bootstrap-salt.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 261df2576..587cec3ea 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4461,6 +4461,13 @@ install_fedora_onedir() { return 0 } + +install_fedora_onedir_post() { + STABLE_REV=$ONEDIR_REV + install_fedora_stable_post || return 1 + + return 0 +} # # Ended Fedora Install Functions # From 67a0df2dd12578debf9cdfeebd24448884767706 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 31 Mar 2023 16:01:43 -0700 Subject: [PATCH 10/21] need a dummy install_arch_linux_onedir_post that calls install_arch_linux_stable_post. --- bootstrap-salt.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 587cec3ea..40bae4b11 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -6743,6 +6743,12 @@ install_arch_linux_onedir() { return 0 } + +install_arch_linux_onedir_post() { + install_arch_linux_stable_post || return 1 + + return 0 +} # # Ended Arch Install Functions # From 779cfbf55dbf080db3635f9f8f5b0860f19feea5 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 13 Apr 2023 18:58:29 -0700 Subject: [PATCH 11/21] first pass at parsing the repo.json for Mac when using onedir and latest. --- bootstrap-salt.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 40bae4b11..a42980488 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8453,6 +8453,22 @@ __macosx_get_packagesite() { SALTPKGCONFURL="https://${_REPO_URL}/osx/${PKG}" } +__parse_repo_json_python() { + + # Using latest, grab the right + # version from the repo.json + _ONEDIR_REV=$(python - <<-EOF +import json, urllib.request +url = "https://repo.saltproject.io/salt/py3/macos/repo.json" +response = urllib.request.urlopen(url) +data = json.loads(response.read()) +version = data['latest'][list(data['latest'].keys())[0]]['version'] +print(version) +EOF +) + +} + __macosx_get_packagesite_onedir() { DARWIN_ARCH="x86_64" @@ -8470,6 +8486,9 @@ __macosx_get_packagesite_onedir() { else UNSIGNED="" fi + if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then + __parse_repo_json_python || return 1 + fi PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" SALTPKGCONFURL="https://${_REPO_URL}/${ONEDIR_REV}/${PKG}" fi From f976efc5702cf1238b682a1924b46ac39558d04c Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 13 Apr 2023 21:55:25 -0700 Subject: [PATCH 12/21] different approach to setting the _ONEDIR_REV from the parse repo.json function --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a42980488..9cb94ea7b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8457,7 +8457,7 @@ __parse_repo_json_python() { # Using latest, grab the right # version from the repo.json - _ONEDIR_REV=$(python - <<-EOF + _JSON_LATEST_VERSION=$(python - <<-EOF import json, urllib.request url = "https://repo.saltproject.io/salt/py3/macos/repo.json" response = urllib.request.urlopen(url) @@ -8466,7 +8466,7 @@ version = data['latest'][list(data['latest'].keys())[0]]['version'] print(version) EOF ) - +echo "${_JSON_LATEST_VERSION}" } __macosx_get_packagesite_onedir() { @@ -8487,7 +8487,7 @@ __macosx_get_packagesite_onedir() { UNSIGNED="" fi if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then - __parse_repo_json_python || return 1 + _ONEDIR_REV=$(__parse_repo_json_python) fi PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" SALTPKGCONFURL="https://${_REPO_URL}/${ONEDIR_REV}/${PKG}" From b03a99ee53bf2b26d3cdfadc2f0f4498394a0e88 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 05:18:17 -0700 Subject: [PATCH 13/21] Need _ONEDIR_REV defined in a couple more places. --- bootstrap-salt.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9cb94ea7b..db58cddf9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -617,10 +617,12 @@ if [ "$ITYPE" = "git" ]; then elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then ONEDIR_REV="latest" + _ONEDIR_REV="$1" ITYPE="onedir" else if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then ONEDIR_REV="$1" + _ONEDIR_REV="$1" ITYPE="onedir" shift elif [ "$(echo "$1" | grep -E '^(3003|3004|3005)$')" != "" ]; then From d0032c74951b8c63936ac692559af9f8705c27ba Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 05:33:12 -0700 Subject: [PATCH 14/21] fixing SALTPKGCONFURL, same one for onedir locations just populated with different values for different variables. --- bootstrap-salt.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index db58cddf9..60778cdb2 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8481,7 +8481,6 @@ __macosx_get_packagesite_onedir() { if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)$')" != "" ]; then PKG="salt-${_ONEDIR_REV}-macos-${DARWIN_ARCH}.pkg" - SALTPKGCONFURL="https://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/macos/${_ONEDIR_REV}/${PKG}" else if [ "$(echo "$_ONEDIR_REV" | grep -E '(salt_rc)$')" != "" ]; then UNSIGNED="-unsigned" @@ -8492,8 +8491,8 @@ __macosx_get_packagesite_onedir() { _ONEDIR_REV=$(__parse_repo_json_python) fi PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" - SALTPKGCONFURL="https://${_REPO_URL}/${ONEDIR_REV}/${PKG}" fi + SALTPKGCONFURL="https://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/macos/${_ONEDIR_REV}/${PKG}" } # Using a separate conf step to head for idempotent install... From efbd416607d610bfab1688ee95176e0d3cc9cda0 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 05:46:31 -0700 Subject: [PATCH 15/21] parse json first, since different versions have different naming schemes and we need to parse that part afterwards --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 60778cdb2..7a749dc9d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8479,6 +8479,9 @@ __macosx_get_packagesite_onedir() { __PY_VERSION_REPO="py3" fi + if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then + _ONEDIR_REV=$(__parse_repo_json_python) + fi if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)$')" != "" ]; then PKG="salt-${_ONEDIR_REV}-macos-${DARWIN_ARCH}.pkg" else @@ -8487,9 +8490,6 @@ __macosx_get_packagesite_onedir() { else UNSIGNED="" fi - if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then - _ONEDIR_REV=$(__parse_repo_json_python) - fi PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" fi SALTPKGCONFURL="https://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/macos/${_ONEDIR_REV}/${PKG}" From 0f39aca8c103d48d68c09f145800ce345b650e88 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 05:56:44 -0700 Subject: [PATCH 16/21] Fixing Arch by adding additional onedir functions to call stable functions. --- bootstrap-salt.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7a749dc9d..bd4a01e9b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -6587,6 +6587,10 @@ install_arch_linux_git_deps() { return 0 } +install_arch_linux_onedir_deps() { + install_arch_linux_stable_deps || return 1 +} + install_arch_linux_stable() { # Pacman does not resolve dependencies on outdated versions # They always need to be updated @@ -6747,7 +6751,7 @@ install_arch_linux_onedir() { } install_arch_linux_onedir_post() { - install_arch_linux_stable_post || return 1 + install_arch_linux_post || return 1 return 0 } From 4a74744f069468ff497aa418b6de19978e0e84fa Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 06:21:35 -0700 Subject: [PATCH 17/21] Remove end of line from grep for 3005. --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index bd4a01e9b..359ba50d7 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8486,10 +8486,10 @@ __macosx_get_packagesite_onedir() { if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then _ONEDIR_REV=$(__parse_repo_json_python) fi - if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)$')" != "" ]; then + if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)')" != "" ]; then PKG="salt-${_ONEDIR_REV}-macos-${DARWIN_ARCH}.pkg" else - if [ "$(echo "$_ONEDIR_REV" | grep -E '(salt_rc)$')" != "" ]; then + if [ "$(echo "$_ONEDIR_REV" | grep -E '(salt_rc)')" != "" ]; then UNSIGNED="-unsigned" else UNSIGNED="" From b57d37475e99fee4dbed45dd0e87804817b77c01 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 07:08:28 -0700 Subject: [PATCH 18/21] removing python 3.6 related code which is no longer needed. --- bootstrap-salt.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 359ba50d7..157f4657b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -7460,6 +7460,10 @@ install_opensuse_git_deps() { return 0 } +install_opensuse_onedir_deps() { + install_opensuse_stable_deps || return 1 +} + install_opensuse_stable() { __PACKAGES="" @@ -7492,6 +7496,10 @@ install_opensuse_git() { return 0 } +install_opensuse_onedir() { + install_opensuse_stable || return 1 +} + install_opensuse_stable_post() { for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -7561,6 +7569,10 @@ install_opensuse_git_post() { return 0 } +install_opensuse_onedir_post() { + install_opensuse_stable_post || return 1 +} + install_opensuse_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return @@ -8066,11 +8078,6 @@ __gentoo_pre_dep() { mkdir /etc/portage fi - # Enable Python 3.6 target for pre Neon Salt release - if echo "${STABLE_REV}" | grep -q "2019" || [ "${ITYPE}" = "git" ] && [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then - EXTRA_PYTHON_TARGET=python3_6 - fi - # Enable Python 3.7 target for Salt Neon using GIT if [ "${ITYPE}" = "git" ] && [ "${GIT_REV}" = "v3000" ]; then EXTRA_PYTHON_TARGET=python3_7 @@ -8216,6 +8223,12 @@ install_gentoo_git() { return 0 } +install_gentoo_onedir() { + + install_gentoo_stable || return 1 + +} + install_gentoo_post() { for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -8305,6 +8318,12 @@ _eof return 0 } +install_gentoo_onedir_post() { + + install_gentoo_post || return 1 + +} + install_gentoo_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return From 1aa72d9c2d3738ff39e6d0a58ddbd546bdf5097d Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 08:14:00 -0700 Subject: [PATCH 19/21] Need to set STABLE_REV to ONEDIR_REV when install_gentoo_onedir is called. --- bootstrap-salt.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 157f4657b..90362888e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8224,9 +8224,8 @@ install_gentoo_git() { } install_gentoo_onedir() { - + STABLE_REV=${ONEDIR_REV} install_gentoo_stable || return 1 - } install_gentoo_post() { @@ -8319,9 +8318,7 @@ _eof } install_gentoo_onedir_post() { - install_gentoo_post || return 1 - } install_gentoo_restart_daemons() { From be030c1958c9e2d06c88dc4b40072eb06c3f2413 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 09:25:04 -0700 Subject: [PATCH 20/21] suggested fixes --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 90362888e..a867fc7c9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8484,7 +8484,7 @@ import json, urllib.request url = "https://repo.saltproject.io/salt/py3/macos/repo.json" response = urllib.request.urlopen(url) data = json.loads(response.read()) -version = data['latest'][list(data['latest'].keys())[0]]['version'] +version = data['latest'][list(data['latest'])[0]]['version'] print(version) EOF ) From 2af0e6c0b6a017b5719b2b2ce4b0d45791b7e19d Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 14 Apr 2023 09:27:39 -0700 Subject: [PATCH 21/21] All Mac packages are now signed. --- bootstrap-salt.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a867fc7c9..2a7d2ff79 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8505,12 +8505,7 @@ __macosx_get_packagesite_onedir() { if [ "$(echo "$_ONEDIR_REV" | grep -E '^(3005)')" != "" ]; then PKG="salt-${_ONEDIR_REV}-macos-${DARWIN_ARCH}.pkg" else - if [ "$(echo "$_ONEDIR_REV" | grep -E '(salt_rc)')" != "" ]; then - UNSIGNED="-unsigned" - else - UNSIGNED="" - fi - PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" + PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}.pkg" fi SALTPKGCONFURL="https://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/macos/${_ONEDIR_REV}/${PKG}" }