Improved, hopefully, the swamp-update script.
This commit is contained in:
parent
42835dc2a9
commit
a90b808700
@ -38,35 +38,23 @@
|
|||||||
# or portions thereof with code not governed by the terms of the CPAL.
|
# or portions thereof with code not governed by the terms of the CPAL.
|
||||||
|
|
||||||
cache="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/cache"
|
cache="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-manager/cache"
|
||||||
updateURL="https://www.kaldobsky.com/audiogames/Swamp.zip"
|
updateURL="https://www.kaldobsky.com/audiogames"
|
||||||
|
updateFiles=("Swamp.zip")
|
||||||
extract_error() {
|
|
||||||
echo "There was an error extracting the zip file."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Set the swamp directory
|
# Back up configuration files.
|
||||||
pushd ~/.local/wine/swamp/drive_c/Program\ Files/swamp
|
for i in losers.txt muted.txt scriptkeys.txt keyconfig.ini ; do
|
||||||
|
cp -v ~/"drive_c/Program Files/swamp/${i}" ~/"drive_c/Program Files/swamp/${i}.agm"
|
||||||
|
echo "${i} backed up as ${i}.agm"
|
||||||
|
done | dialog --progressbox "Backing up configuration files. They can be found in your swamp directory." -1 -1
|
||||||
|
|
||||||
# Restore the directory stack on exit.
|
sleep 3
|
||||||
trap popd EXIT
|
|
||||||
|
|
||||||
echo "Checking for Swamp updates..."
|
# Download and extract updates
|
||||||
|
for i in "${updateFiles[@]}" ; do
|
||||||
|
wget -O "${cache}/$i" "${url}/$i"
|
||||||
|
unzip -d ~/"drive_c/Program Files/swamp" "${cache}/${i}"
|
||||||
|
done | dialog --progressbox "Updating Swamp, please wait..." -1 -1
|
||||||
|
|
||||||
# Check for and download new versions.
|
|
||||||
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 Swamp.zip || extract_error
|
|
||||||
|
|
||||||
echo "Swamp has been updated."
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user