testmode web_get

This commit is contained in:
zenobit 2023-10-13 02:04:20 +02:00 committed by Martin Wimpress
parent a1679d2566
commit 58e69834cb

View File

@ -25,6 +25,17 @@ function cleanup() {
fi fi
} }
if [ "${1}" == '-t' ]; then
testmode="on"
if [ -n "$4" ]; then
set -- "$2" "$3" "$4"
elif [ -n "$3" ]; then
set -- "$2" "$3"
else
set -- "$2"
fi
fi
function pretty_name() { function pretty_name() {
local SIMPLE_NAME="" local SIMPLE_NAME=""
local PRETTY_NAME="" local PRETTY_NAME=""
@ -797,6 +808,9 @@ function editions_zorin() {
} }
function check_hash() { function check_hash() {
if [ "${testmode}" == 'on' ]; then
exit 0
fi
local iso="" local iso=""
local hash="" local hash=""
local hash_algo="" local hash_algo=""
@ -846,6 +860,11 @@ function web_get() {
exit 1 exit 1
fi fi
echo #Necessary as aria2c in suppressed mode does not have new lines echo #Necessary as aria2c in suppressed mode does not have new lines
# Test mode for ISO (yet wget only)
elif [ "${testmode}" == 'on' ]; then
echo "${URL}"
#wget --spider "${URL}"
exit 1
else else
if ! wget --quiet --continue --tries=3 --read-timeout=10 --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then if ! wget --quiet --continue --tries=3 --read-timeout=10 --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL} with wget. Try running 'quickget' again." echo "ERROR! Failed to download ${URL} with wget. Try running 'quickget' again."