summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8be6763be06340a9137f86f016ef30968906cd1b (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
# Maintainer: AlphaJack <alphajack at tuta dot io>

pkgname="shinobi-git"
pkgver=r3116.07584db3
pkgrel=1
pkgdesc="The Open Source CCTV and NVR Solution"
url="https://shinobi.video/"
license=("custom") # not free for commercial use
arch=("any")
provides=("shinobi")
depends=("ffmpeg" "nodejs")
makedepends=("npm" "git")
optdepents=("mariadb: database"
            "postgresql: database"
           )
source=("git+https://gitlab.com/Shinobi-Systems/Shinobi.git"
        "shinobi-camera.service"
        "shinobi-cron.service"
        "shinobi.target"
        "shinobi.sysusers"
        "shinobi.tmpfiles"
        "conf.json"
        "super.json")
sha256sums=('SKIP'
            'da346d9858dafb1a42dd43153d26763de05bc7cdabb5563b979ca62d2cc51ce3'
            'adacf7a3ec970e6d5c5d8c339f56bdce3720b952ab7278f31d70a294fd0b5bdd'
            '676111c7502ed43671ac5a4451ee0f89913de1c4b4f1e2120cd5c4b89e842757'
            'e7c849bfcf8619a093ec75467cf5e44b34cd3621fa0d639bfacf4c88e0bad258'
            'a0213eb276dfd468ed835cccceece75da92141716afa4c2426e20a06f64b5625'
            'a328e61ddb909cc0216569ed08ee5f4e35ce770da53995ab7d6413479ae8e106'
            'b6f2093025736770ed18141eee36b2cd2507142310bb258bf6365c4740c9aae6')
backup=("etc/shinobi/conf.json" "etc/shinobi/super.json")
install="shinobi.install"
options=("!strip")

pkgver(){
 cd "Shinobi"
 # git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'                       # -> fatal: No annotated tags can describe '07584db326ba8077f448a8383cc677469a769cbf'.
 # git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'                # -> furrykitten.3.r534.g07584db3
 printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" # ->               r3116.07584db3
}

package(){
 # no /usr/bin, just systemd files
 cd "Shinobi"
 # program files
 npm install --user root
 npm install --user root pg
 install -d "$pkgdir/usr/share/shinobi"
 cp -r * "$pkgdir/usr/share/shinobi"
 # configuration files
 install -d -m 750 "$pkgdir/etc/shinobi/"
 install -D -m 660 "$srcdir/conf.json" "$pkgdir/etc/shinobi/conf.json"
 install -D -m 660 "$srcdir/super.json" "$pkgdir/etc/shinobi/super.json"
 ln -s "/etc/shinobi/conf.json" "$pkgdir/usr/share/shinobi"
 ln -s "/etc/shinobi/super.json" "$pkgdir/usr/share/shinobi"
 # systemd files
 install -D -m 644 "$srcdir/shinobi-camera.service" "$pkgdir/usr/lib/systemd/system/shinobi-camera.service"
 install -D -m 644 "$srcdir/shinobi-cron.service" "$pkgdir/usr/lib/systemd/system/shinobi-cron.service"
 install -D -m 644 "$srcdir/shinobi.target" "$pkgdir/usr/lib/systemd/system/shinobi.target"
 install -D -m 644 "$srcdir/shinobi.sysusers" "$pkgdir/usr/lib/sysusers.d/shinobi.conf"
 install -D -m 644 "$srcdir/shinobi.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/shinobi.conf"
 # custom license
 install -D -m 644 "LICENSE.md" "$pkgdir/usr/share/licenses/shinobi/LICENSE"
 # version.json is used by the web server
 # https://gitlab.com/Shinobi-Systems/Shinobi/-/issues/23
 echo '{"Product" : "Shinobi Professional (Pro)" , "Branch" : "master" , "Version" : "'"$(git rev-parse HEAD)"'" , "Date" : "'"$(date)"'" , "Repository" : "https://gitlab.com/Shinobi-Systems/Shinobi"}' > "$pkgdir/usr/share/shinobi/version.json"
}