summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlphaJack2021-06-14 21:30:45 +0200
committerAlphaJack2021-06-14 21:31:21 +0200
commit3829f3f57dd11a7acdf4011e36846b26bc13f2f7 (patch)
tree06b3e0bcc7726f96fa60f1b85fe49df45fd6a3ca
downloadaur-3829f3f57dd11a7acdf4011e36846b26bc13f2f7.tar.gz
Initial commit
-rw-r--r--.SRCINFO34
-rw-r--r--PKGBUILD69
-rw-r--r--conf.json28
-rw-r--r--shinobi-camera.service13
-rw-r--r--shinobi-cron.service13
-rw-r--r--shinobi.install27
-rw-r--r--shinobi.sysusers1
-rw-r--r--shinobi.target7
-rw-r--r--shinobi.tmpfiles4
-rw-r--r--super.json6
10 files changed, 202 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..928d227be9f5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,34 @@
+pkgbase = shinobi-git
+ pkgdesc = The Open Source CCTV and NVR Solution
+ pkgver = r2020.f9a15a7
+ pkgrel = 1
+ url = https://shinobi.video/
+ install = shinobi.install
+ arch = any
+ license = custom
+ makedepends = npm
+ depends = ffmpeg
+ depends = mariadb
+ depends = nodejs
+ provides = shinobi
+ options = !strip
+ backup = etc/shinobi/conf.json
+ backup = etc/shinobi/super.json
+ source = git+https://gitlab.com/Shinobi-Systems/Shinobi.git
+ source = shinobi-camera.service
+ source = shinobi-cron.service
+ source = shinobi.target
+ source = shinobi.sysusers
+ source = shinobi.tmpfiles
+ source = conf.json
+ source = super.json
+ sha256sums = SKIP
+ sha256sums = 59b51fe6cb3dc5e7e01401b20a1a7e51f649a7fd2292ff1d2d88df2cbdff9d5b
+ sha256sums = 9794abc97379e84fc688977e6d675d607c1136dda8a428e6c5aa8a9cfac8029c
+ sha256sums = 60cb5660061fccae12a8ffaf4b1ee2960ab4dc8106b4b95419274a359cd9cd22
+ sha256sums = e7c849bfcf8619a093ec75467cf5e44b34cd3621fa0d639bfacf4c88e0bad258
+ sha256sums = a0213eb276dfd468ed835cccceece75da92141716afa4c2426e20a06f64b5625
+ sha256sums = 45c64bdaf8e7c99f14a8467fc3c996fefdaab8c100c9f28f03054c248f62a7d3
+ sha256sums = b6f2093025736770ed18141eee36b2cd2507142310bb258bf6365c4740c9aae6
+
+pkgname = shinobi-git
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..fc52e01119e3
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,69 @@
+# Maintainer: AlphaJack <alphajack at tuta dot io>
+
+pkgname="shinobi-git"
+pkgver=r2020.f9a15a7
+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" "mariadb" "nodejs")
+makedepends=("npm")
+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"
+ "59b51fe6cb3dc5e7e01401b20a1a7e51f649a7fd2292ff1d2d88df2cbdff9d5b"
+ "9794abc97379e84fc688977e6d675d607c1136dda8a428e6c5aa8a9cfac8029c"
+ "60cb5660061fccae12a8ffaf4b1ee2960ab4dc8106b4b95419274a359cd9cd22"
+ "e7c849bfcf8619a093ec75467cf5e44b34cd3621fa0d639bfacf4c88e0bad258"
+ "a0213eb276dfd468ed835cccceece75da92141716afa4c2426e20a06f64b5625"
+ "45c64bdaf8e7c99f14a8467fc3c996fefdaab8c100c9f28f03054c248f62a7d3"
+ "b6f2093025736770ed18141eee36b2cd2507142310bb258bf6365c4740c9aae6")
+backup=("etc/shinobi/conf.json" "etc/shinobi/super.json")
+install="shinobi.install"
+options=("!strip")
+
+pkgver(){
+ cd "Shinobi"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare(){
+ cd "Shinobi"
+ # avoid hardcode database name
+ sed -i "sql/framework.sql" \
+ -e "s|CREATE DATABASE|/*CREATE DATABASE|" \
+ -e 's|USE `ccio`;|USE `ccio`;*/|'
+}
+
+package(){
+ # no /usr/bin, just systemd files
+ cd "Shinobi"
+ # program files
+ npm install --user root
+ 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
+ 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"
+}
diff --git a/conf.json b/conf.json
new file mode 100644
index 000000000000..19d71b621284
--- /dev/null
+++ b/conf.json
@@ -0,0 +1,28 @@
+{
+ "ip": "127.0.0.1",
+ "port": 8080,
+ "passwordType": "sha256",
+ "detectorMergePamRegionTriggers": true,
+ "wallClockTimestampAsDefault": true,
+ "streamDir": "/var/lib/shinobi/stream",
+ "videosDir": "/var/lib/shinobi/video",
+ "binDir": "/var/lib/shinobi/files",
+ "db": {
+ "host": "127.0.0.1",
+ "user": "majesticflame",
+ "password": "",
+ "database": "ccio",
+ "port":3306
+ },
+ "mail":{
+ "service": "gmail",
+ "auth": {
+ "user": "your_email@gmail.com",
+ "pass": "your_password_or_app_specific_password"
+ }
+ },
+ "cron":{
+ "key":"change_this_to_something_very_random__just_anything_other_than_thisx"
+ },
+ "pluginKeys":{}
+}
diff --git a/shinobi-camera.service b/shinobi-camera.service
new file mode 100644
index 000000000000..760950346b8f
--- /dev/null
+++ b/shinobi-camera.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Shinobi server component
+After=network.target
+PartOf=shinobi.target
+
+[Service]
+Type=simple
+User=shinobi
+WorkingDirectory=/usr/share/shinobi
+ExecStart=/usr/bin/node /usr/share/shinobi/camera.js
+
+[Install]
+WantedBy=shinobi.target
diff --git a/shinobi-cron.service b/shinobi-cron.service
new file mode 100644
index 000000000000..5e2686778471
--- /dev/null
+++ b/shinobi-cron.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Shinobi cleanup component
+After=network.target
+PartOf=shinobi.target
+
+[Service]
+Type=simple
+User=shinobi
+WorkingDirectory=/usr/share/shinobi
+ExecStart=/usr/bin/node /usr/share/shinobi/cron.js
+
+[Install]
+WantedBy=shinobi.target
diff --git a/shinobi.install b/shinobi.install
new file mode 100644
index 000000000000..1a701b5ecf72
--- /dev/null
+++ b/shinobi.install
@@ -0,0 +1,27 @@
+post_install(){
+ cat << INFO
+
+Shinobi is free for personal use, read the following if you plan to use it
+for commercial purpose: https://hub.shinobi.video/articles/view/QDD2cqvbTekzhar
+
+Before using Shinobi you need to create a mariadb user and database.
+Then you need to import the structure into the database, e.g. with
+
+ sudo mysql DATABASE < /usr/share/shinobi/sql/framework.sql
+
+Once you have granted your user full access to the new database, configure the files under "/etc/shinobi" accordingly.
+You can change your super admin password in /etc/shinobi/super.json with
+
+ echo -n PASSWORD | md5sum
+
+Once you have done all of the above, you can start the required services with
+
+ sudo systemctl start shinobi.target
+
+and access the web interface from http://127.0.0.1/super
+
+You won't be able to install plugins from the webui, if you want them you need to start the server as root.
+You won't be able to restart the server from the webui as pm2 is not being used.
+
+INFO
+}
diff --git a/shinobi.sysusers b/shinobi.sysusers
new file mode 100644
index 000000000000..da98c858af3e
--- /dev/null
+++ b/shinobi.sysusers
@@ -0,0 +1 @@
+u shinobi - "Shinobi user" /var/lib/shinobi
diff --git a/shinobi.target b/shinobi.target
new file mode 100644
index 000000000000..cb480d7908e5
--- /dev/null
+++ b/shinobi.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Shinobi Open Source CCTV and NVR Solution
+After=network.target
+Wants=shinobi-camera.service shinobi-cron.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/shinobi.tmpfiles b/shinobi.tmpfiles
new file mode 100644
index 000000000000..69098da11e0a
--- /dev/null
+++ b/shinobi.tmpfiles
@@ -0,0 +1,4 @@
+d /etc/shinobi 0750 root shinobi
+f /etc/shinobi/conf.json 0660 root shinobi
+f /etc/shinobi/super.json 0660 root shinobi
+d /var/lib/shinobi 0750 shinobi shinobi
diff --git a/super.json b/super.json
new file mode 100644
index 000000000000..db8b524aa1f1
--- /dev/null
+++ b/super.json
@@ -0,0 +1,6 @@
+[
+ {
+ "mail":"admin@shinobi.video",
+ "pass":"21232f297a57a5a743894a0e4a801fc3"
+ }
+]