-
Notifications
You must be signed in to change notification settings - Fork 3
/
Duelyst-Updater
executable file
·63 lines (47 loc) · 2.09 KB
/
Duelyst-Updater
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
update_duelyst () {
#download the binaries
wget -c http://downloads.counterplay.co/duelyst/v$CURRENT_VERSION/duelyst-v$CURRENT_VERSION-win32-x64.zip
#remove old stuff
rm -rf Duelyst-linux-x64
#extract it
unzip duelyst-v$CURRENT_VERSION-win32-x64.zip -d duelyst-v$CURRENT_VERSION
rm duelyst-v$CURRENT_VERSION-win32-x64.zip
#patch app
pushd duelyst-v$CURRENT_VERSION/resources/app
patch desktop.js ../../../linux_patch.diff
#build it
npm install electron-packager
npm install electron --save-dev
npm install && ./node_modules/.bin/electron-packager . $npm_package_productName --asar --platform=linux --overwrite --arch=x64 --app-version=$npm_package_version --icon=icon.icns --out=build --ignore='build|node_modules/gulp-*|node_modules/(electron-packager|electron-prebuilt|electron-rebuild|electron-windows-installer|electron-connect|gulp|tape)'
#make the folder
mv build/Duelyst-linux-x64/ ../../..
#remove working folder
popd
cp duelyst-v$CURRENT_VERSION/resources/app/icon.png .
rm -rf duelyst-v$CURRENT_VERSION
echo $CURRENT_VERSION > local_version
echo "[Desktop Entry]" > ~/.local/share/applications/Duelyst.desktop
echo "Name=Duelyst" >> ~/.local/share/applications/Duelyst.desktop
echo "Exec=bash $(pwd)/Duelyst-Updater" >> ~/.local/share/applications/Duelyst.desktop
echo "Icon=$(pwd)/icon.png" >> ~/.local/share/applications/Duelyst.desktop
echo "Terminal=false" >> ~/.local/share/applications/Duelyst.desktop
echo "Type=Application" >> ~/.local/share/applications/Duelyst.desktop
echo "Categories=Game;" >> ~/.local/share/applications/Duelyst.desktop
}
CURRENT_VERSION=$(curl https://updates.counterplay.co/ 2>/dev/null | grep -v staging | grep zip |\
grep -o http://downloads.counterplay.co/duelyst/v[0-9\.]* | head -n 1 | tail -c +42)
if [ -z $CURRENT_VERSION ]; then
echo "Could not determine current version; no internet?";
exit 1
fi
cd "`dirname "$0"`"
if [ -f local_version ]; then
LOCAL_VERSION=$(cat local_version)
if [ ! "$LOCAL_VERSION" == "$CURRENT_VERSION" ]; then
update_duelyst
fi
else
update_duelyst
fi
./Duelyst-linux-x64/Duelyst -w