Skip to content

Instantly share code, notes, and snippets.

@lhw
Created June 22, 2012 00:30
Show Gist options
  • Save lhw/2969494 to your computer and use it in GitHub Desktop.
Save lhw/2969494 to your computer and use it in GitHub Desktop.
GoG.com ScummVM Windows to Linux (self-extract)
#!/bin/sh
#
## Extracts inno setup and creates self extracting tar archive
## requires innoextract
#
FILE=`zenity --file-selection --file-filter='*.exe'`
GAME=`basename $FILE .exe | sed "s;setup_;;g" | sed "s;_;-;g"`
WORKSPACE=/tmp/$GAME
mkdir $WORKSPACE
cd $WORKSPACE
innoextract $FILE
rm -rf app/ScummVM app/innosetup_license.txt
convert app/gfw_high.ico gfw_high.png
mv "`ls -S | head -n1`" app/gfw_high.png
mv app $GAME
tar czvf $GAME.tar.gz $GAME
cat > $GAME.sh <<EOF
#!/bin/sh
TMPDIR=\`mktemp -d /tmp/selfextract.XXX\`
ARCHIVE=\`awk '/^__ARCHIVE__/ {print NR + 1; exit 0; }' \$0\`
tail -n+\$ARCHIVE \$0 | tar xzv -C \$TMPDIR
TARGET=\`zenity --file-selection --directory\`
mv \$TMPDIR/* \$TARGET/
rm -rf \$TMPDIR
exit 0
__ARCHIVE__
EOF
cat $GAME.tar.gz >> $GAME.sh
chmod +x $GAME.sh
mv $GAME.sh $HOME
rm -rf $WORKSPACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment