aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-03-30 13:41:34 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-03-30 13:42:27 +0200
commitc40be82cf7e1dfce66364ae7ada4836aaa82847c (patch)
tree506d9310a0ea93686101c95cc256776f977135fc /testing
parent308c7c50934d86cda644069999a6a08486beee23 (diff)
downloadaports-c40be82cf7e1dfce66364ae7ada4836aaa82847c.tar.bz2
aports-c40be82cf7e1dfce66364ae7ada4836aaa82847c.tar.xz
testing/rethinkdb: use gentoo init.d script, add pre-install
Diffstat (limited to 'testing')
-rw-r--r--testing/rethinkdb/APKBUILD19
-rw-r--r--testing/rethinkdb/rethinkdb.confd12
-rw-r--r--testing/rethinkdb/rethinkdb.initd48
-rw-r--r--testing/rethinkdb/rethinkdb.pre-install7
4 files changed, 71 insertions, 15 deletions
diff --git a/testing/rethinkdb/APKBUILD b/testing/rethinkdb/APKBUILD
index 9696e83fd3..cb77b3a10f 100644
--- a/testing/rethinkdb/APKBUILD
+++ b/testing/rethinkdb/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Daniel Treadwell <daniel@djt.id.au>
pkgname=rethinkdb
pkgver=2.3.5
-pkgrel=4
+pkgrel=5
pkgdesc="Distributed powerful and scalable NoSQL database"
url="http://www.rethinkdb.com"
arch="x86_64"
@@ -10,13 +10,15 @@ license="ASL 2.0"
depends=""
makedepends="bash python2 linux-headers bsd-compat-headers m4 paxmark
protobuf-dev icu-dev libressl-dev curl-dev boost-dev libexecinfo-dev"
-install=""
+install="$pkgname.pre-install"
pkgusers=rethinkdb
pkggroups=rethinkdb
subpackages="$pkgname-doc"
source="http://download.rethinkdb.com/dist/$pkgname-$pkgver.tgz
libressl.patch
- rethinkdb.initd"
+ rethinkdb.initd
+ rethinkdb.confd
+ "
builddir="$srcdir/rethinkdb-$pkgver"
build() {
@@ -55,6 +57,8 @@ package() {
install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname || return 1
install -Dm755 "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname || return 1
+ install -Dm644 "$srcdir"/$pkgname.confd \
+ "$pkgdir"/etc/conf.d/$pkgname || return 1
paxmark -m "$pkgdir"/usr/bin/rethinkdb || return 1
}
@@ -63,12 +67,7 @@ doc() {
mv "$pkgdir"/etc/$pkgname/*.sample "$subpkgdir"/usr/share/doc/$pkgname
}
-md5sums="89614869d931f8c6e7473e66887089ca rethinkdb-2.3.5.tgz
-cc978791a4e4545190d0063b46aa3dd0 libressl.patch
-bb1cde2ba1d6a71ed79c31161b1bf64b rethinkdb.initd"
-sha256sums="dd8aeee169b177179bfe080725f0560443e0f26dae875b32ae25d90cf2f8ee10 rethinkdb-2.3.5.tgz
-22b8a69f7b02b9f8127a635c18ea76979313520c79f2461f09dfc8299e49604a libressl.patch
-d7294473f30cd2fa7837de6ed4816efd2c8663a15c7396d8c37a0a9f2fc1a787 rethinkdb.initd"
sha512sums="ac71656fd2451fd36432fa0f7d2c16c2be53888f748d88f0bfc2fb9ad7cd3c704b56551bc35eda72eb08fffdd799727a3cbe83830337cf71e17c159588d33c94 rethinkdb-2.3.5.tgz
9ff727feedc7a9f58e7bf8554dc26e32ebca259b2d5d75ff0d064f5aea7a54c9c94fab16b83a3bc4039d4ae6d6d805d7b129ab9d5f762186d0388adeeff6e67c libressl.patch
-d9997f453623e4a85e19052464d97738be70277fd14b985e9123414792b85cf5e5b30e8ecb94b48cdab43c4fb39898ca35e7fbc8943e13f95db2a992ba2289a1 rethinkdb.initd"
+8982bda4ee1f4147a26ded13b5f1caffe703ed9e025d635e9354d9e4c173c6c334f905fc0d1c9839bf1d2237a498a97d051d77bf4f4c453c4119ad3705a9381a rethinkdb.initd
+3a07f9c78ef96b2ca37fca508ee14a644d3c08612f662ba5260182fbfcceba064d20253f1261f56dc0a2c28d1a4d5e2320872c3c4e7595cb7ab4e202eb28ad42 rethinkdb.confd"
diff --git a/testing/rethinkdb/rethinkdb.confd b/testing/rethinkdb/rethinkdb.confd
new file mode 100644
index 0000000000..af65794a44
--- /dev/null
+++ b/testing/rethinkdb/rethinkdb.confd
@@ -0,0 +1,12 @@
+# !! IMPORTANT !!
+#
+# This file is ONLY used to override some of the init script configuration.
+#
+# You should NOT use this file to configure your rethinkdb instance,
+# see the /etc/rethinkdb/default.conf.sample file instead.
+#
+# Available init script modifiers :
+# - config_file : the configuration file to use (default : /etc/rethinkdb/instance.d/<instance-name>.conf)
+# - user : the user used to run your rethinkdb instance (default : rethinkdb)
+# - group : the group used to run your rethinkdb instance (default : rethinkdb)
+# - run_dir : the run directory for your PID files (default : /run/rethinkdb) \ No newline at end of file
diff --git a/testing/rethinkdb/rethinkdb.initd b/testing/rethinkdb/rethinkdb.initd
index 10d81600e2..a570a8cecf 100644
--- a/testing/rethinkdb/rethinkdb.initd
+++ b/testing/rethinkdb/rethinkdb.initd
@@ -1,12 +1,50 @@
#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+instance_name=${SVCNAME#*.}
+config_file=${config_file:-/etc/rethinkdb/instances.d/${instance_name}.conf}
+run_dir=${run_dir:-/run/rethinkdb}
-name=rethinkdb
command="/usr/bin/rethinkdb"
-command_args="--config-file /etc/rethinkdb/default.conf"
+command_args="--config-file ${config_file}"
+command_background="true"
+pidfile=${run_dir}/${instance_name}.pid
+user=${user:-rethinkdb}
+group=${group:-rethinkdb}
+start_stop_daemon_args="--user ${user} --group ${group} --wait 2000"
depend() {
- use logger dns
- need net
- after firewall
+ use net logger dns
+ after firewall
}
+start_pre() {
+ checkpath -d -m 0750 -o "${user}":"${group}" "${run_dir}"
+ if [ "${instance_name}" == "rethinkdb" ]; then
+ eerror "You should not run this default init script directly"
+ eerror "Create a symlink to an instance name"
+ eerror "and create a configuration file in /etc/rethinkdb/instances.d/"
+ eerror "then run this instance init script instead."
+ return 1
+ fi
+ if [ ! -f ${config_file} ]; then
+ eerror "Missing configuration file ${config_file}"
+ return 1
+ else
+ # respect configured directory or set a default
+ directory=$(egrep -e '^directory=' "${config_file}" | cut -d'=' -f2)
+ if [ -z "${directory}" ]; then
+ directory=/var/lib/rethinkdb/instances.d/"${instance_name}"
+ fi
+ checkpath -d -m 0750 -o "${user}":"${group}" "${directory}"
+ command_args="${command_args} --directory ${directory}"
+
+ # respect configured log-file or set a default
+ log_file=$(egrep -e '^log_file=' "${config_file}" | cut -d'=' -f2)
+ if [ -z "${log_file}" ]; then
+ log_file=/var/log/rethinkdb/"${instance_name}".log
+ fi
+ command_args="${command_args} --log-file ${log_file}"
+ fi
+}
diff --git a/testing/rethinkdb/rethinkdb.pre-install b/testing/rethinkdb/rethinkdb.pre-install
new file mode 100644
index 0000000000..8c48f8c9c3
--- /dev/null
+++ b/testing/rethinkdb/rethinkdb.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+addgroup -S rethinkdb 2>/dev/null
+adduser -S -D -h /var/lib/rethinkdb -s /sbin/nologin -G rethinkdb \
+ -g rethinkdb rethinkdb 2>/dev/null
+
+exit 0