summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: baf841cbd1a73deb3cc385062afd73272854897e (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
# Maintainer: XiaYeSuiFeng <xiayesuifeng@firerain.me>
pkgname=gopanel-git
pkgver=r77.faf9c19
pkgrel=1
pkgdesc='A control panel that is written in Golang and is able to manage Caddy 2'
arch=('x86_64')
license=('GPLv3')
url='https://gitlab.com/xiayesuifeng/gopanel'
backup=('etc/gopanel/config.json')
depends=('caddy2')
makedepends=('go' 'npm')
source=("git+https://gitlab.com/xiayesuifeng/gopanel"
        "git+https://gitlab.com/xiayesuifeng/gopanel-web")
sha256sums=('SKIP' 'SKIP')

pkgver() {
  cd ${srcdir}/gopanel
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd ${srcdir}/gopanel-web
  npm install
  npm run build
  cd ${srcdir}/gopanel
  go build -v
}

package() {
  cd ${srcdir}/gopanel

  mkdir -p "$pkgdir/etc/gopanel/app.conf.d"
  mkdir -p "$pkgdir/usr/share/gopanel/web"
  install -D -m 0755 gopanel "$pkgdir/usr/bin/gopanel"
  install -D -m 0644 systemd/gopanel.service "$pkgdir/usr/lib/systemd/system/gopanel.service"
  install -D -m 0644 config.default.json "$pkgdir/etc/gopanel/config.json"
  cp -rf ${srcdir}/gopanel-web/build "${pkgdir}/usr/share/gopanel/web"
  chmod -R 0644 "${pkgdir}/usr/share/gopanel/web"
}