summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorredfish2019-04-20 16:07:19 -0400
committerredfish2019-04-20 16:07:19 -0400
commit4c1adc0c0c0fa856746909ea69085dc37ec8629e (patch)
tree0bfa87ca47ed4450a942526740ccd26d0e483eb6
downloadaur-4c1adc0c0c0fa856746909ea69085dc37ec8629e.tar.gz
dat-gateway 2.1.2beta
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD36
-rw-r--r--dat-gateway.install9
-rw-r--r--dat-gateway.service16
5 files changed, 87 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c6e10597879c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+# Generated by mksrcinfo v8
+# Sat Apr 20 20:06:45 UTC 2019
+pkgbase = dat-gateway-git
+ pkgdesc = In-memory Dat to HTTP gateway
+ pkgver = 2.1.2beta
+ pkgrel = 1
+ url = https://github.com/garbados/dat-gateway
+ install = dat-gateway.install
+ arch = any
+ license = Apache-2.0
+ depends = nodejs
+ provides = dat-gateway
+ conflicts = dat-gateway
+ options = !strip
+ source = git+https://github.com/garbados/dat-gateway.git
+ source = dat-gateway.service
+ sha256sums = SKIP
+ sha256sums = 7330a4e1cc8ece98ce98c3fbfddf3843588b88d8594f2c1995e040dfe5ce4c2b
+
+pkgname = dat-gateway-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..72bb58685eaf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+pkg/
+src/
+dat-gateway/
+*.pkg.tar.xz
+*.tar.gz
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..06997d30c171
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,36 @@
+# Maintainer: redfish <redfish@galactica.pw>
+
+pkgname=dat-gateway-git
+_name=${pkgname%%-git}
+pkgver=2.1.2beta
+pkgrel=1
+pkgdesc="In-memory Dat to HTTP gateway"
+arch=(any)
+url="https://github.com/garbados/dat-gateway"
+license=('Apache-2.0')
+depends=('nodejs')
+conflicts=("$_name")
+provides=("$_name")
+install="$_name.install"
+source=(git+https://github.com/garbados/dat-gateway.git
+ dat-gateway.service)
+
+# There are some native binaries being built, but .node files confuse strip, so
+# don't bother stripping anything.
+options=(!strip)
+
+pkgver() {
+ cd "$_name"
+ printf "%s.r%s" \
+ $(cat package.json | sed -n 's/.*"version":\s* "\([^"]\+\)".*/\1/p' | sed 's/-//g') \
+ $(git rev-parse --short HEAD)
+}
+
+package(){
+ npm install --user root --prefix "${pkgdir}/usr" -g $(npm pack ${srcdir}/$_name | tail -1)
+ find ${pkgdir} -type d -exec chmod 0755 {} \; # npm creates 777 dirs, causes warnings
+ install -Dm0644 $_name.service ${pkgdir}/usr/lib/systemd/system/$_name.service
+}
+
+sha256sums=('SKIP'
+ '7330a4e1cc8ece98ce98c3fbfddf3843588b88d8594f2c1995e040dfe5ce4c2b')
diff --git a/dat-gateway.install b/dat-gateway.install
new file mode 100644
index 000000000000..9cfb842bbbd9
--- /dev/null
+++ b/dat-gateway.install
@@ -0,0 +1,9 @@
+USER=dat-gateway
+
+post_install() {
+ getent passwd ${USER} &>/dev/null || {
+ echo -n ">>> Creating ${USER} user... "
+ useradd --system --user-group ${USER}
+ echo "done"
+ }
+}
diff --git a/dat-gateway.service b/dat-gateway.service
new file mode 100644
index 000000000000..09e7aa78a706
--- /dev/null
+++ b/dat-gateway.service
@@ -0,0 +1,16 @@
+[Unit]
+Description="In-memory Dat to HTTP gateway"
+After=network.target
+
+[Service]
+User=dat-gateway
+Group=dat-gateway
+#RuntimeDirectory=dat-gateway
+#RuntimeDirectoryMode=0700
+#WorkingDirectory=/run/dat-gateway
+CacheDirectory=dat-gateway
+ExecStart=/usr/bin/dat-gateway -d $CACHE_DIRECTORY
+#Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target