mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
Download with extra sets of headers
This commit is contained in:
@@ -168,7 +168,7 @@ fi
|
||||
if [ -f "$archiveName" ] && [ "$DEBUG" -eq 1 ]; then
|
||||
printlog "$archiveName exists and DEBUG mode 1 enabled, skipping download"
|
||||
else
|
||||
# download the dmg
|
||||
# download
|
||||
printlog "Downloading $downloadURL to $archiveName"
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
@@ -178,25 +178,64 @@ else
|
||||
displaynotification "Downloading new $name" "Download in progress …"
|
||||
fi
|
||||
fi
|
||||
if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then
|
||||
if ! curl -fsL -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" -H "accept-encoding: gzip, deflate, br" -H "upgrade-insecure-requests: 1" -H "sec-fetch-dest: document" -H "sec-gpc: 1" -H "sec-fetch-user: ?1" -H "accept-language: en-US,en;q=0.9" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "sec-fetch-mode: navigate" "$downloadURL" -o "$archiveName"; then
|
||||
if ! curl -fsL -H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "accept-encoding: gzip, deflate, br" -H "accept-language: en-US,en;q=0.9" -H "sec-fetch-dest: document" -H "sec-fetch-mode: navigate" -H "sec-fetch-site: same-site" -H "sec-fetch-user: ?1" -H "sec-gpc: 1" -H "upgrade-insecure-requests: 1" "$downloadURL" -o "$archiveName"; then
|
||||
printlog "error downloading $downloadURL"
|
||||
message="$name update/installation failed. This will be logged, so IT can follow up."
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "$message" "Error updating $name"
|
||||
else
|
||||
displaynotification "$message" "Error installing $name"
|
||||
if ! curl -fsL "$downloadURL" -o "$archiveName"; then
|
||||
printlog "Trying 1st set of extra headers to download."
|
||||
if ! \
|
||||
curl -fsL \
|
||||
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \
|
||||
-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
|
||||
-H "accept-encoding: gzip, deflate, br" \
|
||||
-H "accept-language: en-US,en;q=0.9" \
|
||||
-H "sec-fetch-dest: document" \
|
||||
-H "sec-fetch-mode: navigate" \
|
||||
-H "sec-fetch-user: ?1" \
|
||||
-H "sec-gpc: 1" \
|
||||
-H "upgrade-insecure-requests: 1" \
|
||||
"$downloadURL" -o "$archiveName"
|
||||
then
|
||||
printlog "Trying 2nd set of extra headers to download."
|
||||
if ! \
|
||||
curl -fsL \
|
||||
-H "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" \
|
||||
-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
|
||||
-H "accept-encoding: gzip, deflate, br" \
|
||||
-H "accept-language: en-US,en;q=0.9" \
|
||||
-H "sec-fetch-dest: document" \
|
||||
-H "sec-fetch-mode: navigate" \
|
||||
-H "sec-fetch-site: same-site" \
|
||||
-H "sec-fetch-user: ?1" \
|
||||
-H "sec-gpc: 1" \
|
||||
-H "upgrade-insecure-requests: 1" \
|
||||
"$downloadURL" -o "$archiveName"
|
||||
then
|
||||
printlog "Trying 3rd set of extra headers to download."
|
||||
if ! \
|
||||
curl -fsL \
|
||||
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15" \
|
||||
-H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
|
||||
-H "accept-encoding: gzip, deflate, br" \
|
||||
-H "accept-language: en-US,en;q=0.9" \
|
||||
-H "sec-fetch-dest: document" \
|
||||
-H "sec-fetch-mode: navigate" \
|
||||
-H "sec-fetch-user: ?1" \
|
||||
-H "sec-gpc: 1" \
|
||||
-H "upgrade-insecure-requests: 1" \
|
||||
-H "Referrer Policy: strict-origin-when-cross-origin" \
|
||||
"$downloadURL" -o "$archiveName"
|
||||
then
|
||||
printlog "error downloading $downloadURL"
|
||||
message="$name update/installation failed. This will be logged, so IT can follow up."
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "$message" "Error updating $name"
|
||||
else
|
||||
displaynotification "$message" "Error installing $name"
|
||||
fi
|
||||
fi
|
||||
cleanupAndExit 2
|
||||
fi
|
||||
cleanupAndExit 2
|
||||
else
|
||||
printlog "Downloaded with all headers."
|
||||
fi
|
||||
else
|
||||
printlog "Downloaded with exta headers."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user