Submitted By: Douglas Hunley (doug@hunley.homeip.net)
Date: 2003-08-14
Initial Package Version: 1.11
Origin: Douglas Hunley
Description: Various changes to lfs-bootscripts including fixing Bug #488, preventing the bootscripts from halting on error, adding a new runlevel error summary function, various cleanups for consistancy in code style, added funtionality to handle the kernel pseudo-filesystems and finally added /tmp /var/run and /var/lock as tmpfs/shmfs if supported on the current kernel

diff -Naur lfs-bootscripts-1.11/CHANGELOG lfs-bootscripts-1.2/CHANGELOG
--- lfs-bootscripts-1.11/CHANGELOG	2003-02-03 22:56:25.000000000 +0000
+++ lfs-bootscripts-1.2/CHANGELOG	2003-08-14 19:08:44.000000000 +0000
@@ -1,3 +1,16 @@
+1.2  - August 14th, 2003:
+
+	* modifed all scripts to use 'more efficient' bash-isms on the various
+	test conditions
+	* added code (in rc) to continue booting on script failure while 
+	logging it to the syslog (if available) and outputting a summary 
+	when the new runlevel is reached
+	* added code (in mountfs) to automagically handle the various pseudo
+	filesystems in the kernel (devpts, devshm, sysfs, etc)
+	* added code (in mountfs) to automatically mount /tmp and /var/run 
+	and /var/lock as tmpfs if we detect support in the kernel
+	* fixed bug #488 in the fsck return code checking
+
 1.11 - February 3rd, 2003:
 
 	* /etc/mtab is now a real file and is handled correctly so there are
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/checkfs lfs-bootscripts-1.2/rc.d/init.d/checkfs
--- lfs-bootscripts-1.11/rc.d/init.d/checkfs	2002-05-26 18:43:08.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/checkfs	2003-08-14 19:09:33.000000000 +0000
@@ -4,12 +4,12 @@
 # Based on checkfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
 # Patch to handle all fsck variants by A. Luebke - luebke@users.sourceforge.net
+# Patch to fix bug #488 with the fsck return codes by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-if [ -f /fastboot ]
-then
+if [ -f /fastboot ] ; then
 	echo "Fast boot requested, will not perform file system checks"
 	exit 0
 fi
@@ -18,8 +18,7 @@
 mount -n -o remount,ro /
 evaluate_retval
 
-if [ $? != 0 ]
-then
+if [ $? != 0 ] ; then
 	$FAILURE
 	echo
 	echo "Cannot check root file system because it could not"
@@ -34,8 +33,7 @@
 	$rc_base/init.d/halt
 fi
 
-if [ -f /forcefsck ]
-then
+if [ -f /forcefsck ] ; then
 	echo "/forcefsck exists, forcing file system check"
 	options="-f"
 else
@@ -47,8 +45,11 @@
 fsck $options -a -A -C -T
 error_value=$?
 
-if [ "$error_value" = 1 ]
-then
+if [ "$error_value" = 0 ] ; then
+	print_status success
+fi
+
+if [ "$error_value" = 1 ] ; then
 	$WARNING
 	echo "File system errors were found and have been corrected."
 	echo "You may want to double-check that everything was fixed"
@@ -57,13 +58,7 @@
 	print_status warning
 fi
 
-if [ "$error_value" = 0 ]
-then
-	print_status success
-fi
-
-if [ "$error_value" = 2 ]
-then
+if [ "$error_value" = 2 -o "$error_value" = 3 ] ; then
 	$WARNING
 	echo "File system errors were found and have been corrected, but"
 	echo "the nature of the errors require this system to be rebooted."
@@ -77,8 +72,7 @@
 	$rc_base/init.d/reboot
 fi
 
-if [ "$error_value" -gt 2 -a "$error_value" -lt 16 ]
-then
+if [ "$error_value" -gt 3 -a "$error_value" -lt 16 ] ; then
 	$FAILURE
 	echo "File system errors were encountered that couldn't be"
 	echo "fixed automatically. This system cannot continue to boot"
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/cleanfs lfs-bootscripts-1.2/rc.d/init.d/cleanfs
--- lfs-bootscripts-1.11/rc.d/init.d/cleanfs	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/cleanfs	2003-08-14 19:14:24.000000000 +0000
@@ -2,13 +2,16 @@
 # Begin $rc_base/init.d/cleanfs - Clean file system
 
 # Written by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patched to handle /var/run being tmpfs mounted by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-echo "Removing /var/run/* and /var/lock/*"
