Update installer scripts

This commit is contained in:
Vladimir Safonkin 2022-03-31 14:24:07 +02:00
parent 9858bda9ee
commit 31ddd25ffd

View File

@ -637,11 +637,13 @@ get_specific_product_version() {
if machine_has "curl" if machine_has "curl"
then then
specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1) if ! specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1); then
if [ $? = 0 ]; then continue
else
echo "${specific_product_version//[$'\t\r\n']}" echo "${specific_product_version//[$'\t\r\n']}"
return 0 return 0
fi fi
elif machine_has "wget" elif machine_has "wget"
then then
specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1) specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1)
@ -921,9 +923,15 @@ get_http_header_wget() {
local remote_path="$1" local remote_path="$1"
local disable_feed_credential="$2" local disable_feed_credential="$2"
local wget_options="-q -S --spider --tries 5 " local wget_options="-q -S --spider --tries 5 "
# Store options that aren't supported on all wget implementations separately.
local wget_options_extra="--waitretry 2 --connect-timeout 15 " local wget_options_extra=''
local wget_result=''
# Test for options that aren't supported on all wget implementations.
if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then
wget_options_extra="--waitretry 2 --connect-timeout 15 "
else
say "wget extra options are unavailable for this environment"
fi
remote_path_with_credential="$remote_path" remote_path_with_credential="$remote_path"
if [ "$disable_feed_credential" = false ]; then if [ "$disable_feed_credential" = false ]; then
@ -931,15 +939,8 @@ get_http_header_wget() {
fi fi
wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1 wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1
wget_result=$?
if [[ $wget_result == 2 ]]; then return $?
# Parsing of the command has failed. Exclude potentially unrecognized options and retry.
wget $wget_options "$remote_path_with_credential" 2>&1
return $?
fi
return $wget_result
} }
# args: # args:
@ -1030,10 +1031,17 @@ downloadwget() {
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential # Append feed_credential as late as possible before calling wget to avoid logging feed_credential
local remote_path_with_credential="${remote_path}${feed_credential}" local remote_path_with_credential="${remote_path}${feed_credential}"
local wget_options="--tries 20 " local wget_options="--tries 20 "
# Store options that aren't supported on all wget implementations separately.
local wget_options_extra="--waitretry 2 --connect-timeout 15 " local wget_options_extra=''
local wget_result='' local wget_result=''
# Test for options that aren't supported on all wget implementations.
if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then
wget_options_extra="--waitretry 2 --connect-timeout 15 "
else
say "wget extra options are unavailable for this environment"
fi
if [ -z "$out_path" ]; then if [ -z "$out_path" ]; then
wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1 wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1
wget_result=$? wget_result=$?
@ -1042,17 +1050,6 @@ downloadwget() {
wget_result=$? wget_result=$?
fi fi
if [[ $wget_result == 2 ]]; then
# Parsing of the command has failed. Exclude potentially unrecognized options and retry.
if [ -z "$out_path" ]; then
wget -q $wget_options -O - "$remote_path_with_credential" 2>&1
wget_result=$?
else
wget $wget_options -O "$out_path" "$remote_path_with_credential" 2>&1
wget_result=$?
fi
fi
if [[ $wget_result != 0 ]]; then if [[ $wget_result != 0 ]]; then
local disable_feed_credential=false local disable_feed_credential=false
local response=$(get_http_header_wget $remote_path $disable_feed_credential) local response=$(get_http_header_wget $remote_path $disable_feed_credential)
@ -1652,4 +1649,4 @@ fi
say "Note that the script does not resolve dependencies during installation." say "Note that the script does not resolve dependencies during installation."
say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
say "Installation finished successfully." say "Installation finished successfully."