Skip to content

Commit

Permalink
Update dsda-updater-macos.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro-Beirao committed Nov 24, 2024
1 parent 2e5ab57 commit 54e2e8e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions updater/dsda-updater-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@ 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}

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"
then
unzip $TEMP/$v_arm64.zip -d $TEMP
else
echo "Error downloading update"
CleanUp
exit 1
fi

Expand All @@ -27,18 +34,19 @@ Download()
unzip $TEMP/$v_x64.zip -d $TEMP
else
echo "Error downloading update"
CleanUp
exit 1
fi
}

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()
Expand All @@ -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 ]
Expand Down

0 comments on commit 54e2e8e

Please sign in to comment.