From 54e2e8eafd04dfd1950069cd4873f705874245a7 Mon Sep 17 00:00:00 2001 From: Pedro Beirao Date: Sun, 24 Nov 2024 13:14:56 +0000 Subject: [PATCH] Update dsda-updater-macos.sh --- updater/dsda-updater-macos.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/updater/dsda-updater-macos.sh b/updater/dsda-updater-macos.sh index 7a577dd..12c4fb1 100644 --- a/updater/dsda-updater-macos.sh +++ b/updater/dsda-updater-macos.sh @@ -4,6 +4,7 @@ REPO="kraflab/dsda-doom" TEMP=`mktemp --directory` DEST=$1 +echo $DEST TAG=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name') VERSION=${TAG:1} @@ -11,6 +12,11 @@ VERSION=${TAG:1} v_arm64="dsda-doom-$VERSION-mac-arm64" v_x64="dsda-doom-$VERSION-mac-x86_64" +CleanUp() +{ + rm -rf $TEMP +} + Download() { if curl -L -o $TEMP/$v_arm64.zip "https://github.com/$REPO/releases/download/$TAG/$v_arm64.zip" @@ -18,6 +24,7 @@ Download() unzip $TEMP/$v_arm64.zip -d $TEMP else echo "Error downloading update" + CleanUp exit 1 fi @@ -27,6 +34,7 @@ Download() unzip $TEMP/$v_x64.zip -d $TEMP else echo "Error downloading update" + CleanUp exit 1 fi } @@ -34,11 +42,11 @@ Download() RemoveOld() { [ -e $DEST/dsda-doom ] && rm -f $DEST/dsda-doom - [ -e $DEST/dsda-doom.wad ] &&rm -f $DEST/dsda-doom.wad - [ -e $DEST/COPYING.txt ] &&rm -f $DEST/COPYING.txt - [ -e $DEST/libs ] &&rm -r $DEST/libs - [ -e $DEST/libs_arm64 ] &&rm -r $DEST/libs_arm64 - [ -e $DEST/libs_x86_64 ] &&rm -r $DEST/libs_x86_64 + [ -e $DEST/dsda-doom.wad ] && rm -f $DEST/dsda-doom.wad + [ -e $DEST/COPYING.txt ] && rm -f $DEST/COPYING.txt + [ -e $DEST/libs ] && rm -rf $DEST/libs + [ -e $DEST/libs_arm64 ] && rm -rf $DEST/libs_arm64 + [ -e $DEST/libs_x86_64 ] && rm -rf $DEST/libs_x86_64 } CopyUpdate() @@ -50,11 +58,6 @@ CopyUpdate() cp -r $TEMP/$v_x64/libs_x86_64 $DEST/libs_x86_64 } -CleanUp() -{ - rm -r $TEMP -} - if [ $DEST ] then if [ -e $DEST ]