Advertisement
Guest User

modified PKGBUILD for wakingmars

a guest
Nov 20th, 2012
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.26 KB | None | 0 0
  1. # Contributor: Ben R. <thebenj88 *AT* gmail *DOT* com>
  2.  
  3. pkgname=wakingmars-hib
  4. pkgver=1.0.4
  5. pkgrel=1
  6. pkgdesc='Explore Mars in this 2D sidescrolling adventure game (Humble Bundle version)'
  7. url='http://www.tigerstylegames.com/wakingmars/'
  8. arch=('i686' 'x86_64')
  9. license=('custom:commercial')
  10. depends=('libgl' 'mesa')
  11. optdepends=('catalyst: AMD Proprietary 3D driver'
  12.                         'nvidia: NVIDIA Proprietary 3D driver')
  13. PKGEXT='.pkg.tar'
  14.  
  15. _gamepkg="WakingMars-${pkgver}-Linux.tar.gz"
  16.  
  17. package() {
  18.         # Get installer
  19.   _get_humblebundle_source "${_gamepkg}" || {
  20.     error "Unable to find the game archive. Please download it from your Humble
  21.           Bundle page, and place it into one of the above locations."
  22.     exit 1;
  23. }
  24.         msg "Extract files"
  25.         bsdtar -xf ${srcdir}/${_gamepkg}
  26.    
  27.         msg "Create directories"
  28.         mkdir -p ${pkgdir}/usr/bin
  29.         mkdir -p ${pkgdir}/opt/${pkgname}/
  30.         mkdir -p ${pkgdir}/usr/share/{licenses,doc}/${pkgname}
  31.         mkdir ${pkgdir}/usr/share/applications
  32.  
  33.         msg "Install license, documentation and desktop file"
  34.         install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/Licenses/EULA.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
  35.         install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/README.txt ${pkgdir}/usr/share/doc/${pkgname}/README.html
  36.  
  37.         sed -i 's|Path=/usr/local/games/wakingmars|Path=/usr/bin/wakingmars|g' ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop
  38.         sed -i 's|Icon=/usr/local/games/wakingmars/wakingmars.png|Path=/opt/wakingmars-hib/wakingmars.png|g' ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop
  39.         install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop ${pkgdir}/usr/share/applications/wakingmars.desktop
  40.         rm -r ${srcdir}/WakingMars-${pkgver}-Linux/{Licenses,install,README.txt,wakingmars.desktop}
  41.  
  42.         msg "Install game contents"
  43.         mv -v ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars/* ${pkgdir}/opt/${pkgname}/
  44.  
  45.         msg "Set owner and permissions"
  46.         chown root:games ${pkgdir}/opt/${pkgname} -R
  47.         find ${pkgdir}/opt/${pkgname} -type f -print0 | xargs -0 chmod 644
  48.         find ${pkgdir}/opt/${pkgname} -type d -print0 | xargs -0 chmod 755
  49.         chmod 755 ${pkgdir}/opt/${pkgname}/wakingmars
  50.  
  51.         msg "Link binary to /usr/bin"
  52.         ln -s /opt/${pkgname}/wakingmars ${pkgdir}/usr/bin/wakingmars
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59. # Thanks again to smls for the following two functions, these saved me
  60. # a lot of time.
  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. }
  66.  
  67. # Locate a file or folder provided by the user, and symlink it into $srcdir
  68. _get_local_source() {
  69.   msg "Looking for '$1'..."
  70.   declare -A _search=(['build dir']="$startdir"
  71.                       ['$LOCAL_PACKAGE_SOURCES']="$LOCAL_PACKAGE_SOURCES")
  72.   for _key in "${!_search[@]}"; do local _dir="${_search["$_key"]}"
  73.     if [ -z "$_dir" ]; then _dir="<undefined>"; fi
  74.     echo -n "    - in $_key ['$_dir'] ... ";
  75.     if [ -e "$_dir/$1" ]; then
  76.       echo "FOUND"; ln -sfT "$(readlink -f "$_dir/$1")" "$srcdir/$1"; break; fi
  77.     echo "NOT FOUND"
  78.   done
  79.   if [ ! -e "$srcdir/$1" ]; then return 1; fi
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement