Skip to content

Instantly share code, notes, and snippets.

Created April 26, 2016 21:51
Show Gist options
  • Save anonymous/23fb19c7f5e455147b6528f6bafdbbc7 to your computer and use it in GitHub Desktop.
Save anonymous/23fb19c7f5e455147b6528f6bafdbbc7 to your computer and use it in GitHub Desktop.
#You need
#curl, wget, node, npm
VERSION=$(curl https://updates.counterplay.co/ | grep duelyst |grep -v staging | grep zip | tail -c 18 | head -c 6)
wget http://downloads.counterplay.co/duelyst/v$VERSION/duelyst-v$VERSION-win32-x64.zip
#remove old stuff
rm -rf Duelyst-linux-x64
#extract it
rm -rf duelyst-v$VERSION
unzip duelyst-v$VERSION-win32-x64.zip -d duelyst-v$VERSION
#tweak app
cd duelyst-v$VERSION/resources/app
sed -i "s/app.on('ready', function () {/app.on('ready', function () {\n argv.token = '32432543254'\n/" desktop.js
sed -i "/if (pkgJson.name === 'duelyst' && argv.token === undefined) {/,+12d" desktop.js
sed -i "s/fullscreen: \!argv.windowed/fullscreen: false/" desktop.js
sed -i "s/if (process.platform === 'win32') setupWin32Shortcuts()/if (process.platform === 'win32' || process.platform === 'linux') setupWin32Shortcuts()/" desktop.js
#build it
npm install electron-prebuilt --save
npm install && 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
cd ../../..
rm -rf duelyst-v$VERSION
#zip it for backup
zip -r Duelyst-linux-x64-v$VERSION.zip Duelyst-linux-x64/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment