Advertisement
neuromancer85

torchlight-hib-20120920-1

Sep 20th, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.70 KB | None | 0 0
  1. # Maintainer: Sam S. <smls75@gmail.com>
  2.  
  3. pkgname=torchlight-hib
  4. pkgver=1.0.20120920
  5. _hibver=2012-09-20
  6. pkgrel=1
  7. pkgdesc='A hack and slash action role-playing game (Humble Bundle version)'
  8. url='http://www.torchlightgame.com/'
  9. arch=('i686' 'x86_64')
  10. license=('custom:commercial')
  11. depends=('libgl' 'mesa' 'freeglut' 'libxrandr' 'expat' 'libxaw' 'libxft'
  12.          'libxinerama' 'freeimage' 'util-linux' 'zziplib' 'pcre')
  13. source=('torchlight-hib.desktop')
  14. md5sums=('4b14ae135bb86f490493729901412a10')
  15. PKGEXT='.pkg.tar'
  16.  
  17. _gamepkg="Torchlight-${_hibver}.sh"
  18.  
  19.  
  20. package() {
  21.   cd $srcdir
  22.  
  23.   # Get installer
  24.   _get_humblebundle_source "${_gamepkg}" || {
  25.     error "Unable to find the game archive. Please download it from your Humble
  26.           Bundle page, and place it into one of the above locations."
  27.     exit 1; }
  28.  
  29.   # Execute installer
  30.   msg "Starting setup..."
  31.   [[ -d "./temp" ]] && rm -r "./temp"
  32.   sh "./${_gamepkg}" --unattended --no-register --keep --overwrite \
  33.                      --target  "${srcdir}/temp" \
  34.                      --bindir  "${srcdir}/bin" \
  35.                      --datadir "${pkgdir}/opt"
  36.  
  37.   # Remove bundled libraries & helper binaries (use system packages instead)
  38.   rm -rf "${pkgdir}/opt/Torchlight/xdg-"*
  39.  
  40.   # Fix permissions
  41.   find "${pkgdir}" -type f -exec chmod 644 "{}" +
  42.  
  43.   # Install desktop entry
  44.   install -Dm644 "${pkgname}.desktop" \
  45.                  "${pkgdir}/usr/share/applications/${pkgname}.desktop"
  46.  
  47.   # Install icon
  48.   install -Dm644 "${pkgdir}/opt/Torchlight/Torchlight.png" \
  49.                  "${pkgdir}/usr/share/pixmaps/torchlight.png"
  50.  
  51.   # Install launcher symlink
  52.   case $CARCH in
  53.       i686) _arch=x86;;
  54.       x86_64) _arch=x86_64;;
  55.   esac
  56.   chmod 755 "${pkgdir}/opt/Torchlight/Torchlight.bin.${_arch}"
  57.   install -d "${pkgdir}/usr/bin"
  58.   ln -s "/opt/Torchlight/Torchlight.bin.${_arch}" "${pkgdir}/usr/bin/torchlight"
  59. }
  60.  
  61.  
  62. # Locate a game archive from one of the Humble Bundles, and symlink it into $srcdir
  63. _get_humblebundle_source() {
  64.   _get_local_source "$1" || return 1;
  65.   # TODO: Implement automatic downloading from Humble Bundle site
  66. }
  67.  
  68. # Locate a file or folder provided by the user, and symlink it into $srcdir
  69. _get_local_source() {
  70.   msg "Looking for '$1'..."
  71.   declare -A _search=(['build dir']="$startdir"
  72.                       ['$LOCAL_PACKAGE_SOURCES']="$LOCAL_PACKAGE_SOURCES")
  73.   for _key in "${!_search[@]}"; do local _dir="${_search["$_key"]}"
  74.     if [ -z "$_dir" ]; then _dir="<undefined>"; fi
  75.     echo -n "    - in $_key ['$_dir'] ... ";
  76.     if [ -e "$_dir/$1" ]; then
  77.       echo "FOUND"; ln -sfT "$(readlink -f "$_dir/$1")" "$srcdir/$1"; break; fi
  78.     echo "NOT FOUND"
  79.   done
  80.   if [ ! -e "$srcdir/$1" ]; then return 1; fi
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement