summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/pdns/files/pdns-r1')
-rw-r--r--net-dns/pdns/files/pdns-r114
1 files changed, 12 insertions, 2 deletions
diff --git a/net-dns/pdns/files/pdns-r1 b/net-dns/pdns/files/pdns-r1
index ee8ef36640c7..eeff5a08f634 100644
--- a/net-dns/pdns/files/pdns-r1
+++ b/net-dns/pdns/files/pdns-r1
@@ -2,14 +2,20 @@
# 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})}"
@@ -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