Modernize Salt bootstrap script

This commit is contained in:
Max Arnold 2021-01-07 17:07:20 +07:00
parent f797af0aac
commit 9f1c13d28c

View File

@ -4,13 +4,16 @@ cd `mktemp -d`
# We just download the bootstrap script by default and execute that.
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -o bootstrap-salt.sh https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh
/usr/bin/fetch -o bootstrap-salt.sh https://bootstrap.saltproject.io
elif [ -x /usr/bin/curl ]; then
/usr/bin/curl --silent --show-error -L -O https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh
/usr/bin/curl --silent --show-error -L --output bootstrap-salt.sh https://bootstrap.saltproject.io
elif [ -x /usr/bin/wget ]; then
/usr/bin/wget -O bootstrap-salt.sh https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh
/usr/bin/wget -O bootstrap-salt.sh https://bootstrap.saltproject.io
elif [ "2" = `python -c 'import sys; sys.stdout.write(str(sys.version_info.major))'` ]; then
# TODO: remove after there is no supported distros with Python 2
python -c 'import urllib; urllib.urlretrieve("https://bootstrap.saltproject.io", "bootstrap-salt.sh")'
else
python -c 'import urllib; urllib.urlretrieve("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh", "bootstrap-salt.sh")'
python -c 'import urllib.request; urllib.request.urlretrieve("https://bootstrap.saltproject.io", "bootstrap-salt.sh")'
fi
if [ -e bootstrap-salt.sh ]; then