Skip to content

Commit

Permalink
Adjust Amazon support since their yum (v3) doesn't support config-man…
Browse files Browse the repository at this point in the history
…ager
  • Loading branch information
dmurphy18 committed Dec 11, 2024
1 parent e5c03a5 commit a4c8423
Showing 1 changed file with 112 additions and 21 deletions.
133 changes: 112 additions & 21 deletions bootstrap-salt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5652,23 +5652,44 @@ install_amazon_linux_ami_2_deps() {

if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$STABLE_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then
# latest version for branch 3006 | 3007
REPO_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
echo "[salt-repo-${STABLE_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${STABLE_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
Expand All @@ -5680,8 +5701,15 @@ install_amazon_linux_ami_2_deps() {
fi
else
# Enable the Salt LATEST repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
yum clean expire-cache || return 1
yum makecache || return 1
Expand Down Expand Up @@ -5717,23 +5745,44 @@ install_amazon_linux_ami_2_onedir_deps() {

if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$ONEDIR_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
# latest version for branch 3006 | 3007
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
Expand All @@ -5745,8 +5794,15 @@ install_amazon_linux_ami_2_onedir_deps() {
fi
else
# Enable the Salt LATEST repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
yum clean expire-cache || return 1
yum makecache || return 1
Expand Down Expand Up @@ -5852,6 +5908,13 @@ install_amazon_linux_ami_2023_git_deps() {
return 0
}

install_amazon_linux_ami_2023_deps() {

# Set ONEDIR_REV to STABLE_REV
ONEDIR_REV=${STABLE_REV}
install_amazon_linux_ami_2023_onedir_deps || return 1
}

install_amazon_linux_ami_2023_onedir_deps() {

# We need to install yum-utils before doing anything else when installing on
Expand All @@ -5870,23 +5933,44 @@ install_amazon_linux_ami_2023_onedir_deps() {

if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$ONEDIR_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
# latest version for branch 3006 | 3007
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
Expand All @@ -5898,8 +5982,15 @@ install_amazon_linux_ami_2023_onedir_deps() {
fi
else
# Enable the Salt LATEST repo
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
yum clean expire-cache || return 1
yum makecache || return 1
Expand Down

0 comments on commit a4c8423

Please sign in to comment.