1 |
commit: 4c61cba390f9b3b70436215ea7348d251cd31da1 |
2 |
Author: Sven Wegener <swegener <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 5 20:57:45 2021 +0000 |
4 |
Commit: Sven Wegener <swegener <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 5 21:21:00 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c61cba3 |
7 |
|
8 |
net-dns/pdns: Create socket-dir with correct user |
9 |
|
10 |
Package-Manager: Portage-3.0.18, Repoman-3.0.2 |
11 |
Signed-off-by: Sven Wegener <swegener <AT> gentoo.org> |
12 |
|
13 |
net-dns/pdns/files/pdns-r1 | 14 ++++++++++++-- |
14 |
1 file changed, 12 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/net-dns/pdns/files/pdns-r1 b/net-dns/pdns/files/pdns-r1 |
17 |
index ee8ef36640c..eeff5a08f63 100644 |
18 |
--- a/net-dns/pdns/files/pdns-r1 |
19 |
+++ b/net-dns/pdns/files/pdns-r1 |
20 |
@@ -2,14 +2,20 @@ |
21 |
# Copyright 1999-2021 Gentoo Authors |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
|
24 |
+get_config_option() { |
25 |
+ awk -v option="${1}" -F = '$1 == option { print $2 }' "${PDNS_CONFIG}" |
26 |
+} |
27 |
+ |
28 |
PDNS_CONFIGDIR="${PDNS_CONFIGDIR:-/etc/powerdns}" |
29 |
PDNS_STOP_TIMEOUT="${PDNS_STOP_TIMEOUT:-10}" |
30 |
|
31 |
[ "${RC_SVCNAME}" != "pdns" ] && PDNS_INSTANCE="${RC_SVCNAME#pdns[.-]}" || PDNS_INSTANCE="" |
32 |
|
33 |
PDNS_CONFIG="${PDNS_CONFIGDIR}/pdns${PDNS_INSTANCE:+-${PDNS_INSTANCE}}.conf" |
34 |
-PDNS_CHROOTDIR="$( awk -F = '$1 == "chroot" { print $2 }' "${PDNS_CONFIG}" )" |
35 |
-PDNS_SOCKETDIR="$( awk -F = '$1 == "socket-dir" { print $2 }' "${PDNS_CONFIG}" )" |
36 |
+PDNS_CHROOTDIR="$( get_config_option chroot )" |
37 |
+PDNS_SOCKETDIR="$( get_config_option socket-dir )" |
38 |
+PDNS_SETUID="$( get_config_option setuid )" |
39 |
+PDNS_SETGID="$( get_config_option setgid )" |
40 |
[ -z "${PDNS_SOCKETDIR}" -a -z "${PDNS_CHROOTDIR}" ] && PDNS_SOCKETDIR="/var/run/pdns" |
41 |
|
42 |
name="PowerDNS Authoritative Server${PDNS_INSTANCE:+ (${PDNS_INSTANCE})}" |
43 |
@@ -42,6 +48,10 @@ status() { |
44 |
_ping || return 32 |
45 |
} |
46 |
|
47 |
+start_pre() { |
48 |
+ checkpath --directory --owner "${PDNS_SETUID:-root}:${PDNS_SETGID:-root}" --mode 750 "${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}" |
49 |
+} |
50 |
+ |
51 |
stop() { |
52 |
default_stop || return |
53 |
_ping || return 0 |