Switch some items to ipfs. Fix download function to handle ipfs download links. Updated help flag.

This commit is contained in:
Storm Dragon 2024-01-22 12:59:04 -05:00
parent c925f2b091
commit 8570172cc0

View File

@ -191,6 +191,7 @@ download() {
for i in "${source[@]}" ; do for i in "${source[@]}" ; do
local dest="${i##*/}" local dest="${i##*/}"
dest="${dest//%20/ }" dest="${dest//%20/ }"
dest="${dest#*\?filename=}"
dest="${dest%\?*}" dest="${dest%\?*}"
# Remove the destination file if it is empty. # Remove the destination file if it is empty.
test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null
@ -264,6 +265,14 @@ help() {
for i in "${!command[@]}" ; do for i in "${!command[@]}" ; do
echo "-${i/:/ <parameter>}: ${command[${i}]}" echo "-${i/:/ <parameter>}: ${command[${i}]}"
done | sort done | sort
echo
echo "Some settings that are often used can be stored in a settings.conf file."
echo "If wanted, place it at the following location:"
echo "${configFile%/*}/settings.conf"
echo "The syntax is variable=\"value\""
echo
echo "ipfsGateway=\"https://gateway.pinata.cloud\" # Gateway to be used for ipfs downloads."
echo "noCache=\"true\" # Do not keep downloaded items in the cache."
exit 0 exit 0
} }
@ -470,6 +479,7 @@ if [[ -r "${configFile%/*}/settings.conf" ]]; then
source "${configFile%/*}/settings.conf" source "${configFile%/*}/settings.conf"
fi fi
unset noCache unset noCache
export ipfsGateway="${ipfsGateway:-https://gateway.pinata.cloud}"
# The list of games available for installation. # The list of games available for installation.
# Use menu friendly names. # Use menu friendly names.
@ -670,16 +680,16 @@ case "${game}" in
if ! [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then if ! [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then
alert alert
if dialog --backtitle "Linux Game manager" --yesno "Would you like Doom Metal Volume 6?" -1 -1 --stdout ; then if dialog --backtitle "Linux Game manager" --yesno "Would you like Doom Metal Volume 6?" -1 -1 --stdout ; then
get_installer "Doom_Metal_Volume_6_v2.rar" "https://www.moddb.com/addons/start/214324" download "${ipfsGateway}/ipfs/QmSzWKtP3wPvzn5GNd9F7n4RAhkFHxh2UHxXGefiAufwQW?filename=DoomMetalVol6.wad"
fi fi
fi fi
# The url breaks the normal download function # The url breaks the normal download function
download_named "keyshare-universal.pk3" "https://forum.zdoom.org/download/file.php?id=42262" 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" download "https://www.dropbox.com/s/uf01fx3vydua6zx/TobyAccessibilityMod_Version${tobyVersion}.zip?dl=0" "${ipfsGateway}/ipfs/QmPvNDz2z612bTADeQKj3ymHmjJWvGDE4yVnwSq9eNmJe3?filename=OperationMDK.zip"
echo "The next step may require your password." echo "The next step may require your password."
echo "It is necessary to move the extracted files into their proper place." echo "It is necessary to move the extracted files into their proper place."
alert alert
[[ -e "${cache}/Doom_Metal_Volume_6_v2.rar" ]] && sudo 7z x -o"${doomPath}" "${cache}/Doom_Metal_Volume_6_v2.rar" [[ -e "${cache}/DoomMetalVol6.wad" ]] && sudo mv "${cache}/DoomMetalVol6.wad" "${doomPath}/"
sudo unzip -n -d "${doomPath}" "${cache}/TobyAccessibilityMod_Version${tobyVersion}.zip" sudo unzip -n -d "${doomPath}" "${cache}/TobyAccessibilityMod_Version${tobyVersion}.zip"
sudo unzip -n -d "${doomPath}" "${cache}/OperationMDK.zip" sudo unzip -n -d "${doomPath}" "${cache}/OperationMDK.zip"
sudo cp -v "${cache}/keyshare-universal.pk3" "${doomPath}" sudo cp -v "${cache}/keyshare-universal.pk3" "${doomPath}"