Subject: Specifying program to be run, in rc.conf
To: NetBSD Current Users <current-users@netbsd.org>
From: Barry Bouwsma <freebsd-misuser@remove-NOSPAM-to-reply.NOSPAM.dyndns.dk>
List: current-users
Date: 11/30/2004 21:15:53
Hello,

Is there any way to easily specify a particular program to be run,
overriding the default, in rc.conf?

I've seen a diff comparable to the following in SomethingBSD, which
below is what I've applied to a recent NetBSD in order to specify
a particular program to be used (my own version of ntpd(ate), for
example)


--- /cboot/etc/rc.subr-DIST	Tue Nov  2 20:24:00 2004
+++ /cboot/etc/rc.subr	Fri Nov 19 14:46:57 2004
@@ -312,6 +312,9 @@
 #				recommended so that the boot process is not
 #				stalled.  In order to pass no flags to
 #				systrace, set this variable to "--".
+# XXX HACK
+#	${name}_program n	Overrides the default command, or something
+# XXX
 #
 #	${rc_arg}_cmd	n	If set, use this as the method when invoked;
 #				Otherwise, use default command (see below)
@@ -416,6 +419,11 @@
 		fi
 		;;
 	esac
+
+	eval _override_command=\$${name}_program
+	if [ -n "$_override_command" ]; then
+		command=$_override_command
+	fi
 
 	_keywords="start stop restart rcvar $extra_commands"
 	rc_pid=


Please let me know if I'm overlooking something obvious, or
if there's a better way to do this...


thanks
barry bowusma