summaryrefslogtreecommitdiff
path: root/net-dns/pdns/files/pdns-r1
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/pdns/files/pdns-r1')
-rw-r--r--net-dns/pdns/files/pdns-r118
1 files changed, 14 insertions, 4 deletions
diff --git a/net-dns/pdns/files/pdns-r1 b/net-dns/pdns/files/pdns-r1
index 4c5241e5155f..eeff5a08f634 100644
--- a/net-dns/pdns/files/pdns-r1
+++ b/net-dns/pdns/files/pdns-r1
@@ -1,15 +1,21 @@
#!/sbin/openrc-run
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+get_config_option() {
+ awk -v option="${1}" -F = '$1 == option { print $2 }' "${PDNS_CONFIG}"
+}
+
PDNS_CONFIGDIR="${PDNS_CONFIGDIR:-/etc/powerdns}"
PDNS_STOP_TIMEOUT="${PDNS_STOP_TIMEOUT:-10}"
[ "${RC_SVCNAME}" != "pdns" ] && PDNS_INSTANCE="${RC_SVCNAME#pdns[.-]}" || PDNS_INSTANCE=""
PDNS_CONFIG="${PDNS_CONFIGDIR}/pdns${PDNS_INSTANCE:+-${PDNS_INSTANCE}}.conf"
-PDNS_CHROOTDIR="$( awk -F = '$1 == "chroot" { print $2 }' "${PDNS_CONFIG}" )"
-PDNS_SOCKETDIR="$( awk -F = '$1 == "socket-dir" { print $2 }' "${PDNS_CONFIG}" )"
+PDNS_CHROOTDIR="$( get_config_option chroot )"
+PDNS_SOCKETDIR="$( get_config_option socket-dir )"
+PDNS_SETUID="$( get_config_option setuid )"
+PDNS_SETGID="$( get_config_option setgid )"
[ -z "${PDNS_SOCKETDIR}" -a -z "${PDNS_CHROOTDIR}" ] && PDNS_SOCKETDIR="/var/run/pdns"
name="PowerDNS Authoritative Server${PDNS_INSTANCE:+ (${PDNS_INSTANCE})}"
@@ -22,7 +28,7 @@ description_ping="Ping the PowerDNS instance"
description_monitor="Starts in foreground with logging and console enabled"
command="/usr/sbin/pdns_server"
-command_args="--config-dir=${PDNS_CONFIGDIR}${PDNS_INSTANCE:+ --config-name=${PDNS_INSTANCE}}"
+command_args="--config-dir=${PDNS_CONFIGDIR}${PDNS_INSTANCE:+ --config-name=${PDNS_INSTANCE}} --write-pid=yes"
command_args_foreground="--daemon=no"
command_args_background="--daemon=yes"
yesno ${rc_verbose} || command_args_background="${command_args_background} >/dev/null 2>&1"
@@ -42,6 +48,10 @@ status() {
_ping || return 32
}
+start_pre() {
+ checkpath --directory --owner "${PDNS_SETUID:-root}:${PDNS_SETGID:-root}" --mode 750 "${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}"
+}
+
stop() {
default_stop || return
_ping || return 0