summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenOokamiHoro2017-05-06 15:54:47 +0800
committerKenOokamiHoro2017-05-06 15:54:47 +0800
commit08c51552b66b34317102a0e252b6a8ae452cf53a (patch)
treef55d7ea9ec4ead834b877033f287aa023b82e6fd
downloadaur-restbase-git.tar.gz
initial
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD45
-rw-r--r--restbase.install37
-rw-r--r--restbase.service19
4 files changed, 129 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..a4572ace4e7
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+# Generated by mksrcinfo v8
+# Sat May 6 07:52:51 UTC 2017
+pkgbase = restbase-git
+ pkgdesc = A a caching / storing API proxy backing the Wikimedia REST API
+ pkgver = v0.16.5.r43.gd033c67
+ pkgrel = 1
+ url = https://www.mediawiki.org/wiki/RESTBase
+ install = restbase.install
+ arch = any
+ license = Apache
+ makedepends = git
+ makedepends = npm
+ depends = nodejs
+ optdepends = mediawiki: MediaWiki engine
+ provides = restbase
+ conflicts = restbase
+ replaces = restbase
+ options = !strip
+ backup = usr/share/webapps/restbase/config.yaml
+ source = git+https://github.com/wikimedia/restbase
+ source = restbase.service
+ source = restbase.install
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+
+pkgname = restbase-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..550fa303597
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,45 @@
+# Contributor: Jonas Heinrich <onny@project-insanity.org>
+# Maintainer: Horo <horo@yoitsu.moe>
+
+pkgname=restbase-git
+_pkgname=restbase
+pkgver=v0.16.5.r43.gd033c67
+pkgrel=1
+pkgdesc="A a caching / storing API proxy backing the Wikimedia REST API"
+arch=('any')
+url="https://www.mediawiki.org/wiki/RESTBase"
+license=('Apache')
+depends=('nodejs')
+makedepends=('git' 'npm')
+optdepends=(
+ 'mediawiki: MediaWiki engine'
+)
+conflicts=('restbase')
+replaces=('restbase')
+provides=('restbase')
+backup=(usr/share/webapps/restbase/config.yaml)
+source=("git+https://github.com/wikimedia/restbase"
+ "restbase.service"
+ "restbase.install")
+sha512sums=("SKIP"
+ "SKIP"
+ "SKIP")
+options=('!strip')
+install="restbase.install"
+pkgver() {
+ cd "$_pkgname"
+ git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+build() {
+ cd $srcdir/restbase
+ npm install
+}
+package() {
+ cd $srcdir/restbase
+ cp config.example.yaml config.yaml
+ mkdir -p "${pkgdir}/usr/share/webapps/${_pkgname}"
+ tar c --exclude=.git . | tar x -C "${pkgdir}/usr/share/webapps/${_pkgname}/"
+ install -Dm644 "${srcdir}/restbase.service" "${pkgdir}/usr/lib/systemd/system/restbase.service"
+ install -D "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+
diff --git a/restbase.install b/restbase.install
new file mode 100644
index 00000000000..41defb5d2a9
--- /dev/null
+++ b/restbase.install
@@ -0,0 +1,37 @@
+# Colored makepkg-like functions
+all_off="$(tput sgr0)"
+bold="${all_off}$(tput bold)"
+blue="${bold}$(tput setaf 4)"
+yellow="${bold}$(tput setaf 3)"
+
+msg_blue() {
+ printf "${blue}==>${bold} $1${all_off}\n"
+}
+
+note() {
+ printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
+}
+
+_update() {
+ if ! getent passwd restbase &>/dev/null; then
+ msg_blue "Adding user 'restbase'"
+ useradd -m -r -U -d /usr/share/webapps/restbase -s /bin/false restbase &>/dev/null
+ chown -R restbase /usr/share/webapps/restbase
+ chgrp -R restbase /usr/share/webapps/restbase
+ fi
+}
+
+post_install() {
+ _update
+ echo ">> Before run restbase, modify /usr/share/webapps/restbase/config.yaml ."
+ echo ">> Reference comments in this file for help ."
+}
+
+
+post_remove() {
+ if getent passwd restbase &>/dev/null; then
+ msg_blue "Removing user 'restbase'"
+ userdel -rf restbase &>/dev/null
+ fi
+}
+
diff --git a/restbase.service b/restbase.service
new file mode 100644
index 00000000000..08179abc602
--- /dev/null
+++ b/restbase.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Mediawiki RESTBase Service
+Documentation=https://www.mediawiki.org/wiki/RESTBase
+Wants=local-fs.target network.target
+After=local-fs.target network.target
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+Type=simple
+User=restbase
+Group=restbase
+WorkingDirectory=/usr/share/webapps/restbase
+ExecStart=/usr/bin/node /usr/share/webapps/restbase/server.js
+KillMode=process
+Restart=on-success
+PrivateTmp=true
+StandardOutput=syslog \ No newline at end of file