-rm -rf /var/run/* /var/lock/*
-evaluate_retval
+if [ -z "$HAS_TMPFS" -o -z "$HAS_SHMFS" ] ; then
+	echo "Removing /var/run/* and /var/lock/*"
+	rm -rf /var/run/* /var/lock/*
+	evaluate_retval
+fi
 
 echo "Creating new /var/run/utmp..."
 touch /var/run/utmp && chmod 644 /var/run/utmp
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/functions lfs-bootscripts-1.2/rc.d/init.d/functions
--- lfs-bootscripts-1.11/rc.d/init.d/functions	2002-04-01 14:22:04.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/functions	2003-08-14 19:25:43.000000000 +0000
@@ -7,6 +7,10 @@
 # With code based on Matthias Benkmann's simpleinit-msb @
 # http://winterdrache.de/linux/newboot/index.html
 
+# Patched to include the pseudo-filesystems available in the kernel and to not
+# stop on script startup failure as we now log said failure and print a runlevel
+# summary of failures by Douglas Hunley - doug@hunley.homeip.net
+
 umask 022
 
 export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
@@ -26,6 +30,30 @@
 WARNING="echo -en \\033[1;33m"
 FAILURE="echo -en \\033[1;31m"
 
+while read DEV FS
+do
+	case $FS in
+		sysfs)
+			HAS_SYSFS=yes
+			;;
+		tmpfs)
+			HAS_TMPFS=yes
+			;;
+		shmfs)
+			HAS_SHMFS=yes
+			;;
+		devpts)
+			HAS_DEVPTS=yes
+			;;
+		usbdevfs)
+			HAS_USBDEVFS=yes
+			;;
+		usbfs)
+			HAS_USBFS=yes
+			;;
+	esac
+done < /proc/filesystems
+
 print_error_msg()
 {
 	echo
@@ -40,20 +68,16 @@
 	$NORMAL
 	echo
 	echo
-	echo "Press Enter to continue..."
-	read
 }
 
 check_script_status()
 {
-	if [ ! -f $i ]
-	then
+	if [ ! -f $i ] ; then
 		echo "$i is not a valid symlink"
 		continue
 	fi
 
-	if [ ! -x $i ]
-	then
+	if [ ! -x $i ] ; then
 		echo "$i is not executable, skipping"
 		continue
 	fi
@@ -63,8 +87,7 @@
 {
 	error_value=$?
 
-	if [ $error_value = 0 ]
-	then
+	if [ $error_value = 0 ] ; then
 		print_status success
 	else
 		print_status failure
@@ -75,8 +98,7 @@
 
 print_status()
 {
-	if [ $# = 0 ]
-	then
+	if [ $# = 0 ] ; then
 		echo "Usage: $0 {success|warning|failure}"
 		return 1
 	fi
@@ -131,16 +153,14 @@
 
 loadproc()
 {
-	if [ $# = 0 ]
-	then
+	if [ $# = 0 ] ; then
 		echo "Usage: loadproc {program}"
 		exit 1
 	fi
 
 	getpids $1
 
-	if [ -z "$pidlist" ]
-	then
+	if [ -z "$pidlist" ] ; then
 		"$@"
 		evaluate_retval
 	else
@@ -151,13 +171,12 @@
 
 killproc()
 {
-	if [ $# = 0 ]
-	then
+	if [ $# = 0 ] ; then
 		echo "Usage: killproc {program} [signal]"
 		exit 1
 	fi
 
-	if [ -z "$2" ]; then
+	if [ -z "$2" ] ; then
 		signal=TERM
 		fallback=KILL
 	else
@@ -168,27 +187,35 @@
 
 	getpids $1
 
-	if [ -n "$pidlist" ]; then
+	if [ -n "$pidlist" ] ; then
 		failure=0
 
 		for pid in $pidlist
 		do
 			kill -$signal $pid 2>/dev/null
 
-			for ((i=0; $i<5000; i=$i+1)); do :; done
+			for ((i=0; $i<5000; i=$i+1))
+			do
+				:;
+			done
 
-			for ((i=0; $i<$KILLDELAY; i=$i+1)); do
+			for ((i=0; $i<$KILLDELAY; i=$i+1))
+			do
 				kill -0 $pid 2>/dev/null || break
 				sleep 1
 			done
 
-			if [ -n "$fallback" ]; then kill -$fallback $pid 2>/dev/null; fi
+			if [ -n "$fallback" ] ; then 
+				kill -$fallback $pid 2>/dev/null
+			fi
 
 			kill -0 $pid 2>/dev/null && failure=1
 		done
 
 		base=${1##*/}
-		if [ $failure = 0 ]; then rm -f /var/run/$base.pid; fi
+		if [ $failure = 0 ] ; then
+			rm -f /var/run/$base.pid
+		fi
 
 		(exit $failure)
 		evaluate_retval
