On Wed, Feb 16, 2011 at 04:38:49PM -0500, Phil Vandry wrote:
> I agree with this objection. I have attached a better patch that
Forgot to attach :-(
-Phil
diff -ru unbound-1.4.8.orig/debian/unbound.init unbound-1.4.8/debian/unbound.init
--- unbound-1.4.8.orig/debian/unbound.init 2011-02-16 15:59:51.000000000 -0500
+++ unbound-1.4.8/debian/unbound.init 2011-02-16 15:53:44.000000000 -0500
@@ -38,6 +38,28 @@
if $UNBOUND_ENABLE; then
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --name $NAME --startas $DAEMON -- $DAEMON_OPTS; then
+ if [ -x /sbin/resolvconf ]; then
+ unbound-checkconf -o interface | (
+ default=yes
+ while read interface; do
+ default=no
+ if [ "x$interface" = x0.0.0.0 -o "x$interface" = x127.0.0.1 ]; then
+ echo nameserver 127.0.0.1
+ elif [ "x$interface" = x::0 -o "x$interface" = x::1 ]; then
+ echo nameserver ::1
+ fi
+ done
+ if [ $default = yes ]; then
+ # unbound default is to listen on localhost
+ echo nameserver 127.0.0.1
+ fi
+ # Note that we run resolvconf even if the list
+ # of nameservers we are willing to provide to
+ # it is empty. This is not a no-op: running
+ # resolvconf is still useful inform unbound about
+ # any forwarders that should be used
+ ) | /sbin/resolvconf -a lo.unbound
+ fi
log_end_msg 0
else
log_end_msg 1
@@ -50,6 +72,10 @@
stop)
if $UNBOUND_ENABLE; then
log_daemon_msg "Stopping $DESC" "$NAME"
+ if [ -x /sbin/resolvconf ]; then
+ # Tell resolvconf that unbound will no longer provide nameservice
+ /sbin/resolvconf -d lo.unbound
+ fi
if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME; then
log_end_msg 0
else