Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ function Download($download_url, $platforms) {
if ($auth_token) {
$wc.Headers["Authorization"] = "Bearer $auth_token"
}
$wc.downloadFile($url, $dir_path)
try {
$wc.DownloadFile($url, $dir_path)
} catch [System.Net.WebException] {
$statusCode = [int]$_.Exception.Response.StatusCode
if ($statusCode -eq 403) {
throw "Error: No package available for your platform ($arch). Please contact support@columnar.tech for assistance."
Comment thread
zeroshade marked this conversation as resolved.
Outdated
Comment thread
amoeba marked this conversation as resolved.
Outdated
}
throw "Error: Failed to download $url. HTTP Status Code: $statusCode"
}

Write-Verbose "Unpacking to $tmp"

Expand Down
19 changes: 15 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1374,22 +1374,33 @@ downloader() {
else _dld='curl or wget' # to be used in error message of need_cmd
fi

SUCCESS=0
HTTP_STATUS=0
if [ "$1" = --check ]
then need_cmd "$_dld"
elif [ "$_dld" = curl ]; then
if [ -n "${AUTH_TOKEN:-}" ]; then
curl -sSfL --header "Authorization: Bearer ${AUTH_TOKEN}" "$1" -o "$2"
HTTP_STATUS=$(curl -sSfL --header "Authorization: Bearer ${AUTH_TOKEN}" "$1" -o "$2" -w "%{http_code}" 2> /dev/null)
SUCCESS=$?
else
curl -sSfL "$1" -o "$2"
HTTP_STATUS=$(curl -sSfL "$1" -o "$2" -w "%{http_code}" 2> /dev/null)
SUCCESS=$?
fi
elif [ "$_dld" = wget ]; then
if [ -n "${AUTH_TOKEN:-}" ]; then
wget --header "Authorization: Bearer ${AUTH_TOKEN}" "$1" -O "$2"
HTTP_STATUS=$(wget -NS --header "Authorization: Bearer ${AUTH_TOKEN}" "$1" -O "$2" 2>&1 | grep "HTTP/" | awk '{print $2}')
SUCCESS=$?
else
wget "$1" -O "$2"
HTTP_STATUS=$(wget -NS "$1" -O "$2" 2>&1 | grep "HTTP/" | awk '{print $2}')
SUCCESS=$?
fi
else err "Unknown downloader" # should not reach here
fi

if [ "$SUCCESS" -ne 0 ] || [ "$HTTP_STATUS" -eq 403 ]; then
say "Error: No package available for your platform. Please contact support@columnar.tech for assistance."
Comment thread
zeroshade marked this conversation as resolved.
Outdated
Comment thread
amoeba marked this conversation as resolved.
Outdated
exit 1
fi
}

download_binary_and_run_installer "$@" || exit 1
Loading