Subject: Re: rc.subr apparently doesn't like hyphenated daemons
To: John F. Woods <jfw@jfwhome.funhouse.com>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 03/15/2005 14:06:28
[ On Sunday, March 13, 2005 at 15:29:21 (-0500), John F. Woods wrote: ]
> Subject: rc.subr apparently doesn't like hyphenated daemons
>
> Unfortunately, I didn't take detailed notes, so I don't have a clear
> documentation of the problems, but it this hasn't been fixed already (and
> if no one else is seeing it) I can probably reproduce it easily.  I think
> this is a result of a change between 1.6 and 2.0, since the last time I
> knew that clamav was working was just before I upgraded.

Just FYI:  Long ago I made some tiny hacks to /etc/rc that allow me to
run it at any time in debug mode to see what it thinks it would do, and
in what order.  This "fix" has been invaluable in sorting out the kinds
of issues you've run into:

Index: etc/rc
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/etc/rc,v
retrieving revision 1.161
diff -u -r1.161 rc
--- etc/rc	19 May 2002 01:01:32 -0000	1.161
+++ etc/rc	31 Jul 2003 17:44:44 -0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 #
 # $NetBSD: rc,v 1.161 2002/05/19 01:01:32 lukem Exp $
 #
@@ -11,8 +11,11 @@
 
 export HOME=/
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 umask 022
 
+stty status '^T'
+
 . /etc/rc.subr
 . /etc/rc.conf
 _rc_conf_loaded=YES
@@ -22,25 +25,44 @@
 	exit 1
 fi
 
-if [ "$1" = autoboot ]; then
-	autoboot=yes
-	rc_fast=yes	# run_rc_command(): do fast booting
-fi
+debug_echo=""
+_rc_run_command="start"
 
-stty status '^T'
+case "$1" in
+autoboot)
+	autoboot=yes
+	_rc_fast_run=yes	# run_rc_command(): do fast booting
+	;;
+rcvar)
+	_rc_run_command="rcvar"
+	;;
+-d)
+	debug_echo=echo
+	;;
+esac
 
-#	Set shell to ignore SIGINT, but not children;
-#	shell catches SIGQUIT and returns to single user.
+#	Set shell to ignore SIGINT (children will not ignore it though);
 #
 trap : INT
+
+#	Set shell to catch SIGQUIT and trigger a return to single user mode.
+#
+echo "Type a quit character (usually ^\\) to abort multi-user startup."
 trap "echo 'Boot interrupted.'; exit 1" QUIT
 
 date
 
-files=$(rcorder -s nostart ${rc_rcorder_flags} /etc/rc.d/*)
+_all_rc_d_files=""
+for _rc_d in /etc/rc.d ${more_rc_d} ; do
+	if [ -d $_rc_d -a ! -h $_rc_d -a ".$(echo ${_rc_d}/*)" != ".${_rc_d}/\*" ]; then
+		_all_rc_d_files="${_all_rc_d_files} $(ls -1d ${_rc_d}/* | fgrep -v -e /RCS -e /SCCS)"
+	fi
+done
+
+ordered_rc_d_files=$(rcorder -s nostart ${_all_rc_d_files})
 
-for _rc_elem in $files; do
-	run_rc_script $_rc_elem start
+for _rc_elem in $ordered_rc_d_files; do
+	$debug_echo run_rc_script $_rc_elem $_rc_run_command
 done
 
 date


-- 
						Greg A. Woods

H:+1 416 218-0098  W:+1 416 489-5852 x122  VE3TCP  RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>