summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-07-22 13:30:55 +0100
committerRoy Marples <roy@marples.name>2020-07-22 13:30:55 +0100
commit2b6644decad62f2d845b94126fb384be6f3fdbb6 (patch)
tree28c86cc7b85ef3ea2fbc3007fcb8c6673efeb71d
parentbd86023411f7695cc0b719b1d8c16c5d1ccef08f (diff)
downloadopenresolv-2b6644decad62f2d845b94126fb384be6f3fdbb6.tar.xz
Add support to notify avahi-daemon and mdnsd of resolv.conf changes
-rw-r--r--.gitignore3
-rw-r--r--Makefile10
-rw-r--r--avahi-daemon.in32
-rw-r--r--mdnsd.in32
4 files changed, 74 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 1379bd0..ab2bd4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,6 @@ named
pdnsd
pdns_recursor
unbound
+
+avahi-daemon
+mdnsd
diff --git a/Makefile b/Makefile
index 6cfa6e4..73fbb9a 100644
--- a/Makefile
+++ b/Makefile
@@ -20,9 +20,10 @@ BINMODE?= 0755
DOCMODE?= 0644
MANMODE?= 0444
-RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5
-SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound
-TARGET= ${RESOLVCONF} ${SUBSCRIBERS}
+RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5
+SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound
+LIBC_SUBSCRIBERS= avahi-daemon mdnsd
+TARGET= ${RESOLVCONF} ${SUBSCRIBERS} ${LIBC_SUBSCRIBERS}
SRCS= ${TARGET:C,$,.in,} # pmake
SRCS:= ${TARGET:=.in} # gmake
@@ -71,6 +72,9 @@ proginstall: ${TARGET}
${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
+ ${INSTALL} -d ${DESTDIR}${LIBEXECDIR}/libc.d
+ ${INSTALL} -m ${DOCMODE} ${LIBC_SUBSCRIBERS} \
+ ${DESTDIR}${LIBEXECDIR}/libc.d
maninstall:
${INSTALL} -d ${DESTDIR}${MANDIR}/man8
diff --git a/avahi-daemon.in b/avahi-daemon.in
new file mode 100644
index 0000000..529e4ae
--- /dev/null
+++ b/avahi-daemon.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (c) 2007-2020 Roy Marples
+# All rights reserved
+
+# avahi-daemon notifier for resolvconf libc subscriber
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+: ${avahi_daemon_pidfile:=/var/run/avahi-daemon/pid}
+if [ -s "$avahi_daemon_pidfile" ]; then
+ kill -HUP $(cat "$avahi_daemon_pidfile")
+fi
diff --git a/mdnsd.in b/mdnsd.in
new file mode 100644
index 0000000..399cf56
--- /dev/null
+++ b/mdnsd.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (c) 2007-2020 Roy Marples
+# All rights reserved
+
+# mdnsd notifier for resolvconf libc subscriber
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+: ${mdnsd_pidfile:=/var/run/mdnsd/mdnsd.pid}
+if [ -s "$mdnsd_pidfile" ]; then
+ kill -HUP $(cat "$mdnsd_pidfile")
+fi