summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 936ad177e32b6421cb31fec688748c4509bdbcf7 (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
# Maintainer: Vladislav Minakov <v@minakov.pro>

pkgname=casdoor
pkgver=1.776.0
pkgrel=1
pkgdesc="An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform"
arch=('x86_64')
url="https://github.com/casbin/casdoor"
optdepends=('postgresql: PostgreSQL database'
            'cockroachdb: CockroachDB database'
            'mariadb: MariaDB database'
            'sqlite: SQLite database'
            'nginx: reverse-proxy')
makedepends=('go>=1.21' 'yarn')
license=('Apache License 2.0')
source=("$pkgname-$pkgver.tar.gz::https://github.com/casbin/casdoor/archive/refs/tags/v${pkgver}.tar.gz"
        "casdoor.service"
        "casdoor.sysusers"
        "casdoor.tmpfiles")
sha512sums=('61793e83b5f4ca8af4131f014de607ac07ea24e281f59295171c19bbe1ff4172229046e6b65f501aeefb454b063a1fbdbce711045310c334bed17e74837848ae'
            'c4f2d91aaab7b024fe5618054f90cb37660b59c1822f01c02817fb204cc23deb1c885da19e3424a44e89bab41a4e0765086ed4cd27bf5ad6558fd1448088dc1e'
            '2f5ec975f0b121d356f282b3101856dc1ba1ca6d3aa9b65c0ccb66d85b793472d868dda4d51f7e7cf72e7dfa4a1e1a2f90c406f6cad94ddb9dc5a81d04bc2615'
            '6a128bb89359188b8e9198acd053a4cd713a1b61a5e61b5300fa9494a38c15e8ac7e647c9dc910d51fcc77b4c9d2b24d19d00173c949b53e92964e5ed157c9ec')
backup=('etc/casdoor/casdoor.conf')
install="casdoor.install"

prepare() {
  cd "$pkgname-$pkgver"
  sed -i -e "s/configPath            = \"conf\/app.conf\"/configPath            = \"\/etc\/casdoor\/casdoor.conf\"/" object/ormer.go
  sed -i -e "s/initDataFile.*/initDataFile = \"\/etc\/casdoor\/init_data.json\"/" -e "s/frontendBaseDir.*/frontendBaseDir = \"\/usr\/share\/webapps\/casdoor\"/" conf/app.conf
}

build() {
  cd "$pkgname-$pkgver"
  go build -o bin/casdoor main.go
  cd web
  yarn install
  yarn run build
}

package() {
  install -d "${pkgdir}/usr/bin/"
  install -d "${pkgdir}/usr/share/webapps/casdoor/"
  install -d "${pkgdir}/etc/casdoor/"
  install -Dm 755 "${srcdir}/$pkgname-$pkgver/bin/casdoor" "${pkgdir}/usr/bin/"
  install -Dm 644 "${srcdir}/$pkgname-$pkgver/conf/app.conf" "${pkgdir}/etc/casdoor/casdoor.conf"
  install -Dm 644 "${srcdir}/$pkgname-$pkgver/init_data.json.template" "${pkgdir}/etc/casdoor/init_data.json"
  cp -r ${srcdir}/$pkgname-$pkgver/web/build/* "${pkgdir}/usr/share/webapps/casdoor/"
  install -Dm 644 "${srcdir}/casdoor.service" "${pkgdir}/usr/lib/systemd/system/casdoor.service"
  install -Dm 644 "${srcdir}/casdoor.sysusers" "${pkgdir}/usr/lib/sysusers.d/casdoor.conf"
  install -Dm 644 "${srcdir}/casdoor.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/casdoor.conf"

}