Special function added for urls that break the normal download function.

This commit is contained in:
Storm Dragon 2023-11-12 00:03:07 -05:00
parent 19eb06a66b
commit e2b019dc55

View File

@ -206,6 +206,24 @@ download() {
done done
} }
download_named() {
# Only needed if url breaks the name, e.g. downloads/?filename=1234
# Required arguments: filename url
# Only works with one file at a time.
local dest="$1"
# Remove the destination file if it is empty.
test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null
if [[ "${redownload}" == "true" ]] && [[ -e "${cache}/${dest}" ]]; then
rm -v "${cache}/${dest}"
fi
# Skip if the item is in cache.
test -e "${cache}/${dest}" && continue
if ! curl -L4 --output "${cache}/${dest}" "${2}" ; then
echo "Could not download \"$dest\"..."
exit 1
fi
}
get_installer() { get_installer() {
trap "exit 0" SIGINT trap "exit 0" SIGINT
# If the file is in cache nothing else needs to be done. # If the file is in cache nothing else needs to be done.
@ -651,8 +669,9 @@ case "${game}" in
fi fi
fi fi
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)" doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)"
get_installer "keyshare-universal.pk3" "https://forum.zdoom.org/download/file.php?id=42262" # The url breaks the normal download function
download "https://www.dropbox.com/s/uf01fx3vydua6zx/TobyAccessibilityMod_Version${tobyVersion}.zip?dl=0" https://www.dropbox.com/scl/fi/bac94s01bl31p6e73pbof/OperationMDK.zip?rlkey=6ufdqgyacakqz6ulr2cue6rtm&dl=1" download_named "keyshare-universal.pk3" "https://forum.zdoom.org/download/file.php?id=42262"
download "https://www.dropbox.com/s/uf01fx3vydua6zx/TobyAccessibilityMod_Version${tobyVersion}.zip?dl=0" "https://www.dropbox.com/scl/fi/bac94s01bl31p6e73pbof/OperationMDK.zip?rlkey=6ufdqgyacakqz6ulr2cue6rtm&dl=1"
echo "The next step may require your password." echo "The next step may require your password."
echo "It is necessary to places the extracted files in their proper place." echo "It is necessary to places the extracted files in their proper place."
alert alert