SVN: rc-scripts/trunk/rc.d/rc.sysinit

glen glen at pld-linux.org
Thu Nov 1 02:34:13 CET 2007


Author: glen
Date: Thu Nov  1 02:34:13 2007
New Revision: 8932

Modified:
   rc-scripts/trunk/rc.d/rc.sysinit
Log:
- read /proc/cmdline just once (idea stolen from fedora)

Modified: rc-scripts/trunk/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/trunk/rc.d/rc.sysinit	(original)
+++ rc-scripts/trunk/rc.d/rc.sysinit	Thu Nov  1 02:34:13 2007
@@ -40,6 +40,9 @@
 
 CONSOLE_LOGLEVEL=1
 
+# Only read this once.
+cmdline=$(cat /proc/cmdline)
+
 # Read functions
 . /etc/rc.d/init.d/functions
 
@@ -269,7 +272,7 @@
 
 	# Initialize USB controllers
 	usb=0
-	if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "/proc/bus/usb" /proc/mounts 2>/dev/null ; then
+	if ! strstr "$cmdline" "nousb" && ! grep -q "/proc/bus/usb" /proc/mounts 2>/dev/null ; then
 		aliases=$(/sbin/modprobe -c | awk '/^alias[\t ]+usb-controller/ { print $3 }')
 		if [ -n "$aliases" -a "$aliases" != "off" ] ; then
 			/sbin/modprobe -s -k usbcore
@@ -305,11 +308,11 @@
 	fi
 
 	# Setup hdparm thing (if exists and is needed)
-	if ! grep -iq nohdparm /proc/cmdline 2>/dev/null; then
+	if ! strstr "$cmdline" nohdparm; then
 		[ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
 	fi
 
-	if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then
+	if [ -f /fastboot ] || strstr "$cmdline" "fastboot"; then
 		fastboot=yes
 	else
 		fastboot=
@@ -389,7 +392,7 @@
 	fi
 
 	# Check for arguments
-	if grep -iq nopnp /proc/cmdline 2>/dev/null; then
+	if strstr "$cmdline" nopnp; then
 		PNP=
 	else
 		PNP=yes
@@ -481,7 +484,7 @@
 
 	if [ ! -f /proc/modules ]; then
 		USEMODULES=
-	elif ! grep -iq nomodules /proc/cmdline 2>/dev/null; then
+	elif ! strstr "$cmdline" nomodules; then
 		USEMODULES=y
 	else
 		USEMODULES=
@@ -528,7 +531,7 @@
 	fi
 
 	# Load firewire devices
-	if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then
+	if ! strstr "$cmdline" nofirewire; then
 		aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print	$3 }')
 		if [ -n "$aliases" -a "$aliases" != "off" ] ; then
 			for alias in $aliases ; do
@@ -718,7 +721,7 @@
 
 	_RUN_QUOTACHECK=0
 	# Check filesystems
-	if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline 2>/dev/null; then
+	if [ -z "$fastboot" ] && ! strstr "$cmdline" nofsck; then
 		rc_splash "fsck start"
 		show "Checking filesystems"; started
 		initlog -c "fsck -C -T -R -A -a -P $fsckoptions"


More information about the pld-cvs-commit mailing list