summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1765d330dc00ffd463b295ae89fb2f1c7964e527 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Maintainer: jab416171 <jab416171@gmail.com>
# Maintainer: txtsd <aur.archlinux@ihavea.quest>
# Contributor: Donald Webster <fryfrog@gmail.com>
# Contributor: Martins Mozeiko <martins.mozeiko@gmail.com>

pkgname=jellyseerr
pkgver=2.1.0
pkgrel=2
pkgdesc='Request management and media discovery tool for the Plex ecosystem'
arch=(x86_64 aarch64)
url='https://github.com/Fallenbagel/jellyseerr'
license=('MIT')
depends=(
  bash
  gcc-libs
  glibc
)
optdepends=(
  'jellyfin-server: The Free Software Media System'
  'plex-media-server: Plex Media Server'
  'emby-server: The open media solution'
  'sonarr: Smart PVR for newsgroup and torrent users'
  'radarr: Movie organizer/manager for usenet and torrent users'
)
makedepends=(pnpm nodejs-lts-iron)
backup=(
  etc/conf.d/jellyseerr
  usr/lib/jellyseerr/config/settings.json
)
options=(!strip !debug)
install=jellyseerr.install
source=(
  "${pkgname}-${pkgver}.tar.gz::https://github.com/Fallenbagel/jellyseerr/archive/v${pkgver}.tar.gz"
  jellyseerr.sysusers
  jellyseerr.tmpfiles
  jellyseerr.service
  jellyseerr.conf.d
  jellyseerr.install
  0001-Don-t-use-husky.patch
  0002-Remove-need-for-npm-npx.patch
)
sha256sums=('ee8ca3046a5789b758cfe43472732ddb5a9b45d2e8396b075c82e757b3e7ec2c'
            '2bac9f51b528ac40b7e0f952a032dde323533c0a986ac8be4c762fbe8dbad21f'
            '5d764d5157c8bdfb537d03bd7e5ce09debaa7e98aed1df82b3f5896ee4c0d79e'
            '7cba7aadecc255a69e5d94c2ecc788cb925293aee230e9a1ead8aebd58fbe012'
            '5a446cc8fa0a47a49dbbd6920d49eb4569f988e808cbb0bdbb609ab179a94426'
            '8d7bf6eb0a71905d764ffa8a43934b645c9e8945c3fecec995674acf053dd7bd'
            '1d2ee741644c3dc4520c2e4f0213343429eadfda7231950e03170dddae73d9bc'
            'e2777886a0e7000bd680fbdc17547d42faeb4cebd7b0ddc6493630d70b3f9f42')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -Np1 -i "${srcdir}/0001-Don-t-use-husky.patch"
  patch -Np1 -i "${srcdir}/0002-Remove-need-for-npm-npx.patch"

  echo "{\"commitTag\": \"${pkgver}\"}" > committag.json

  export NEXT_TELEMETRY_DISABLED=1
  pnpm install --frozen-lockfile
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  export NEXT_TELEMETRY_DISABLED=1
  export CYPRESS_INSTALL_BINARY=0
  # See: https://aur.archlinux.org/packages/jellyseerr#comment-998270
  export SHARP_IGNORE_GLOBAL_LIBVIPS=1
  pnpm build
  pnpm prune --prod --ignore-scripts
}

package() {
  depends+=(nodejs)
  cd "${srcdir}/${pkgname}-${pkgver}"

  install -dm755 "${pkgdir}/usr/lib/jellyseerr"
  cp -dr --no-preserve='ownership' "${srcdir}/${pkgname}-${pkgver}/"{.next,dist,public,node_modules} "${pkgdir}/usr/lib/jellyseerr"
  cp -d --no-preserve='ownership' "${srcdir}/${pkgname}-${pkgver}/"{package.json,overseerr-api.yml,next.config.js} "${pkgdir}/usr/lib/jellyseerr"
  rm -rf "${pkgdir}/usr/lib/jellyseerr/.next/cache"

  find "${pkgdir}/usr/lib/jellyseerr/.next" -type f -print0 | xargs -0 sed -i "s^${srcdir}/${pkgname}-${pkgver}^/usr/lib/jellyseerr^g"

  install -Dm644 'LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm644 "${srcdir}/jellyseerr.conf.d" "${pkgdir}/etc/conf.d/jellyseerr"
  install -Dm644 "${srcdir}/jellyseerr.sysusers" "${pkgdir}/usr/lib/sysusers.d/jellyseerr.conf"
  install -Dm644 "${srcdir}/jellyseerr.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/jellyseerr.conf"
  install -Dm644 "${srcdir}/jellyseerr.service" "${pkgdir}/usr/lib/systemd/system/jellyseerr.service"
}