Advertisement
Guest User

Untitled

a guest
Mar 18th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.78 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #
  4. ## This script extracts the game data and builds a debian archive which can be easily installed
  5. ## The following debian/ubuntu packages are required fakeroot, dpkg, imagemagick, innoextract
  6. #
  7.  
  8. FILE=`zenity --file-selection --file-filter='*.exe'`
  9. INFO=`zenity --forms --text "the scummvm short (e.g. sky) can be found here\n http://www.scummvm.org/compatibility/" --add-entry=scummvm-short`
  10. GAME=`basename $FILE .exe | sed "s;setup_;;g"`
  11. SHORT=`echo $INFO | cut -d"|" -f1`
  12. TITLE="`wget www.gog.com/en/gamecard/$GAME/ -O - 2>/dev/null | sed -n -e 's;.*<title>\(.*\) -.*</title>.*;\1;p'`"
  13. GAME=`echo $GAME | sed "s;_;-;g"`
  14. FULLNAME="`getent passwd $(whoami) | cut -d ':' -f 5 | cut -d ',' -f1`"
  15. MAINTAINER="$FULLNAME <$USER@`cat /etc/hostname`>"
  16. WORKSPACE=/tmp/$GAME
  17.  
  18. mkdir $WORKSPACE
  19. cd $WORKSPACE
  20. innoextract $FILE
  21. rm -rf app/ScummVM app/innosetup_license.txt
  22. mkdir -p $GAME/usr/share/applications $GAME/DEBIAN
  23. mv app $GAME/usr/share/$GAME
  24.  
  25. cat > $GAME/usr/share/applications/$GAME.desktop <<EOF
  26. [Desktop Entry]
  27. Name=$TITLE
  28. Exec=scummvm -c /usr/share/$GAME/SKY.CFG -p /usr/share/$GAME $SHORT
  29. Type=Application
  30. Icon=/usr/share/$GAME/gfw_high.png
  31. Categories=Games
  32. EOF
  33.  
  34. cat > $GAME/DEBIAN/control <<EOF
  35. Package: $GAME
  36. Section: games
  37. Version: 0.0-1
  38. Priority: optional
  39. Maintainer: $MAINTAINER
  40. Architecture: all
  41. Depends: scummvm
  42. Homepage: http://www.gog.com/en/gamecard/$GAME/
  43. Description: Downloaded from GOG.com
  44. EOF
  45.  
  46. convert $GAME/usr/share/$GAME/gfw_high.ico gfw_high.png
  47. mv "`ls -S | head -n1`" "$GAME/usr/share/$GAME/gfw_high.png"
  48.  
  49. cd $GAME
  50. find usr -type f -exec md5sum {} \; > DEBIAN/md5sums
  51. cd ..
  52.  
  53. find $GAME/ -type f -exec chmod 644 {} \;
  54. find $GAME/ -type d -exec chmod 755 {} \;
  55.  
  56. fakeroot dpkg-deb --build $GAME
  57. mv $GAME.deb $HOME
  58. rm -rf $WORKSPACE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement