Subject: Bug#4090: /etc/init.d/kerneld uses grep

From: Lukas Nellen <[email-masked]>
Date: Fri, 09 Aug 1996 17:11:51 -0500

Package: modules
Version: 2.0.0-6

The script /etc/init.d/kerneld uses grep - which might not be available. The 
problem is that if you put `auto' into /etc/conf.modules, kerneld is started 
before any extra mounts are done. So if you have /usr on a separate partition, 
/usr/bin/grep (which is where grep lives) is not yet available.

Possible solution: If /etc/init.d/kerneld accepts `auto' as an argument, it is 
possible to distinguish if it is called by /etc/init.d/modules or as part of 
the links in one of the /etc/rc?.d.

I include a patch which works on my system which does the following:
- /etc/init.d/modules calls /etc/init.d/kerneld with the argument `auto' 
instead of `start' if the keyword `auto' is found in /etc/conf.modules.
- /etc/init.d/kerneld interprets `auto' like `start', except that it skips the 
test if the keyword `noauto' is present in /etc/conf.modules

Feel free to use the patch if you like my solution and if my patch looks ok to 
you.

			Cheers,
				Lukas
--- modules.orig	Fri Aug  9 16:55:11 1996
+++ modules	Fri Aug  9 16:55:33 1996
@@ -34,7 +34,7 @@
 do
 	case "$module" in
 		auto)	[ ${startkerneld} -eq 0 -a -x /sbin/kerneld ] && \
-			echo && /etc/init.d/kerneld start && startkerneld=1;
+			echo && /etc/init.d/kerneld auto && startkerneld=1;
 			continue ;;
 		noauto) continue ;;
 		\#*|"") continue ;;
--- kerneld.orig	Fri Aug  9 16:53:26 1996
+++ kerneld	Fri Aug  9 16:54:57 1996
@@ -6,7 +6,9 @@
 test -f /sbin/kerneld || exit 0
 
 # Check if noauto is set
-grep "^[ ]*noauto" /etc/modules 2>&1 > /dev/null && exit 0
+if [ "$1" != "auto" ]; then
+        grep "^[ ]*noauto" /etc/modules 2>&1 > /dev/null && exit 0
+fi
 
 KDOPT=""
 
@@ -14,7 +16,7 @@
 [ -d /lib/modules/`uname -r` ] || exit 0
 
 case "$1" in
-  start)
+  start|auto)
 #
 #	is /proc mounted ?
 #
-------------------------------------------------------------------------------
   Dr. Lukas Nellen                 | Email: [email-masked]
   Depto. de Fisica Teorica, IFUNAM |
   Apdo. Postal 20-364              | Tel.:  +52 5 622 5014 ext. 218
   01000 Mexico D.F., MEXICO        | Fax:   +52 5 622 5015