commit:     54db0fef68b5dbc5c304bdc2ca7b1440291ca66c
Author:     Quentin Retornaz <caseoffr <AT> outlook <DOT> com>
AuthorDate: Fri Apr 27 20:28:49 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Apr 28 10:50:45 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54db0fef

net-dns/getdns: improved stubby initd/confd for logs and logrotate

 net-dns/getdns/files/stubby.confd                        |  4 ----
 net-dns/getdns/files/stubby.confd-r1                     | 16 ++++++++++++++++
 net-dns/getdns/files/{stubby.initd => stubby.initd-r1}   |  4 +++-
 net-dns/getdns/files/stubby.logrotate                    |  7 +++++++
 .../{getdns-1.4.1-r1.ebuild => getdns-1.4.1-r2.ebuild}   |  6 ++++--
 5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/net-dns/getdns/files/stubby.confd 
b/net-dns/getdns/files/stubby.confd
deleted file mode 100644
index b862ea4a40d..00000000000
--- a/net-dns/getdns/files/stubby.confd
+++ /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
index 00000000000..9c8d83f07f7
--- /dev/null
+++ b/net-dns/getdns/files/stubby.confd-r1
@@ -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"

diff --git a/net-dns/getdns/files/stubby.initd 
b/net-dns/getdns/files/stubby.initd-r1
similarity index 67%
rename from net-dns/getdns/files/stubby.initd
rename to net-dns/getdns/files/stubby.initd-r1
index 170db9be07f..e6b799919e2 100755
--- a/net-dns/getdns/files/stubby.initd
+++ b/net-dns/getdns/files/stubby.initd-r1
@@ -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
index 00000000000..48058782594
--- /dev/null
+++ b/net-dns/getdns/files/stubby.logrotate
@@ -0,0 +1,7 @@
+/var/log/stubby.log {
+       rotate 4
+       compress
+       size 200k
+       noolddir
+       missingok
+}

diff --git a/net-dns/getdns/getdns-1.4.1-r1.ebuild 
b/net-dns/getdns/getdns-1.4.1-r2.ebuild
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 db4a0afb74a..bff5d734d08 100644
--- a/net-dns/getdns/getdns-1.4.1-r1.ebuild
+++ b/net-dns/getdns/getdns-1.4.1-r2.ebuild
@@ -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

Reply via email to