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
}
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() {
trap "exit 0" SIGINT
# If the file is in cache nothing else needs to be done.
@ -651,8 +669,9 @@ case "${game}" in
fi
fi
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"
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"
# The url breaks the normal download function
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 "It is necessary to places the extracted files in their proper place."
alert