summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7f2f6e0d9102a4e6202f3126bacf739d4c4ae6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Maintainer: txtsd <aur.archlinux@ihavea.quest>
# Maintainer: Rain Clark <rain AT melonbread DOT dev>
# Based on: https://daveparrish.net/posts/2019-11-16-Better-AppImage-PKGBUILD-template.html

pkgname=imgbrd-grabber-appimage
_pkgname="${pkgname%-appimage}"
_reponame=imgbrd-grabber
_rdnsname=org.bionus.Grabber
pkgver=7.12.2
pkgrel=2
pkgdesc='Very customizable imageboard/booru downloader with powerful filenaming features'
arch=(x86_64)
url="https://github.com/Bionus/${_reponame}"
license=('Apache-2.0')
depends=(
  hicolor-icon-theme
  zlib
  fuse
  glibc
)
provides=("${_pkgname}")
conflicts=("${_pkgname}")
_appimage="Grabber_v${pkgver}-${arch}.AppImage"
noextract=("${_appimage}")
options=(!strip !debug)
source=(
  "https://github.com/Bionus/${_reponame}/releases/download/v${pkgver}/${_appimage}"
  "https://raw.githubusercontent.com/Bionus/${_reponame}/v${pkgver}/LICENSE"
)
sha256sums=('906a7192eff8c49da3087b890cc512283d87583cf9adf33546bd29152375c43c'
            'cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30')

prepare() {
  chmod +x "${_appimage}"
  ./"${_appimage}" --appimage-extract

  # Adjust .desktop so it will work outside of AppImage container
  sed -i -E "s|Exec=AppRun|Exec=env DESKTOPINTEGRATION=false /usr/bin/${_pkgname}|" \
    "squashfs-root/${_rdnsname}.desktop"

  # Fix permissions; .AppImage permissions are 700 for all directories
  chmod -R a-x+rX squashfs-root/usr
}

package() {
  # AppImage
  install -Dm755 "${_appimage}" "${pkgdir}/opt/${pkgname}/${pkgname}.AppImage"
  install -Dm644 "LICENSE" "${pkgdir}/opt/${pkgname}/LICENSE"

  # Desktop file
  install -Dm644 "squashfs-root/${_rdnsname}.desktop" "${pkgdir}/usr/share/applications/${_rdnsname}.desktop"

  # Icon images
  install -dm755 "${pkgdir}/usr/share/"
  cp -a "squashfs-root/usr/share/icons" "${pkgdir}/usr/share/"

  # Symlink executable
  install -dm755 "${pkgdir}/usr/bin"
  ln -s "/opt/${pkgname}/${pkgname}.AppImage" "${pkgdir}/usr/bin/${_pkgname}"

  # Symlink license
  install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}/"
  ln -s "/opt/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}"
}