From 8570172cc0cd3cab38b9108d37bf45ee6af2bc8a Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 22 Jan 2024 12:59:04 -0500 Subject: [PATCH] Switch some items to ipfs. Fix download function to handle ipfs download links. Updated help flag. --- linux-game-manager.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/linux-game-manager.sh b/linux-game-manager.sh index eba0535..14c1701 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -191,6 +191,7 @@ download() { for i in "${source[@]}" ; do local dest="${i##*/}" dest="${dest//%20/ }" + dest="${dest#*\?filename=}" dest="${dest%\?*}" # Remove the destination file if it is empty. test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null @@ -264,6 +265,14 @@ help() { for i in "${!command[@]}" ; do echo "-${i/:/ }: ${command[${i}]}" 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 } @@ -470,6 +479,7 @@ if [[ -r "${configFile%/*}/settings.conf" ]]; then source "${configFile%/*}/settings.conf" fi unset noCache +export ipfsGateway="${ipfsGateway:-https://gateway.pinata.cloud}" # The list of games available for installation. # Use menu friendly names. @@ -670,16 +680,16 @@ case "${game}" in if ! [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then alert 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 # 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" + 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 "It is necessary to move the extracted files into their proper place." 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}/OperationMDK.zip" sudo cp -v "${cache}/keyshare-universal.pk3" "${doomPath}"