aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rest-server
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-07-24 16:59:01 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2018-07-25 00:03:27 +0200
commit4e8f63fcab59d1eb03297f32e88b2d18cdbd31b6 (patch)
treee985d614a4971a0dac1cf4b89f6d6a0092e26218 /testing/rest-server
parent698fe31ce35c3da127dbe6f10160aa96e7d435eb (diff)
downloadaports-4e8f63fcab59d1eb03297f32e88b2d18cdbd31b6.tar.bz2
aports-4e8f63fcab59d1eb03297f32e88b2d18cdbd31b6.tar.xz
testing/rest-server: add -openrc subpackage
Diffstat (limited to 'testing/rest-server')
-rw-r--r--testing/rest-server/APKBUILD18
-rw-r--r--testing/rest-server/rest-server.confd5
-rw-r--r--testing/rest-server/rest-server.initd18
-rw-r--r--testing/rest-server/rest-server.pre-install7
4 files changed, 44 insertions, 4 deletions
diff --git a/testing/rest-server/APKBUILD b/testing/rest-server/APKBUILD
index d939c3e6c0..fce452c001 100644
--- a/testing/rest-server/APKBUILD
+++ b/testing/rest-server/APKBUILD
@@ -9,10 +9,13 @@ arch="all"
license="BSD-2-Clause"
depends=""
makedepends="go"
-install=""
-subpackages="$pkgname-doc"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/restic/$pkgname/archive/v$pkgver.tar.gz
- 0001-Move-TestIsUserPath-to-correct-package.patch"
+ 0001-Move-TestIsUserPath-to-correct-package.patch
+
+ $pkgname.confd
+ $pkgname.initd"
builddir="$srcdir/src/github.com/restic/$pkgname"
export GOPATH="$srcdir"
@@ -39,7 +42,14 @@ package() {
install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname
install -Dm644 README.md \
"$pkgdir"/usr/share/doc/$pkgname/README.md
+
+ install -Dm755 "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname
+ install -Dm644 "$srcdir"/$pkgname.confd \
+ "$pkgdir"/etc/conf.d/$pkgname
}
sha512sums="2288f93703d03859ec1a5d9085eda7ca5b82e801bc74cd66fcc58601e73a2bf5150f85e948749ca7d95e4598087acf5115499404ccbbfba62a4cc9043437ed29 rest-server-0.9.7.tar.gz
-98a9fbb7c0b60dbb3682bab40f7b4f488da93d7c7afdab174185bc62ad250bf8e1238b6513a239dd5da276935b51bd05495f13c7e03befa3a0f651cf3d109979 0001-Move-TestIsUserPath-to-correct-package.patch"
+98a9fbb7c0b60dbb3682bab40f7b4f488da93d7c7afdab174185bc62ad250bf8e1238b6513a239dd5da276935b51bd05495f13c7e03befa3a0f651cf3d109979 0001-Move-TestIsUserPath-to-correct-package.patch
+cd9e4d3df04c26aa602a57196bdfb14d7ad6e957f1d9596a09e596b9d01543eee08474817ba47192659fe6f5ab15b8fa64400fb6a8d24111f5c792b1412f5e5b rest-server.confd
+185c0022d07c66fcee2d84af1bb0a11ac0753bd79deb8f5ae7dc2bd84909886aa3e58f42cd6ace4f191da6128d0385036948d4a8accd14cf9cdb9603001b9aca rest-server.initd"
diff --git a/testing/rest-server/rest-server.confd b/testing/rest-server/rest-server.confd
new file mode 100644
index 0000000000..20e9a4552c
--- /dev/null
+++ b/testing/rest-server/rest-server.confd
@@ -0,0 +1,5 @@
+# Storage directory used by the rest-server.
+REST_SERVER_PATH="/var/lib/restic"
+
+# Additional commandline flags passed to rest-server.
+#REST_SERVER_OPTS=""
diff --git a/testing/rest-server/rest-server.initd b/testing/rest-server/rest-server.initd
new file mode 100644
index 0000000000..25745876e3
--- /dev/null
+++ b/testing/rest-server/rest-server.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+name="rest-server"
+command="/usr/bin/$name"
+command_args="$REST_SERVER_OPTS --path '${REST_SERVER_PATH}'"
+command_background="yes"
+command_user="${REST_USER:-restic}"
+pidfile="/var/run/$RC_SVCNAME.pid"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory "${REST_SERVER_PATH}" \
+ --owner "${REST_USER:-restic}:${REST_GROUP:-restic}"
+}
diff --git a/testing/rest-server/rest-server.pre-install b/testing/rest-server/rest-server.pre-install
new file mode 100644
index 0000000000..0c7845dc50
--- /dev/null
+++ b/testing/rest-server/rest-server.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+addgroup -S restic 2>/dev/null
+adduser -S -D -H -h /dev/null -s /sbin/nologin \
+ -G restic -g 'Rest Server Daemon' restic 2>/dev/null
+
+exit 0