net-dns/getdns: improved stubby initd/confd for logs and logrotate
authorQuentin Retornaz <caseoffr@outlook.com>
Fri, 27 Apr 2018 20:28:49 +0000 (22:28 +0200)
committerAnthony G. Basile <blueness@gentoo.org>
Sat, 28 Apr 2018 10:50:45 +0000 (06:50 -0400)
net-dns/getdns/files/stubby.confd [deleted file]
net-dns/getdns/files/stubby.confd-r1 [new file with mode: 0644]
net-dns/getdns/files/stubby.initd-r1 [moved from net-dns/getdns/files/stubby.initd with 67% similarity]
net-dns/getdns/files/stubby.logrotate [new file with mode: 0644]
net-dns/getdns/getdns-1.4.1-r2.ebuild [moved from net-dns/getdns/getdns-1.4.1-r1.ebuild with 91% similarity]

diff --git a/net-dns/getdns/files/stubby.confd b/net-dns/getdns/files/stubby.confd
deleted file mode 100644 (file)
index b862ea4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# /etc/conf.d/stubby: config file for /etc/init.d/stubby
-
-# See stubby -h for possible options to put here.
-STUBBY_OPTS=""
diff --git a/net-dns/getdns/files/stubby.confd-r1 b/net-dns/getdns/files/stubby.confd-r1
new file mode 100644 (file)
index 0000000..9c8d83f
--- /dev/null
@@ -0,0 +1,16 @@
+# /etc/conf.d/stubby: config file for /etc/init.d/stubby
+
+# Enter here Stubby YAML configuration file to use.
+STUBBY_CONFIG_FILE="/etc/stubby/stubby.yml"
+
+# Set here Stubby log level to use.
+# Following log levels are available:
+#      0: EMERG  - System is unusable
+#      1: ALERT  - Action must be taken immediately
+#      2: CRIT   - Critical conditions
+#      3: ERROR  - Error conditions
+#      4: WARN   - Warning conditions
+#      5: NOTICE - Normal, but significant, condition
+#      6: INFO   - Informational message
+#      7: DEBUG  - Debug-level message
+STUBBY_LOGLEVEL="5"
similarity index 67%
rename from net-dns/getdns/files/stubby.initd
rename to net-dns/getdns/files/stubby.initd-r1
index 170db9be07fe547ad196337a1f5ba39aec47df64..e6b799919e2873b0081a5d58f9b5cf66737b4a25 100755 (executable)
@@ -2,8 +2,9 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License, v2 or later
 
+stubby_opts="-C ${STUBBY_CONFIG_FILE:-/etc/stubby/stubby.yml} -v ${STUBBY_LOGLEVEL:-5}"
 command="capsh"
-command_args="--inh=cap_net_bind_service --user=stubby -- -c '/usr/bin/stubby -g ${STUBBY_OPTS}'"
+command_args="--inh=cap_net_bind_service --user=stubby -- -c '/usr/bin/stubby -g ${stubby_opts} >>/var/log/stubby.log 2>&1'"
 pidfile="/var/run/stubby/stubby.pid"
 name="DNS Privacy Daemon"
 
@@ -18,4 +19,5 @@ depend()
 start_pre()
 {
        checkpath -d -m 1755 -o stubby:stubby /var/run/stubby
+       checkpath -f -m 0644 -o stubby:stubby /var/log/stubby.log
 }
diff --git a/net-dns/getdns/files/stubby.logrotate b/net-dns/getdns/files/stubby.logrotate
new file mode 100644 (file)
index 0000000..4805878
--- /dev/null
@@ -0,0 +1,7 @@
+/var/log/stubby.log {
+       rotate 4
+       compress
+       size 200k
+       noolddir
+       missingok
+}
similarity index 91%
rename from net-dns/getdns/getdns-1.4.1-r1.ebuild
rename to net-dns/getdns/getdns-1.4.1-r2.ebuild
index db4a0afb74a6a0e90c49cf5ac09cf0509a5338a0..bff5d734d08eb87d5ddb707ab019903e705a79ac 100644 (file)
@@ -50,8 +50,10 @@ src_configure() {
 src_install() {
        default
        if use stubby; then
-               newinitd "${FILESDIR}"/stubby.initd stubby
-               newconfd "${FILESDIR}"/stubby.confd stubby
+               newinitd "${FILESDIR}"/stubby.initd-r1 stubby
+               newconfd "${FILESDIR}"/stubby.confd-r1 stubby
+               insinto /etc/logrotate.d
+               newins "${FILESDIR}"/stubby.logrotate stubby
                systemd_newunit "${FILESDIR}"/stubby.systemd stubby.service
                systemd_newtmpfilesd "${FILESDIR}"/stubby.tmpfilesd stubby.conf
        fi