From 7e001a020810929ff475478ff9225600e6726291 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 5 Sep 2020 16:11:01 -0400 Subject: [PATCH] Added update script to keep Swamp up to date. --- swamp-update.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 swamp-update.sh diff --git a/swamp-update.sh b/swamp-update.sh new file mode 100755 index 0000000..410b4b1 --- /dev/null +++ b/swamp-update.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +updateURL="https://www.kaldobsky.com/audiogames/SwampPatch.zip" + +extract_error() { + echo "There was an error extracting the patch." + exit 1 +} + + +# Set the swamp directory +pushd ~/.local/wine/swamp + +# Restore the directory stack on exit. +trap popd EXIT + +echo "Checking for Swamp updates..." + +# Check for and download new patches. +update="$(wget -N "${updateURL}" 2>&1 | grep "not modified on server")" + +if [ -n "${update}" ]; then + echo "Swamp is up to date." + exit 0 +fi + +echo "Updating Swamp..." + +# Unzip the new patch +unzip -o SwampPatch.zip || extract_error + +echo "Swamp has been updated." + +exit 0