[BACK]Return to rc.lkm CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc

File: [cvs.NetBSD.org] / src / etc / Attic / rc.lkm (download)

Revision 1.7, Sat Oct 7 07:36:56 2000 UTC (19 years, 6 months ago) by lukem
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, fvdl_fs64_base
Changes since 1.6: +2 -2 lines

use ${foo##*/} instead of `basename $foo`.  as suggested (with minor variation)
by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>

#	$NetBSD: rc.lkm,v 1.7 2000/10/07 07:36:56 lukem Exp $
#
# this script loads or unloads LKMs (loadable kernel modules).

if [ -s /etc/lkm.conf ]; then
	case "$1" in
	start)
		(while read path options entry postinstall output when; do
			flags=''
	
			case $path in
			\#*|"")
				continue
				;;
			/*)
				;;
			*)
				if [ -f "/lkm/$path" ]; then
					path="/lkm/$path"
				elif [ -f "/usr/lkm/$path" ]; then
					path="/usr/lkm/$path"
				else
					echo "couldn't find module $path"
				fi
				;;
			esac
	
			case $options in
			-)
				;;
			*)
				flags="$flags $options"
				;;
			esac
	
			case $entry in
			-)
				;;
			*)
				flags="$flags -e $entry"
				;;
			esac
	
			case $postinstall in
			-)
				;;
			*)
				flags="$flags -p $postinstall"
				;;
			esac
	
			case $output in
			-)
				;;
			*)
				if [ "$output" = TEMP ]; then
					flags="$flags -o /tmp/lkm.$$"
				else
					flags="$flags -o $output"
				fi
				;;
			esac
	
			case $when in
			-)
				when=BEFORENET
				;;
			[A-Z]*)
					;;
			*)
				echo "invalid \"when\" field in /etc/lkm.conf - $path not loaded!"
				continue
				;;
			esac
	
			if [ "$when" != "$lkmstage" ]; then
				continue
			fi
	
			# try to find out booted kernel via sysctl
			# if supported
			booted_kernel=`/sbin/sysctl -n machdep.booted_kernel 2>/dev/null`
			if [ ! -z "$booted_kernel" -a -r "$booted_kernel" ];
			then
				flags="-A $booted_kernel $flags"
			fi

			echo -n "${path##*/}: "
			modload $flags $path
			rm -f /tmp/lkm.$$
		done) < /etc/lkm.conf
		;;
	stop)
		(while read path options entry postinstall output when; do
			case $path in
			\#*|"")
				continue
				;;
			/*)
				name=${path##*/}
				name=${name%.o}
				;;
			*)
				name=${path%.o}
				;;
			esac

			if [ "$when" = "$lkmstage" ]; then
				modunload -n ${name}
			fi
		done) < /etc/lkm.conf
		;;
	esac
fi