[Resolvconf-devel] Bug#380119: resolvconf: patch to support
dnscache instances managed by runit instead of by daemontools
Daniel Kahn Gillmor
dkg-debian.org at fifthhorseman.net
Thu Jul 27 17:10:19 UTC 2006
the /etc/resolvconf/update.d/dnscache script currently finds and
resets any forwarding dnscache instance managed by daemontools.
Gerrit Pape's runit package is a service supervision suite that is a
workalike replacement for daemontools, and it is GPLed,
well-documented, and fully in debian. However, runit-controlled
dnscaches won't be managed by resolvconf at the moment.
The supplied patch enables resolvconf to find and reset
runit-controlled instances of dnscache in addition to
Thanks for maintaining resolvconf,
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing'), (200, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages resolvconf depends on:
ii coreutils 5.96-5 The GNU core utilities
ii debconf [debconf-2.0] 1.5.2 Debian configuration management sy
ii lsb-base 3.1-10 Linux Standard Base 3.1 init scrip
resolvconf recommends no packages.
-- debconf information excluded
-------------- next part --------------
--- dnscache.orig 2006-07-27 12:12:53.000000000 -0400
+++ dnscache 2006-07-27 12:56:21.000000000 -0400
@@ -5,8 +5,8 @@
# Script to update every forwarding djbdns dnscache instance running
# on the local machine
-# this script sets up every FORWARDONLY dnscache managed by
-# daemontools on this machine to use the dynamically-offered
+# this script sets up every FORWARDONLY dnscache managed by either
+# daemontools or runit on this machine to use the dynamically-offered
# nameservers for the default '@'
# Assumption: On entry, PWD contains the resolv.conf-type files
@@ -25,17 +25,6 @@
[ -x /usr/bin/dnscache ] || exit 0
[ -x /lib/resolvconf/list-records ] || exit 1
-# We'll only manage caches actually managed by daemontools
-if [ -d /var/lib/svscan ] ; then
- # daemontools is built "the debian way"
-elif [ -d /service ] ; then
- # It's built "the djb way"
- # We don't know where to look for the daemontools services
- exit 0
@@ -44,15 +33,26 @@
-for SVC in $SERVICEDIR/* ; do
- if [ -f $SVC/run ] && \
+# which directories do we scan?
+# /var/lib/svscan: daemontools, built "the debian way" (LFS-compliant)
+# /service: daemontools, built "the djb way"
+# /var/service: runit
+for SERVICEDIR in /var/lib/svscan /service /var/service; do
+# We'll only manage caches actually managed by daemontools or runit.
+ if [ -d $SERVICEDIR ] && [ -z "`ls $SERVICEDIR`" ]; then
+ for SVC in $SERVICEDIR/* ; do
+ if [ -d $SVC/ ] && [ -f $SVC/run ] && \
(grep -q dnscache $SVC/run) && \
[ -d $SVC/root ] && \
[ -d $SVC/root/servers ] && \
[ -d $SVC/root/ip ] && \
[ -s $SVC/env/FORWARDONLY ] ; then
- CACHES="$SVC $CACHES"
+ CACHES="$SVC $CACHES"
@@ -92,13 +92,24 @@
+# svc is the daemontools service controller
SVC_CMD="$(which svc)" || :
[ ! "$SVC_CMD" ] && [ -x /command/svc ] && SVC_CMD=/command/svc
+# sv is the runit service controller
+SV_CMD="$(which sv)" || :
for CACHE in $CACHES ; do
cp "$TMPFILE" "$CACHE/root/servers/@"
# Restart the cache if it's already running:
- [ "$SVC_CMD" ] && $SVC_CMD -t "$CACHE"
+ if [ `dirname $CACHE` == '/var/service' ]; then
+ # this is managed by runit
+ [ "SV_CMD" ] && "SV_CMD" t "$CACHE"
+ # this is probably managed by daemontools
+ [ "$SVC_CMD" ] && $SVC_CMD -t "$CACHE"
rm -f "$TMPFILE"
More information about the Resolvconf-devel