@@ -200,13 +227,12 @@
 
 reloadproc()
 {
-	if [ $# = 0 ]
-	then
+	if [ $# = 0 ] ; then
 		echo "Usage: reloadproc {program} [signal]"
 		exit 1
 	fi
 
-	if [ -z "$2" ]; then
+	if [ -z "$2" ] ; then
 		signal=HUP
 	else
 		signal=${2##-}
@@ -216,8 +242,7 @@
 
 	getpids $1
 
-	if [ -n "$pidlist" ]
-	then
+	if [ -n "$pidlist" ] ; then
 		failure=0
 
 		for pid in $pidlist
@@ -235,8 +260,7 @@
 
 statusproc()
 {
-	if [ $# = 0 ]
-	then
+	if [ $# = 0 ] ; then
 		echo "Usage: statusproc {program}"
 		exit 1
 	fi
@@ -244,12 +268,10 @@
 	base=${1##*/}
 	getpids $base
 
-	if [ -n "$pidlist" ]
-	then
+	if [ -n "$pidlist" ] ; then
 		echo "$base is running with Process ID(s) $pidlist"
 	else
-		if [ -s /var/run/$base.pid ]
-		then
+		if [ -s /var/run/$base.pid ] ; then
 			echo "$1 is not running but /var/run/$base.pid exists"
 			return 1
 		else
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/loadkeys lfs-bootscripts-1.2/rc.d/init.d/loadkeys
--- lfs-bootscripts-1.11/rc.d/init.d/loadkeys	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/loadkeys	2003-08-14 19:41:48.000000000 +0000
@@ -3,13 +3,19 @@
 
 # Based on loadkeys script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to clean-up the display and eliminate double 'Loading...' messages
+# and to clear the kernel string table per the loadkeys manpage and to only
+# load a keymap if the default is defkeymap file exists
+# by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-echo -n "Loading keymap..."
-loadkeys -d
-evaluate_retval
+if [ -f /usr/share/kbd/keymaps/defkeymap.map.gz ] ; then
+	echo -n "Loading /usr/share/kbd/keymaps/defkeymap.map.gz keymap..."
+	loadkeys -d -s &>/dev/null
+	evaluate_retval
+fi
 
 # End $rc_base/init.d/loadkeys
 
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/mountfs lfs-bootscripts-1.2/rc.d/init.d/mountfs
--- lfs-bootscripts-1.11/rc.d/init.d/mountfs	2003-02-03 22:56:25.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/mountfs	2003-08-14 19:57:16.000000000 +0000
@@ -3,6 +3,8 @@
 
 # Based on mountfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to handle the various pseudo-filesystems of the kernel and
+# to use shmfs/tmpfs if available by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -19,16 +21,72 @@
 		# add /dev above if you use devfs
 		evaluate_retval
 
-		# The following mount command will mount all file systems. If you
-		# have other (network based) file system that should not be or
-		# cannot be mounted at this time, add them to the NO_FS variable
-		# below. All file systems that are added to the variable in the
-		# form of no<filesystem> will be skipped.
+		# The following mount command will mount all local, real 
+		# (non-pseudo) file systems. If you have other (network 
+		# based) file system that should not be or cannot be 
+		# mounted at this time, add them to the NO_FS variable 
+		# below. All file systems that are added to the variable 
+		# in the form of no<filesystem> will be skipped.
 
-		NO_FS="nonfs,nosmbfs,noproc"
-		echo "Mounting remaining file systems..."
+		NO_FS="nonfs,nosmbfs,noproc,nodevpts,nosysfs,notmpfs,nousbdevfs,nousbfs"
+		echo "Mounting remaining local file systems..."
 		mount -a -t $NO_FS
 		evaluate_retval
+
+		# Now, we handle all the local pseudo filesystems that
+		# are supported by the current kernel.
+
+		if [ ! -z "$HAS_SYSFS" ] ; then
+			echo "Mounting SYSFS filesystem on /sys ..."
+			mkdir -p /sys &>/dev/null && mount -t sysfs sysfs /sys -o defaults
+			evaluate_retval
+		fi
+
+		if [ ! -z "$HAS_TMPFS" ] ; then
+			echo "Mounting TMPFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t tmpfs tmpfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as TMPFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_SHMFS" ] ; then
+			echo "Mounting SHMFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t shmfs shmfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as SHMFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_DEVPTS" ] ; then
+			echo "Mounting DEVPTS on /dev/pts ..."
+			mkdir -p /dev/pts &>/dev/null && mount -t devpts devpts /dev/pts -o defaults,mode=620
+		fi
+
+		if [ ! -z "$HAS_USBDEVFS" ] ; then
+			echo "Mounting USBDEVFS on /proc/bus/usb ..."
+			mount -t usbdevfs usbdevfs /proc/bus/usb -o defaults
+		fi
+
+		if [ ! -z "$HAS_USBFS" ] ; then
+			echo "Mounting USBFS on /proc/bus/usb ..."
+			mount -t usbfs usbfs /proc/bus/usb -o defaults
+		fi
+
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/mountproc lfs-bootscripts-1.2/rc.d/init.d/mountproc
--- lfs-bootscripts-1.11/rc.d/init.d/mountproc	2003-02-03 23:00:02.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/mountproc	2003-08-14 19:58:16.000000000 +0000
@@ -6,8 +6,8 @@
 source /etc/sysconfig/rc
 source $rc_functions
 
-if [ ! -e /proc/mounts ]; then
-	echo "Mounting proc file system..."
+if [ ! -e /proc/mounts ] ; then
+	echo "Mounting PROC file system..."
 	mount -n /proc
 	evaluate_retval
 fi
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/network lfs-bootscripts-1.2/rc.d/init.d/network
--- lfs-bootscripts-1.11/rc.d/init.d/network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/rc lfs-bootscripts-1.2/rc.d/init.d/rc
--- lfs-bootscripts-1.11/rc.d/init.d/rc	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/rc	2003-08-14 20:02:39.000000000 +0000
@@ -3,16 +3,20 @@
 
 # Based on rc script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to support logging of init-script failure to syslog
+# and printing a summary of failed scripts upon runlevel completion
+# by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
 trap "" INT QUIT TSTP
 
+FAILED=
+
 [ "$1" != "" ] && runlevel=$1
 
-if [ "$runlevel" = "" ]
-then
+if [ "$runlevel" = "" ] ; then
 	echo "Usage: $0 <runlevel>" >&2
 	exit 1
 fi
@@ -20,27 +24,22 @@
 previous=$PREVLEVEL
 [ "$previous" = "" ] && previous=N
 
-if [ ! -d $rc_base/rc$runlevel.d ]
-then
+if [ ! -d $rc_base/rc$runlevel.d ] ; then
 	echo "$rc_base/rc$runlevel.d does not exist"
 	exit 1
 fi
 
-if [ "$previous" != "N" ]
-then
+if [ "$previous" != "N" ] ; then
 	for i in $(ls -v $rc_base/rc$runlevel.d/K* 2> /dev/null)
 	do
-
 		check_script_status
 
 		suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
 		prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
 		sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
 
-		if [ "$runlevel" != "0" ] && [ "$runlevel" != "6" ]
-		then
-			if [ ! -f $prev_start ] && [ ! -f $sysinit_start ]
-			then
+		if [ "$runlevel" != "0" ] && [ "$runlevel" != "6" ] ; then
+			if [ ! -f $prev_start ] && [ ! -f $sysinit_start ] ; then
 				$WARNING
 				echo "$i can't be executed because it was"
 				echo "not started in the previous runlevel ($previous)"
@@ -52,8 +51,7 @@
 		$i stop
 		error_value=$?
 
-		if [ "$error_value" != "0" ]
-		then
+		if [ "$error_value" != "0" ] ; then
 			print_error_msg
 		fi
 	done
@@ -61,8 +59,7 @@
 
 for i in $( ls -v $rc_base/rc$runlevel.d/S* 2> /dev/null)
 do
-	if [ "$previous" != "N" ]
-	then
+	if [ "$previous" != "N" ] ; then
 		suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
 		stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
 		prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
@@ -75,11 +72,20 @@
 	$i start
 	error_value=$?
 
-	if [ "$error_value" != "0" ]
-	then
+	if [ "$error_value" != "0" ] ; then
+		FAILED="$FAILED $suffix"
 		print_error_msg
 	fi
 done
 
+if [ "$FAILED" != "" ] ; then
+	$FAILURE
+	echo "The following scripts failed to start in runlevel $runlevel : $FAILED"
+	$NORMAL
+	if [ -x /usr/bin/logger ] ; then
+		/usr/bin/logger -p daemon.info "The following scripts failed to start in runlevel $runlevel : $FAILED"
+	fi
+fi
+
 # End $rc_base/init.d/rc
 
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/sendsignals lfs-bootscripts-1.2/rc.d/init.d/sendsignals
--- lfs-bootscripts-1.11/rc.d/init.d/sendsignals	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/sendsignals	2003-08-14 20:06:48.000000000 +0000
@@ -19,8 +19,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
@@ -36,8 +35,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
diff -Naur lfs-bootscripts-1.11/rc.d/init.d/sysklogd lfs-bootscripts-1.2/rc.d/init.d/sysklogd
--- lfs-bootscripts-1.11/rc.d/init.d/sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/init.d/sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc0.d/K40sysklogd lfs-bootscripts-1.2/rc.d/rc0.d/K40sysklogd
--- lfs-bootscripts-1.11/rc.d/rc0.d/K40sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc0.d/K40sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc0.d/K50sendsignals lfs-bootscripts-1.2/rc.d/rc0.d/K50sendsignals
--- lfs-bootscripts-1.11/rc.d/rc0.d/K50sendsignals	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc0.d/K50sendsignals	2003-08-14 20:06:48.000000000 +0000
@@ -19,8 +19,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
@@ -36,8 +35,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
diff -Naur lfs-bootscripts-1.11/rc.d/rc0.d/K60mountfs lfs-bootscripts-1.2/rc.d/rc0.d/K60mountfs
--- lfs-bootscripts-1.11/rc.d/rc0.d/K60mountfs	2003-02-03 22:56:25.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc0.d/K60mountfs	2003-08-14 19:57:16.000000000 +0000
@@ -3,6 +3,8 @@
 
 # Based on mountfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to handle the various pseudo-filesystems of the kernel and
+# to use shmfs/tmpfs if available by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -19,16 +21,72 @@
 		# add /dev above if you use devfs
 		evaluate_retval
 
-		# The following mount command will mount all file systems. If you
-		# have other (network based) file system that should not be or
-		# cannot be mounted at this time, add them to the NO_FS variable
-		# below. All file systems that are added to the variable in the
-		# form of no<filesystem> will be skipped.
+		# The following mount command will mount all local, real 
+		# (non-pseudo) file systems. If you have other (network 
+		# based) file system that should not be or cannot be 
+		# mounted at this time, add them to the NO_FS variable 
+		# below. All file systems that are added to the variable 
+		# in the form of no<filesystem> will be skipped.
 
-		NO_FS="nonfs,nosmbfs,noproc"
-		echo "Mounting remaining file systems..."
+		NO_FS="nonfs,nosmbfs,noproc,nodevpts,nosysfs,notmpfs,nousbdevfs,nousbfs"
+		echo "Mounting remaining local file systems..."
 		mount -a -t $NO_FS
 		evaluate_retval
+
+		# Now, we handle all the local pseudo filesystems that
+		# are supported by the current kernel.
+
+		if [ ! -z "$HAS_SYSFS" ] ; then
+			echo "Mounting SYSFS filesystem on /sys ..."
+			mkdir -p /sys &>/dev/null && mount -t sysfs sysfs /sys -o defaults
+			evaluate_retval
+		fi
+
+		if [ ! -z "$HAS_TMPFS" ] ; then
+			echo "Mounting TMPFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t tmpfs tmpfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as TMPFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_SHMFS" ] ; then
+			echo "Mounting SHMFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t shmfs shmfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as SHMFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_DEVPTS" ] ; then
+			echo "Mounting DEVPTS on /dev/pts ..."
+			mkdir -p /dev/pts &>/dev/null && mount -t devpts devpts /dev/pts -o defaults,mode=620
+		fi
+
+		if [ ! -z "$HAS_USBDEVFS" ] ; then
+			echo "Mounting USBDEVFS on /proc/bus/usb ..."
+			mount -t usbdevfs usbdevfs /proc/bus/usb -o defaults
+		fi
+
+		if [ ! -z "$HAS_USBFS" ] ; then
+			echo "Mounting USBFS on /proc/bus/usb ..."
+			mount -t usbfs usbfs /proc/bus/usb -o defaults
+		fi
+
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc0.d/K80network lfs-bootscripts-1.2/rc.d/rc0.d/K80network
--- lfs-bootscripts-1.11/rc.d/rc0.d/K80network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc0.d/K80network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc1.d/K80sysklogd lfs-bootscripts-1.2/rc.d/rc1.d/K80sysklogd
--- lfs-bootscripts-1.11/rc.d/rc1.d/K80sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc1.d/K80sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc1.d/K90network lfs-bootscripts-1.2/rc.d/rc1.d/K90network
--- lfs-bootscripts-1.11/rc.d/rc1.d/K90network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc1.d/K90network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc2.d/K90network lfs-bootscripts-1.2/rc.d/rc2.d/K90network
--- lfs-bootscripts-1.11/rc.d/rc2.d/K90network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc2.d/K90network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc2.d/S10sysklogd lfs-bootscripts-1.2/rc.d/rc2.d/S10sysklogd
--- lfs-bootscripts-1.11/rc.d/rc2.d/S10sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc2.d/S10sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc3.d/S10sysklogd lfs-bootscripts-1.2/rc.d/rc3.d/S10sysklogd
--- lfs-bootscripts-1.11/rc.d/rc3.d/S10sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc3.d/S10sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc3.d/S20network lfs-bootscripts-1.2/rc.d/rc3.d/S20network
--- lfs-bootscripts-1.11/rc.d/rc3.d/S20network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc3.d/S20network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc4.d/S10sysklogd lfs-bootscripts-1.2/rc.d/rc4.d/S10sysklogd
--- lfs-bootscripts-1.11/rc.d/rc4.d/S10sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc4.d/S10sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc4.d/S20network lfs-bootscripts-1.2/rc.d/rc4.d/S20network
--- lfs-bootscripts-1.11/rc.d/rc4.d/S20network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc4.d/S20network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc5.d/S10sysklogd lfs-bootscripts-1.2/rc.d/rc5.d/S10sysklogd
--- lfs-bootscripts-1.11/rc.d/rc5.d/S10sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc5.d/S10sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc5.d/S20network lfs-bootscripts-1.2/rc.d/rc5.d/S20network
--- lfs-bootscripts-1.11/rc.d/rc5.d/S20network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc5.d/S20network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rc6.d/K40sysklogd lfs-bootscripts-1.2/rc.d/rc6.d/K40sysklogd
--- lfs-bootscripts-1.11/rc.d/rc6.d/K40sysklogd	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc6.d/K40sysklogd	2003-08-14 20:12:42.000000000 +0000
@@ -3,6 +3,7 @@
 
 # Based on sysklogd script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to turn on the paranoid mode for klogd by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -13,7 +14,7 @@
 		loadproc syslogd -m 0
 
 		echo "Starting kernel log daemon..."
-		loadproc klogd
+		loadproc klogd -p
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc6.d/K50sendsignals lfs-bootscripts-1.2/rc.d/rc6.d/K50sendsignals
--- lfs-bootscripts-1.11/rc.d/rc6.d/K50sendsignals	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc6.d/K50sendsignals	2003-08-14 20:06:48.000000000 +0000
@@ -19,8 +19,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
@@ -36,8 +35,7 @@
 
 sleep 3
 
-if [ "$error_value" = 0 ]
-then
+if [ "$error_value" = 0 ] ; then
 	print_status success
 else
 	print_status failure
diff -Naur lfs-bootscripts-1.11/rc.d/rc6.d/K60mountfs lfs-bootscripts-1.2/rc.d/rc6.d/K60mountfs
--- lfs-bootscripts-1.11/rc.d/rc6.d/K60mountfs	2003-02-03 22:56:25.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc6.d/K60mountfs	2003-08-14 19:57:16.000000000 +0000
@@ -3,6 +3,8 @@
 
 # Based on mountfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to handle the various pseudo-filesystems of the kernel and
+# to use shmfs/tmpfs if available by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -19,16 +21,72 @@
 		# add /dev above if you use devfs
 		evaluate_retval
 
-		# The following mount command will mount all file systems. If you
-		# have other (network based) file system that should not be or
-		# cannot be mounted at this time, add them to the NO_FS variable
-		# below. All file systems that are added to the variable in the
-		# form of no<filesystem> will be skipped.
+		# The following mount command will mount all local, real 
+		# (non-pseudo) file systems. If you have other (network 
+		# based) file system that should not be or cannot be 
+		# mounted at this time, add them to the NO_FS variable 
+		# below. All file systems that are added to the variable 
+		# in the form of no<filesystem> will be skipped.
 
-		NO_FS="nonfs,nosmbfs,noproc"
-		echo "Mounting remaining file systems..."
+		NO_FS="nonfs,nosmbfs,noproc,nodevpts,nosysfs,notmpfs,nousbdevfs,nousbfs"
+		echo "Mounting remaining local file systems..."
 		mount -a -t $NO_FS
 		evaluate_retval
+
+		# Now, we handle all the local pseudo filesystems that
+		# are supported by the current kernel.
+
+		if [ ! -z "$HAS_SYSFS" ] ; then
+			echo "Mounting SYSFS filesystem on /sys ..."
+			mkdir -p /sys &>/dev/null && mount -t sysfs sysfs /sys -o defaults
+			evaluate_retval
+		fi
+
+		if [ ! -z "$HAS_TMPFS" ] ; then
+			echo "Mounting TMPFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t tmpfs tmpfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as TMPFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_SHMFS" ] ; then
+			echo "Mounting SHMFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t shmfs shmfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as SHMFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_DEVPTS" ] ; then
+			echo "Mounting DEVPTS on /dev/pts ..."
+			mkdir -p /dev/pts &>/dev/null && mount -t devpts devpts /dev/pts -o defaults,mode=620
+		fi
+
+		if [ ! -z "$HAS_USBDEVFS" ] ; then
+			echo "Mounting USBDEVFS on /proc/bus/usb ..."
+			mount -t usbdevfs usbdevfs /proc/bus/usb -o defaults
+		fi
+
+		if [ ! -z "$HAS_USBFS" ] ; then
+			echo "Mounting USBFS on /proc/bus/usb ..."
+			mount -t usbfs usbfs /proc/bus/usb -o defaults
+		fi
+
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rc6.d/K80network lfs-bootscripts-1.2/rc.d/rc6.d/K80network
--- lfs-bootscripts-1.11/rc.d/rc6.d/K80network	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rc6.d/K80network	2003-08-14 20:00:10.000000000 +0000
@@ -21,18 +21,15 @@
 			esac
 		done
 
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Setting up default gateway..."
-			route add default gateway $GATEWAY metric 1 \
-				dev $GATEWAY_IF
+			route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
 			evaluate_retval
 		fi
 		;;
 
 	stop)
-		if [ "$GATEWAY" != "" ]
-		then
+		if [ "$GATEWAY" != "" ] ; then
 			echo "Removing default gateway..."
 			route del -net default
 			evaluate_retval
diff -Naur lfs-bootscripts-1.11/rc.d/rcsysinit.d/S20mountproc lfs-bootscripts-1.2/rc.d/rcsysinit.d/S20mountproc
--- lfs-bootscripts-1.11/rc.d/rcsysinit.d/S20mountproc	2003-02-03 23:00:02.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rcsysinit.d/S20mountproc	2003-08-14 19:58:16.000000000 +0000
@@ -6,8 +6,8 @@
 source /etc/sysconfig/rc
 source $rc_functions
 
-if [ ! -e /proc/mounts ]; then
-	echo "Mounting proc file system..."
+if [ ! -e /proc/mounts ] ; then
+	echo "Mounting PROC file system..."
 	mount -n /proc
 	evaluate_retval
 fi
diff -Naur lfs-bootscripts-1.11/rc.d/rcsysinit.d/S30checkfs lfs-bootscripts-1.2/rc.d/rcsysinit.d/S30checkfs
--- lfs-bootscripts-1.11/rc.d/rcsysinit.d/S30checkfs	2002-05-26 18:43:08.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rcsysinit.d/S30checkfs	2003-08-14 19:09:33.000000000 +0000
@@ -4,12 +4,12 @@
 # Based on checkfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
 # Patch to handle all fsck variants by A. Luebke - luebke@users.sourceforge.net
+# Patch to fix bug #488 with the fsck return codes by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-if [ -f /fastboot ]
-then
+if [ -f /fastboot ] ; then
 	echo "Fast boot requested, will not perform file system checks"
 	exit 0
 fi
@@ -18,8 +18,7 @@
 mount -n -o remount,ro /
 evaluate_retval
 
-if [ $? != 0 ]
-then
+if [ $? != 0 ] ; then
 	$FAILURE
 	echo
 	echo "Cannot check root file system because it could not"
@@ -34,8 +33,7 @@
 	$rc_base/init.d/halt
 fi
 
-if [ -f /forcefsck ]
-then
+if [ -f /forcefsck ] ; then
 	echo "/forcefsck exists, forcing file system check"
 	options="-f"
 else
@@ -47,8 +45,11 @@
 fsck $options -a -A -C -T
 error_value=$?
 
-if [ "$error_value" = 1 ]
-then
+if [ "$error_value" = 0 ] ; then
+	print_status success
+fi
+
+if [ "$error_value" = 1 ] ; then
 	$WARNING
 	echo "File system errors were found and have been corrected."
 	echo "You may want to double-check that everything was fixed"
@@ -57,13 +58,7 @@
 	print_status warning
 fi
 
-if [ "$error_value" = 0 ]
-then
-	print_status success
-fi
-
-if [ "$error_value" = 2 ]
-then
+if [ "$error_value" = 2 -o "$error_value" = 3 ] ; then
 	$WARNING
 	echo "File system errors were found and have been corrected, but"
 	echo "the nature of the errors require this system to be rebooted."
@@ -77,8 +72,7 @@
 	$rc_base/init.d/reboot
 fi
 
-if [ "$error_value" -gt 2 -a "$error_value" -lt 16 ]
-then
+if [ "$error_value" -gt 3 -a "$error_value" -lt 16 ] ; then
 	$FAILURE
 	echo "File system errors were encountered that couldn't be"
 	echo "fixed automatically. This system cannot continue to boot"
diff -Naur lfs-bootscripts-1.11/rc.d/rcsysinit.d/S40mountfs lfs-bootscripts-1.2/rc.d/rcsysinit.d/S40mountfs
--- lfs-bootscripts-1.11/rc.d/rcsysinit.d/S40mountfs	2003-02-03 22:56:25.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rcsysinit.d/S40mountfs	2003-08-14 19:57:16.000000000 +0000
@@ -3,6 +3,8 @@
 
 # Based on mountfs script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to handle the various pseudo-filesystems of the kernel and
+# to use shmfs/tmpfs if available by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
@@ -19,16 +21,72 @@
 		# add /dev above if you use devfs
 		evaluate_retval
 
-		# The following mount command will mount all file systems. If you
-		# have other (network based) file system that should not be or
-		# cannot be mounted at this time, add them to the NO_FS variable
-		# below. All file systems that are added to the variable in the
-		# form of no<filesystem> will be skipped.
+		# The following mount command will mount all local, real 
+		# (non-pseudo) file systems. If you have other (network 
+		# based) file system that should not be or cannot be 
+		# mounted at this time, add them to the NO_FS variable 
+		# below. All file systems that are added to the variable 
+		# in the form of no<filesystem> will be skipped.
 
-		NO_FS="nonfs,nosmbfs,noproc"
-		echo "Mounting remaining file systems..."
+		NO_FS="nonfs,nosmbfs,noproc,nodevpts,nosysfs,notmpfs,nousbdevfs,nousbfs"
+		echo "Mounting remaining local file systems..."
 		mount -a -t $NO_FS
 		evaluate_retval
+
+		# Now, we handle all the local pseudo filesystems that
+		# are supported by the current kernel.
+
+		if [ ! -z "$HAS_SYSFS" ] ; then
+			echo "Mounting SYSFS filesystem on /sys ..."
+			mkdir -p /sys &>/dev/null && mount -t sysfs sysfs /sys -o defaults
+			evaluate_retval
+		fi
+
+		if [ ! -z "$HAS_TMPFS" ] ; then
+			echo "Mounting TMPFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t tmpfs tmpfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as TMPFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_SHMFS" ] ; then
+			echo "Mounting SHMFS on /dev/shm ..."
+			mkdir -p /dev/shm &>/dev/null && mount -t shmfs shmfs /dev/shm -o defaults
+			evaluate_retval
+			for i in tmp var/lock var/run
+			do
+				echo "Mounting /$i as SHMFS ..."
+				mkdir -p /dev/shm/$i &>/dev/null && mount --bind -o nodev,nosuid,defaults /dev/shm/$i /$i
+				evaluate_retval
+			done
+			echo "Correcting permissions on /tmp ..."
+			chmod 1777 /dev/shm/tmp /tmp
+			evalutate_retval
+		fi
+
+		if [ ! -z "$HAS_DEVPTS" ] ; then
+			echo "Mounting DEVPTS on /dev/pts ..."
+			mkdir -p /dev/pts &>/dev/null && mount -t devpts devpts /dev/pts -o defaults,mode=620
+		fi
+
+		if [ ! -z "$HAS_USBDEVFS" ] ; then
+			echo "Mounting USBDEVFS on /proc/bus/usb ..."
+			mount -t usbdevfs usbdevfs /proc/bus/usb -o defaults
+		fi
+
+		if [ ! -z "$HAS_USBFS" ] ; then
+			echo "Mounting USBFS on /proc/bus/usb ..."
+			mount -t usbfs usbfs /proc/bus/usb -o defaults
+		fi
+
 		;;
 
 	stop)
diff -Naur lfs-bootscripts-1.11/rc.d/rcsysinit.d/S50cleanfs lfs-bootscripts-1.2/rc.d/rcsysinit.d/S50cleanfs
--- lfs-bootscripts-1.11/rc.d/rcsysinit.d/S50cleanfs	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rcsysinit.d/S50cleanfs	2003-08-14 19:14:24.000000000 +0000
@@ -2,13 +2,16 @@
 # Begin $rc_base/init.d/cleanfs - Clean file system
 
 # Written by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patched to handle /var/run being tmpfs mounted by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-echo "Removing /var/run/* and /var/lock/*"
-rm -rf /var/run/* /var/lock/*
-evaluate_retval
+if [ -z "$HAS_TMPFS" -o -z "$HAS_SHMFS" ] ; then
+	echo "Removing /var/run/* and /var/lock/*"
+	rm -rf /var/run/* /var/lock/*
+	evaluate_retval
+fi
 
 echo "Creating new /var/run/utmp..."
 touch /var/run/utmp && chmod 644 /var/run/utmp
diff -Naur lfs-bootscripts-1.11/rc.d/rcsysinit.d/S70loadkeys lfs-bootscripts-1.2/rc.d/rcsysinit.d/S70loadkeys
--- lfs-bootscripts-1.11/rc.d/rcsysinit.d/S70loadkeys	2002-03-16 18:26:44.000000000 +0000
+++ lfs-bootscripts-1.2/rc.d/rcsysinit.d/S70loadkeys	2003-08-14 19:41:48.000000000 +0000
@@ -3,13 +3,19 @@
 
 # Based on loadkeys script from LFS-3.1 and earlier.
 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# Patch to clean-up the display and eliminate double 'Loading...' messages
+# and to clear the kernel string table per the loadkeys manpage and to only
+# load a keymap if the default is defkeymap file exists
+# by Douglas Hunley - doug@hunley.homeip.net
 
 source /etc/sysconfig/rc
 source $rc_functions
 
-echo -n "Loading keymap..."
-loadkeys -d
-evaluate_retval
+if [ -f /usr/share/kbd/keymaps/defkeymap.map.gz ] ; then
+	echo -n "Loading /usr/share/kbd/keymaps/defkeymap.map.gz keymap..."
+	loadkeys -d -s &>/dev/null
+	evaluate_retval
+fi
 
 # End $rc_base/init.d/loadkeys
 
