Files

41 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# shellcheck disable=SC1091 # AGM includes are resolved relative to this script.
scriptDir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.."
# shellcheck source=.includes/dialog-interface.sh
source "${scriptDir}/.includes/dialog-interface.sh"
# shellcheck source=.includes/functions.sh
source "${scriptDir}/.includes/functions.sh"
export game="Tekken 3"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/audiogame-manager"
gamePath="$HOME/.local/wine64/drive_c/Program Files/Tekken 3 Access"
if ! command -v python3 >/dev/null; then
alert "Tekken 3 Update" "Install native Linux Python 3, then run this updater again."
exit 1
fi
if ! updateOutput="$(python3 "${scriptDir}/game-scripts/tekken3_setup.py" validate-installation "$gamePath" 2>&1)"; then
alert "Tekken 3 Update" "$updateOutput"
exit 1
fi
if ! mkdir -p "$cache"; then
alert "Tekken 3 Update" "Could not create the download cache: ${cache}"
exit 1
fi
if ! updateOutput="$(python3 "${scriptDir}/game-scripts/tekken3_setup.py" latest-release 2>&1)"; then
alert "Tekken 3 Update" "$updateOutput"
exit 1
fi
IFS=$'\t' read -r modVersion modUrl modHash <<< "$updateOutput"
if ! download "$modUrl"; then
alert "Tekken 3 Update" "Could not download Tekken 3 Access ${modVersion}."
exit 1
fi
if ! updateOutput="$(python3 "${scriptDir}/game-scripts/tekken3_setup.py" update \
"${cache}/${modUrl##*/}" "$gamePath" --mod-sha256 "$modHash" --mod-version "$modVersion" 2>&1)"; then
alert "Tekken 3 Update" "$updateOutput"
exit 1
fi
agm_msgbox "Tekken 3 Update" "Tekken 3 Update" "$updateOutput"