Advertisement
zzarko

Manic Digger install script for Debian based distros

Aug 18th, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.73 KB | None | 0 0
  1. #!/bin/bash
  2. # This script downloads and installs/updates Manic Digger for Debian-based distros
  3. # Version: 1.0
  4. # Author: Zarko Zivanov
  5. # Licence: GPL v3
  6.  
  7. # Usage:
  8. # - download, save as InstallManicDigger.sh
  9. # - run with
  10. #       bash InstallManicDigger.sh
  11. #   or make it executable and run it as usual
  12. # - enter root password if prompted (needed for installing dependencies)
  13.  
  14. #Install dependencies
  15. for dep in mono-complete libxi6 libgl1-mesa-dev libopenal1 wget unzip icoutils; do
  16.     installed=$(dpkg -l $dep | grep "ii  $dep")
  17.     if [ "$installed" == "" ]; then
  18.         sudo apt-get install $dep
  19.     fi
  20. done
  21.  
  22. # Download latest binary
  23. BINZIP=/tmp/ManicDiggerBinary.zip
  24. wget -O $BINZIP http://sourceforge.net/projects/manicdigger/files/latest/download?source=files
  25.  
  26. # Unpack files
  27. INSTALLDIR=~/Manic\ Digger
  28. UNPACKDIR=/tmp/ManicDiggerUnpack/
  29. unzip -o "$BINZIP" -d "$UNPACKDIR"
  30. mkdir -p "$INSTALLDIR"
  31. cp -rf "$UNPACKDIR"/ManicDigger20*/* "$INSTALLDIR"
  32.  
  33. # Extract icon
  34. wrestool -x -t 14 -o "$UNPACKDIR" "$INSTALLDIR"/ManicDigger.exe
  35. icotool -x "$UNPACKDIR"/*.ico -o "$INSTALLDIR"/ManicDigger.png
  36.  
  37. # Create launcher
  38. LAUNCHER=~/Desktop/Manic\ Digger.desktop
  39. echo -e "#!/usr/bin/env xdg-open" > "$LAUNCHER"
  40. echo -e "\n[Desktop Entry]" >> "$LAUNCHER"
  41. echo -e "\nVersion=1.0" >> "$LAUNCHER"
  42. echo -e "\nType=Application" >> "$LAUNCHER"
  43. echo -e "\nTerminal=false" >> "$LAUNCHER"
  44. echo -e "\nExec=mono \"$INSTALLDIR/ManicDigger.exe\"" >> "$LAUNCHER"
  45. echo -e "\nPath=$INSTALLDIR" >> "$LAUNCHER"
  46. echo -e "\nName=Manic Digger" >> "$LAUNCHER"
  47. echo -e "\nIcon=$INSTALLDIR/ManicDigger.png"  >> "$LAUNCHER"
  48. chmod 755 "$LAUNCHER"
  49. cp "$LAUNCHER" ~/.local/share/applications/
  50.  
  51. # Delete temporary files
  52. rm -rf "$UNPACKDIR"
  53. rm -f "$BINZIP"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement