Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Maintainer: Sam S. <smls75@gmail.com>
- pkgname=torchlight-hib
- pkgver=1.0.20120920
- _hibver=2012-09-20
- pkgrel=1
- pkgdesc='A hack and slash action role-playing game (Humble Bundle version)'
- url='http://www.torchlightgame.com/'
- arch=('i686' 'x86_64')
- license=('custom:commercial')
- depends=('libgl' 'mesa' 'freeglut' 'libxrandr' 'expat' 'libxaw' 'libxft'
- 'libxinerama' 'freeimage' 'util-linux' 'zziplib' 'pcre')
- source=('torchlight-hib.desktop')
- md5sums=('4b14ae135bb86f490493729901412a10')
- PKGEXT='.pkg.tar'
- _gamepkg="Torchlight-${_hibver}.sh"
- package() {
- cd $srcdir
- # Get installer
- _get_humblebundle_source "${_gamepkg}" || {
- error "Unable to find the game archive. Please download it from your Humble
- Bundle page, and place it into one of the above locations."
- exit 1; }
- # Execute installer
- msg "Starting setup..."
- [[ -d "./temp" ]] && rm -r "./temp"
- sh "./${_gamepkg}" --unattended --no-register --keep --overwrite \
- --target "${srcdir}/temp" \
- --bindir "${srcdir}/bin" \
- --datadir "${pkgdir}/opt"
- # Remove bundled libraries & helper binaries (use system packages instead)
- rm -rf "${pkgdir}/opt/Torchlight/xdg-"*
- # Fix permissions
- find "${pkgdir}" -type f -exec chmod 644 "{}" +
- # Install desktop entry
- install -Dm644 "${pkgname}.desktop" \
- "${pkgdir}/usr/share/applications/${pkgname}.desktop"
- # Install icon
- install -Dm644 "${pkgdir}/opt/Torchlight/Torchlight.png" \
- "${pkgdir}/usr/share/pixmaps/torchlight.png"
- # Install launcher symlink
- case $CARCH in
- i686) _arch=x86;;
- x86_64) _arch=x86_64;;
- esac
- chmod 755 "${pkgdir}/opt/Torchlight/Torchlight.bin.${_arch}"
- install -d "${pkgdir}/usr/bin"
- ln -s "/opt/Torchlight/Torchlight.bin.${_arch}" "${pkgdir}/usr/bin/torchlight"
- }
- # Locate a game archive from one of the Humble Bundles, and symlink it into $srcdir
- _get_humblebundle_source() {
- _get_local_source "$1" || return 1;
- # TODO: Implement automatic downloading from Humble Bundle site
- }
- # Locate a file or folder provided by the user, and symlink it into $srcdir
- _get_local_source() {
- msg "Looking for '$1'..."
- declare -A _search=(['build dir']="$startdir"
- ['$LOCAL_PACKAGE_SOURCES']="$LOCAL_PACKAGE_SOURCES")
- for _key in "${!_search[@]}"; do local _dir="${_search["$_key"]}"
- if [ -z "$_dir" ]; then _dir="<undefined>"; fi
- echo -n " - in $_key ['$_dir'] ... ";
- if [ -e "$_dir/$1" ]; then
- echo "FOUND"; ln -sfT "$(readlink -f "$_dir/$1")" "$srcdir/$1"; break; fi
- echo "NOT FOUND"
- done
- if [ ! -e "$srcdir/$1" ]; then return 1; fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement