[Midnightbsd-cvs] src [12005] trunk/etc/rc.d/mdnsd: add mdns if it is missing to nsswitch.conf

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Aug 14 10:53:40 EDT 2018


Revision: 12005
          http://svnweb.midnightbsd.org/src/?rev=12005
Author:   laffer1
Date:     2018-08-14 10:53:39 -0400 (Tue, 14 Aug 2018)
Log Message:
-----------
add mdns if it is missing to nsswitch.conf

Modified Paths:
--------------
    trunk/etc/rc.d/mdnsd

Modified: trunk/etc/rc.d/mdnsd
===================================================================
--- trunk/etc/rc.d/mdnsd	2018-08-14 14:40:10 UTC (rev 12004)
+++ trunk/etc/rc.d/mdnsd	2018-08-14 14:53:39 UTC (rev 12005)
@@ -11,7 +11,22 @@
 name="mdnsd"
 rcvar=mdnsd_enable
 command="/usr/sbin/${name}"
+start_precmd="mdnsd_precmd"
 pidfile="/var/run/mDNSResponder.pid"
 
+mdnsd_precmd() 
+{
+	if grep -q mdns "/etc/nsswitch.conf"; then
+		return
+	else
+		if [ ! -w /etc/nswitch.conf ]; then
+			echo ' /etc/nswitch.conf is not writable, update failed.'
+			return
+		fi
+		sed 's|^\(hosts.*\)files dns|\1files mdns dns|g' /etc/nsswitch.conf
+	fi
+}
+
+
 load_rc_config $name
 run_rc_command $*



More information about the Midnightbsd-cvs mailing list