Advertisement
Guest User

Untitled

a guest
Jul 30th, 2020
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.61 KB | None | 0 0
  1. # Maintainer: Swix
  2.  
  3. pkgname=gog-terraria
  4. pkgver=1.4.0.5.38805
  5. pkgrel=1
  6. epoch=1
  7. pkgdesc="The very world is at your fingertips as you fight for survival, fortune, and glory."
  8. url="http://terraria.org/"
  9. license=('custom')
  10. arch=('i686' 'x86_64')
  11. depends=('sdl2')
  12. makedepends=('libarchive')
  13. optdepends=('firejail: Automatically sandbox this application from your OS')
  14. source=("gog://terraria_v${pkgver//./_}.sh"
  15.         "${pkgname}.desktop"
  16.         "$pkgname")
  17.  
  18. # bsdtar is really cool but I want to control what I'm extracting
  19. noextract=("terraria_v${pkgver//./_}.sh")
  20. sha256sums=('3c2e0145f30829cf0c956a69aca8867a4027d9dadbcb0a359ad70eade3bae066'
  21.             '815bf359c2828cdefee1e33a978a84a2ebb538450197a5792b62e382ae3e3093'
  22.             'afc115c0cbb42a12e082f5860c159eb8dcf525d360d2f9b167cc4ddb80ba03e7')
  23.  
  24. # You need to download the gog.com installer file manually or with lgogdownloader.
  25. DLAGENTS+=("gog::/usr/bin/echo %u - This is is not a real URL, you need to download the GOG file manually to \"$PWD\" or setup a gog:// DLAGENT. Read this PKGBUILD for more information.")
  26.  
  27. # Prevent compressing final package
  28. PKGEXT='.pkg.tar'
  29.  
  30. prepare(){
  31.     datasource="terraria_v${pkgver//./_}.sh"
  32.  
  33.     offset=`sed -n '/.*offset=.*head/{s/.*head -n \([0-9]*\).*/\1/p;q}' "$datasource"`
  34.     toskip=`sed -n '/filesizes=/{s/.*="\([0-9]*\)"/\1/p;q}' "$datasource"`
  35.  
  36.     mkdir "${srcdir}/terraria"
  37.     tail -n+$(($offset+1)) "$datasource" | tail -c+$(($toskip+1)) | bsdtar -C "${srcdir}/terraria" -xvf- 2> /dev/null
  38. }
  39.  
  40. package(){
  41.     pushd "${srcdir}/terraria/data/noarch"
  42.  
  43.     # Install game
  44.     install -d "${pkgdir}/opt/${pkgname}/"
  45.     install -d "${pkgdir}/opt/${pkgname}/support"
  46.     install -d "${pkgdir}/usr/bin/"
  47.  
  48.     cp -r "game/" "${pkgdir}/opt/${pkgname}/"
  49.     find "${pkgdir}/opt/${pkgname}/" -type d -exec chmod 755 "{}" \;
  50.     install -Dm755 "start.sh" \
  51.         "${pkgdir}/opt/${pkgname}/"
  52.     install -Dm755 support/*.{sh,shlib} -t \
  53.         "${pkgdir}/opt/${pkgname}/support"
  54.     install -Dm644 gameinfo \
  55.         "${pkgdir}/opt/${pkgname}/gameinfo"
  56.  
  57.     # Desktop integration
  58.     install -Dm644 "support/icon.png" \
  59.         "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
  60.     install -Dm644 "docs/End User License Agreement.txt" \
  61.         "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  62.     install -Dm644 "${srcdir}/${pkgname}.desktop" \
  63.         "${pkgdir}/usr/share/applications/${pkgname}.desktop"
  64.     install -Dm755 "${srcdir}/${pkgname}" \
  65.         "${pkgdir}/usr/bin/${pkgname}"
  66.  
  67.     # Fix permissions
  68.     chmod +x "${pkgdir}/opt/${pkgname}/game/Terraria"{,Server}{,.bin.x86,.bin.x86_64}
  69.     popd
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement