diff --git a/.includes/ipfs.sh b/.includes/ipfs.sh index bd0085f..e02fcad 100644 --- a/.includes/ipfs.sh +++ b/.includes/ipfs.sh @@ -3,7 +3,7 @@ declare -Ag ipfs=( # Games (alphabetical order) - [Audio_Defence_aarch64]="${ipfsGateway}/ipfs/QmNN39dhssJBVsN3qXM7LKiy5bP2nUFWruksKy3RAvAz4e?filename=AudioDefence-26.09.20-3-aarch64.AppImage" - [Audio_Defence_x86_64]="${ipfsGateway}/ipfs/QmaH6eQaoPXBDh4GDhXBZiNH6NXaduGta9suQdPwkpfffx?filename=AudioDefence-26.09.20-3-x86_64.AppImage" + [Audio_Defence_aarch64]="${ipfsGateway}/ipfs/QmNdnfvLqJXDSvQiUjAsKt3y2yNjYoZEGQ8NffaBmhTeVd?filename=AudioDefence-26.09.22-1-aarch64.AppImage" + [Audio_Defence_x86_64]="${ipfsGateway}/ipfs/QmVKGMFPsAzb3SRvFKSX5b5e45ngj4wobKUk7kaeAam3Sn?filename=AudioDefence-26.09.22-1-x86_64.AppImage" [FreeDoom]="${ipfsGateway}/ipfs/QmU6REFot8CGVSBy2YWQxnmXoh7M4EF74RxFtLzvtJxoGC?filename=toby_doom_9.0_full.zip" ) diff --git a/.install/Audio Defence.sh b/.install/Audio Defence.sh index 9fcde87..9314b51 100644 --- a/.install/Audio Defence.sh +++ b/.install/Audio Defence.sh @@ -1,21 +1,10 @@ # shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh check_architecture x86_64 aarch64 -case "$(uname -m)" in - x86_64) - appImageFile="AudioDefence-26.09.20-3-x86_64.AppImage" - expectedHash="8ac007d2c2ea29cd2c84d22d892d1e92f236b456a3667f66919a837f023040cf" - ;; - aarch64) - appImageFile="AudioDefence-26.09.20-3-aarch64.AppImage" - expectedHash="2b3c5efeda51f1be5a9389d05a4a29ca7f92d39b20c8017f1ca0d492c69cf850" - ;; -esac -download_named "${appImageFile}" "${ipfs[Audio_Defence_$(uname -m)]}" -if ! printf '%s %s\n' "${expectedHash}" "${cache}/${appImageFile}" | sha256sum --check --strict; then - rm -f "${cache}/${appImageFile}" - ui_msgbox "Linux Game Manager" "Linux Game Manager" "The Audio Defence download failed its SHA-256 verification. Please try again." - exit 1 -fi +audioDefenceUrl="${ipfs[Audio_Defence_$(uname -m)]}" +downloadFile="${audioDefenceUrl##*filename=}" +downloadFile="${downloadFile%%&*}" +[[ -n "${downloadFile}" && "${downloadFile}" != "${audioDefenceUrl}" ]] || downloadFile="AudioDefence-$(uname -m).AppImage" +download_named "${downloadFile}" "${audioDefenceUrl}" mkdir -p "${installPath}/Audio_Defence" -cp -v "${cache}/${appImageFile}" "${installPath}/Audio_Defence/${appImageFile}" -chmod +x "${installPath}/Audio_Defence/${appImageFile}" +install -v -m 0755 "${cache}/${downloadFile}" "${installPath}/Audio_Defence/AudioDefence.AppImage" +find "${installPath}/Audio_Defence" -maxdepth 1 -type f -name 'AudioDefence-*.AppImage' -delete diff --git a/.launch/Audio Defence.game b/.launch/Audio Defence.game index 080f5f5..de7e248 100644 --- a/.launch/Audio Defence.game +++ b/.launch/Audio Defence.game @@ -1,11 +1,3 @@ # shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh gamePath="${installPath}/Audio_Defence" -case "$(uname -m)" in - aarch64) - appImageFile="AudioDefence-26.09.20-3-aarch64.AppImage" - ;; - *) - appImageFile="AudioDefence-26.09.20-3-x86_64.AppImage" - ;; -esac -run_with_optional_gamemode "${gamePath}/${appImageFile}" +run_with_optional_gamemode "${gamePath}/AudioDefence.AppImage" diff --git a/.update/Audio Defence.sh b/.update/Audio Defence.sh new file mode 100644 index 0000000..16d9264 --- /dev/null +++ b/.update/Audio Defence.sh @@ -0,0 +1,20 @@ +# shellcheck shell=bash disable=SC2154 # Variables are set by linux-game-manager.sh +run_update() { + check_architecture x86_64 aarch64 + local audioDefenceUrl="${ipfs[Audio_Defence_$(uname -m)]}" + local downloadFile="${audioDefenceUrl##*filename=}" + downloadFile="${downloadFile%%&*}" + [[ -n "${downloadFile}" && "${downloadFile}" != "${audioDefenceUrl}" ]] || \ + downloadFile="AudioDefence-$(uname -m).AppImage" + + # download_named reads this dynamically scoped flag. + # shellcheck disable=SC2034 + local redownload=true + download_named "${downloadFile}" "${audioDefenceUrl}" + + local gamePath="${installPath}/Audio_Defence" + mkdir -p "${gamePath}" + install -v -m 0755 "${cache}/${downloadFile}" "${gamePath}/AudioDefence.AppImage.new" + mv -v "${gamePath}/AudioDefence.AppImage.new" "${gamePath}/AudioDefence.AppImage" + find "${gamePath}" -maxdepth 1 -type f -name 'AudioDefence-*.AppImage' -delete +}