summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e01a594f9a4106207caf2877337de19d4d3f54a4 (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
# Maintainer: Dan Walsh <dan@danwalsh.ca>
pkgname=redisinsight
pkgver=2.60.0
pkgrel=2
pkgdesc="Desktop manager that provides an intuitive and efficient GUI for Redis, allowing you to interact with your databases, monitor, and manage your data."
arch=('x86_64')
url='https://redis.com/redis-enterprise/redis-insight'
license=('custom:SSPL')
depends=()
provides=(redis-insight)
conflicts=(redis-insight-bin)
makedepends=(
gendesk
nodejs
yarn
npm
nvm
jq
make
python-setuptools
clang
)
source=("$pkgname-$pkgver.tar.gz::https://github.com/RedisInsight/RedisInsight/archive/$pkgver.tar.gz")
sha256sums=('09be44dbfb939467b9406c465c5f66b48fb1cc0782cd865c55e655cd5c4ab5e5')

_ensure_local_nvm() {
    # let's be sure we are starting clean
    which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
    export NVM_DIR="${srcdir}/.nvm"

    # The init script returns 3 if version specified
    # in ./.nvrc is not (yet) installed in $NVM_DIR
    # but nvm itself still gets loaded ok
    source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}

prepare() {
  cd RedisInsight-$pkgver

  # unable to build some plugins for some reason, disable them here
  sed -i -E '/^# Build ri-explain plugin/,$d' scripts/build-statics.sh

  _ensure_local_nvm
  nvm install 20.12.2
}

build() {
  cd RedisInsight-$pkgver
  _ensure_local_nvm

  mkdir electron
  VERSION=$(jq -r ".version" redisinsight/package.json)
  cp ./redisinsight/package.json ./electron/package.json
  echo "$VERSION" > electron/version

  yarn --cwd redisinsight/api/ install --ignore-optional
  yarn --cwd redisinsight/ install --ignore-optional
  yarn install
  yarn build:statics
  yarn build:prod
  yarn electron-builder build --dir -p never
}

package() {
  cd "$srcdir/RedisInsight-$pkgver/release/linux-unpacked"
  install -Dm644 resources/resources/icons/512x512.png "${pkgdir}/usr/share/pixmaps/redisinsight.png"
  gendesk -f -n --pkgname "${pkgname}" \
          --pkgdesc "$pkgdesc" \
          --name "RedisInsight" \
          --comment "$pkgdesc" \
          --exec "${pkgname}" \
          --categories 'Development' \
          --icon "${pkgname}"
  install -Dm644 "${pkgname}.desktop" -t "${pkgdir}/usr/share/applications"
  install -Dm644 resources/LICENSE.redisinsight.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -d "${pkgdir}/usr/bin"
  install -d "${pkgdir}/opt"
  install -d "${pkgdir}/opt/${pkgname}"
  cp -avR * "${pkgdir}/opt/${pkgname}"
  ln -s /opt/${pkgname}/redisinsight "${pkgdir}/usr/bin/redisinsight"
  find "${pkgdir}/opt/${pkgname}" -type d -exec chmod 755 {} +
}