summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO19
-rw-r--r--.gitignore6
-rw-r--r--PKGBUILD45
-rw-r--r--nodebb.install39
-rw-r--r--nodebb.service21
5 files changed, 130 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..ab0ad05d60c2
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = nodebb
+ pkgdesc = Node.js based forum software built for the modern web
+ pkgver = 1.x.x
+ pkgrel = 1
+ install = nodebb.install
+ arch = i686
+ arch = x86_64
+ license = GPL3
+ makedepends = npm
+ makedepends = git
+ depends = nodejs
+ optdepends = mongodb: Default database
+ source = nodebb::git+https://github.com/NodeBB/NodeBB.git#branch=v1.x.x
+ source = nodebb.service
+ md5sums = SKIP
+ md5sums = SKIP
+
+pkgname = nodebb
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..e861a48de8c6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*
+!.gitignore
+!PKGBUILD
+!.SRCINFO
+!nodebb.service
+!nodebb.install
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d8025620132e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Duarte David <deltaduartedavid@gmail.com>
+pkgname=nodebb
+pkgrel=1
+pkgver=1.x.x
+pkgdesc='Node.js based forum software built for the modern web'
+arch=('i686' 'x86_64')
+license=('GPL3')
+
+depends=('nodejs')
+optdepends=("mongodb: Default database")
+
+makedepends=('npm' 'git')
+install="$pkgname.install"
+source=('nodebb::git+https://github.com/NodeBB/NodeBB.git#branch=v1.x.x' "$pkgname.service")
+md5sums=('SKIP' 'SKIP')
+
+pkgver() {
+ cd "$srcdir/$pkgname"
+ git describe --tags | cut -c 2-
+}
+
+build() {
+ cd "$srcdir/$pkgname"
+
+ npm install --production --cache "${srcdir}/npm-cache"
+
+}
+
+package() {
+ cd "$srcdir/$pkgname"
+ mkdir -p "$pkgdir/opt/$pkgname"
+
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ rm LICENSE
+
+ # Remove windows script
+ rm *.bat
+ rm Dockerfile
+
+
+ cp -r * "$pkgdir/opt/$pkgname"
+
+ # systemd service
+ install -Dm644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
+}
diff --git a/nodebb.install b/nodebb.install
new file mode 100644
index 000000000000..d530a3a870f4
--- /dev/null
+++ b/nodebb.install
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# arg 1: the new package version
+post_install() {
+
+ echo "Creating nodebb user and group and setting permissions..."
+ getent group nodebb > /dev/null || usr/sbin/groupadd nodebb
+ getent passwd nodebb > /dev/null || usr/sbin/useradd -c \
+ 'NodeBB forum' -g nodebb -d '/opt/nodebb' \
+ --system -s /bin/bash nodebb &> /dev/null
+
+ chown -R nodebb:nodebb /opt/nodebb
+
+
+ echo
+ echo 'For the NodeBB documentation:'
+ echo
+ echo ' https://nodebb.readthedocs.io'
+ echo
+ echo 'To setup nodebb please run /opt/nodebb/nodebb setup'
+ echo
+ echo 'After setup to start nodebb please run systemctl start nodebb'
+ echo
+
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ chown -R nodebb:nodebb /opt/nodebb
+}
+
+# arg 1: the old package version
+post_remove() {
+ echo "Removing nodebb user and group..."
+ getent passwd nodebb > /dev/null && usr/sbin/userdel nodebb &>/dev/null
+ getent group nodebb > /dev/null && usr/sbin/groupdel nodebb &>/dev/null
+ /bin/true
+}
diff --git a/nodebb.service b/nodebb.service
new file mode 100644
index 000000000000..0dfaf0168a24
--- /dev/null
+++ b/nodebb.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=NodeBB forum for Node.js.
+Documentation=http://nodebb.readthedocs.io/en/latest/
+After=system.slice multi-user.target
+
+[Service]
+Type=simple
+User=nodebb
+
+StandardOutput=syslog
+StandardError=syslog
+SyslogIdentifier=nodebb
+
+Environment=NODE_ENV=production
+WorkingDirectory=/opt/nodebb
+ExecStart=/usr/bin/node loader.js --no-daemon --no-silent
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+