Add the -l option to switch https to http links

This commit is contained in:
rallytime 2016-04-11 11:43:42 -06:00
parent f4b4f43fbc
commit 00fbe44f94

View file

@ -226,6 +226,7 @@ _DISABLE_SALT_CHECKS=$BS_FALSE
_SALT_GIT_CHECKOUT_DIR=${BS_SALT_GIT_CHECKOUT_DIR:-/tmp/git/salt}
_NO_DEPS=$BS_FALSE
_FORCE_SHALLOW_CLONE=$BS_FALSE
_DISABLE_SSL=$BS_FALSE
#--- FUNCTION -------------------------------------------------------------------------------------------------------
@ -319,12 +320,14 @@ __usage() {
step.
-f Force shallow cloning for git installations.
This may result in an "n/a" in the version number.
-l Disable ssl checks. When passed, switches "https" calls to "http" where
possible.
EOT
} # ---------- end of function __usage ----------
while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbf" opt
while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:Zbfl" opt
do
case "${opt}" in
@ -385,6 +388,7 @@ do
Z ) _ENABLE_EXTERNAL_ZMQ_REPOS=$BS_TRUE ;;
b ) _NO_DEPS=$BS_TRUE ;;
f ) _FORCE_SHALLOW_CLONE=$BS_TRUE ;;
l ) _DISABLE_SSL=$BS_TRUE ;;
\?) echo
echoerror "Option does not exist : $OPTARG"
@ -428,7 +432,7 @@ if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MASTER_ADDRESS" != "null" ]
exit 1
fi
# Check that we're installing a minion if we're being passed a master address
# Check that we're installing a minion if we're being passed a minion id
if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MINION_ID" != "null" ]; then
echoerror "Don't pass a minion id (-i) if no minion is going to be bootstrapped."
exit 1
@ -488,6 +492,13 @@ if [ "$#" -gt 0 ]; then
exit 1
fi
# Check the _DISABLE_SSL value and set HTTP or HTTPS.
if [ "$_DISABLE_SSL" -eq "${BS_TRUE}" ]; then
HTTP_VAL="http"
else
HTTP_VAL="https"
fi
# whoami alternative for SunOS
if [ -f /usr/xpg4/bin/id ]; then
whoami='/usr/xpg4/bin/id -un'
@ -2091,7 +2102,7 @@ install_ubuntu_stable_deps() {
__apt_get_install_noinput wget
# shellcheck disable=SC2086
wget $_WGET_ARGS -q https://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1
wget $_WGET_ARGS -q $HTTP_VAL://repo.saltstack.com/apt/ubuntu/$DISTRO_VERSION/$repo_arch/$STABLE_REV/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1
else
# Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7
@ -3142,7 +3153,7 @@ __install_saltstack_copr_zeromq_repository() {
__REPOTYPE="epel"
fi
__fetch_url /etc/yum.repos.d/saltstack-zeromq4.repo \
"https://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1
"${HTTP_VAL}://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/saltstack-zeromq4-${__REPOTYPE}-${DISTRO_MAJOR_VERSION}.repo" || return 1
fi
return 0
}
@ -3154,8 +3165,8 @@ __install_saltstack_rhel_repository() {
repo_rev="latest"
fi
base_url="https://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/"
fetch_url="https://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/"
base_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/"
fetch_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/"
if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then
gpg_key="SALTSTACK-EL5-GPG-KEY.pub"
@ -3183,7 +3194,7 @@ _eof
# Import CentOS 7 GPG key on RHEL for installing base dependencies from
# Salt corporate repository
rpm -qa gpg-pubkey\* --qf "%{name}-%{version}\n" | grep -q ^gpg-pubkey-f4a80eb5$ || \
__rpm_import_gpg "https://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1
__rpm_import_gpg "${HTTP_VAL}://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1
fi
return 0
@ -3203,7 +3214,7 @@ __install_saltstack_copr_salt_repository() {
if [ ! -s "/etc/yum.repos.d/${__REPO_FILENAME}" ]; then
__fetch_url "/etc/yum.repos.d/${__REPO_FILENAME}" \
"https://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1
"${HTTP_VAL}://copr.fedorainfracloud.org/coprs/saltstack/salt/repo/${__REPOTYPE}-${DISTRO_MAJOR_VERSION}/${__REPO_FILENAME}" || return 1
fi
return 0
}
@ -3866,8 +3877,8 @@ install_amazon_linux_ami_deps() {
disabled=False
name=SaltStack repo for RHEL/CentOS 6
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTSTACK-GPG-KEY.pub
baseurl=https://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/
gpgkey=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/SALTSTACK-GPG-KEY.pub
baseurl=$HTTP_VAL://repo.saltstack.com/yum/redhat/6/\$basearch/$STABLE_REV/
humanname=SaltStack repo for RHEL/CentOS 6
_eof
fi
@ -4540,7 +4551,7 @@ install_openbsd_deps() {
# Let's download, since they were not provided, the default configuration files
if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then
ftp -o "$_TEMP_CONFIG_DIR/$fname" \
"https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
"${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
fi
done
fi
@ -4612,7 +4623,7 @@ install_openbsd_post() {
if [ $? -eq 1 ]; then
if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then
ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \
"https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d"
"${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d"
if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then
__copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1
echo salt_${fname}_enable="YES" >> /etc/rc.conf.local
@ -4685,12 +4696,12 @@ install_smartos_deps() {
if [ ! -f "$_SALT_ETC_DIR/minion" ] && [ ! -f "$_TEMP_CONFIG_DIR/minion" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/minion" -L \
https://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1
$HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1
fi
if [ ! -f "$_SALT_ETC_DIR/master" ] && [ ! -f $_TEMP_CONFIG_DIR/master ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/master" -L \
https://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1
$HTTP_VAL://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1
fi
fi
@ -4765,7 +4776,7 @@ install_smartos_post() {
if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname.xml" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/salt-$fname.xml" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml"
"${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml"
fi
svccfg import "$_TEMP_CONFIG_DIR/salt-$fname.xml"
if [ "${VIRTUAL_TYPE}" = "global" ]; then
@ -5171,7 +5182,7 @@ install_suse_12_stable_deps() {
if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
"${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
fi
done
fi
@ -5242,7 +5253,7 @@ install_suse_12_stable_post() {
if [ -f /bin/systemctl ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
-o "/usr/lib/systemd/system/salt-$fname.service" || return 1
continue
fi
@ -5357,7 +5368,7 @@ install_suse_11_stable_deps() {
if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
"${HTTP_VAL}://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
fi
done
fi
@ -5428,13 +5439,13 @@ install_suse_11_stable_post() {
if [ -f /bin/systemctl ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
-o "/lib/systemd/system/salt-$fname.service" || return 1
continue
fi
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \
curl $_CURL_ARGS -L "${HTTP_VAL}://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \
-o "/etc/init.d/salt-$fname" || return 1
chmod +x "/etc/init.d/salt-$fname"