From bcd451806ab1b2b66fba410f610b5b0290858814 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 14 Jan 2003 05:44:08 +0000 Subject: don't load hid stuff if it's non-modular LC_ALL=C grep... go faster --- rc.d/rc.sysinit | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 26aec6eb..06f6540b 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -35,7 +35,7 @@ if [ "$BOOTUP" = "graphical" ]; then fi if [ "`/sbin/consoletype`" = "vt" -a -x /sbin/setsysfont ]; then - for i in `grep '^[0-9]*.*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* tty//'`; do + for i in `LC_ALL=C grep '^[0-9]*.*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* tty//'`; do > /dev/tty$i done echo -n "Setting default font ($SYSFONT): " @@ -50,7 +50,7 @@ fi # Print a text banner. echo -en $"\t\tWelcome to " -if grep -q "Red Hat" /etc/redhat-release ; then +if LC_ALL=C grep -q "Red Hat" /etc/redhat-release ; then [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m" echo -en "Red Hat" [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" @@ -73,7 +73,7 @@ fi action $"Mounting proc filesystem: " mount -n -t proc /proc /proc # Unmount the initrd, if necessary -if grep -q /initrd /proc/mounts && ! grep -q /initrd/loopfs /proc/mounts ; then +if LC_ALL=C grep -q /initrd /proc/mounts && ! LC_ALL=C grep -q /initrd/loopfs /proc/mounts ; then if [ -e /initrd/dev/.devfsd ]; then umount /initrd/dev fi @@ -162,7 +162,7 @@ action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME} # Initialize USB controller and HID devices usb=0 -if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices 2>/dev/null ; then +if ! LC_ALL=C grep -iq "nousb" /proc/cmdline 2>/dev/null && ! LC_ALL=C grep -q "usb" /proc/devices 2>/dev/null ; then aliases=`/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }'` if [ -n "$aliases" -a "$aliases" != "off" ]; then modprobe usbcore @@ -173,7 +173,7 @@ if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices fi fi -if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && grep -q "usb" /proc/devices 2>/dev/null ; then +if ! LC_ALL=C grep -iq "nousb" /proc/cmdline 2>/dev/null && LC_ALL=C grep -q "usb" /proc/devices 2>/dev/null ; then usb=1 fi @@ -183,13 +183,15 @@ fi needusbstorage= if [ $usb = "1" ]; then - needusbstorage=`grep -e "^I.*Cls=08" /proc/bus/usb/devices 2>/dev/null` - action $"Initializing USB HID interface: " modprobe hid 2> /dev/null - action $"Initializing USB keyboard: " modprobe keybdev - action $"Initializing USB mouse: " modprobe mousedev + needusbstorage=`LC_ALL=C grep -e "^I.*Cls=08" /proc/bus/usb/devices 2>/dev/null` + LC_ALL=C grep 'hid' /proc/bus/usb/drivers || { + action $"Initializing USB HID interface: " modprobe hid 2> /dev/null + action $"Initializing USB keyboard: " modprobe keybdev + action $"Initializing USB mouse: " modprobe mousedev + } fi -if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then +if [ -f /fastboot ] || LC_ALL=C grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then fastboot=yes fi @@ -280,9 +282,9 @@ if [ -z "$fastboot" -a "X$ROOTFSTYPE" != "Xnfs" ]; then fi # Possibly update quotas if fsck was run on /. -grep -E '[[:space:]]+/[[:space:]]+' /etc/fstab | \ +LC_ALL=C grep -E '[[:space:]]+/[[:space:]]+' /etc/fstab | \ awk '{ print $4 }' | \ - grep -q quota + LC_ALL=C grep -q quota _ROOT_HAS_QUOTA=$? if [ X"$_RUN_QUOTACHECK" = X1 -a \ "$_ROOT_HAS_QUOTA" -a \ @@ -302,7 +304,7 @@ fi if [ -x /sbin/isapnp -a -f /etc/isapnp.conf -a ! -f /proc/isapnp ]; then # check for arguments passed from kernel - if ! grep -iq nopnp /proc/cmdline >/dev/null 2>&1 ; then + if ! LC_ALL=C grep -iq nopnp /proc/cmdline >/dev/null 2>&1 ; then PNP=yes fi if [ -n "$PNP" ]; then @@ -348,7 +350,7 @@ if [ -n "$IN_INITLOG" ]; then IN_INITLOG= fi -if ! grep -iq nomodules /proc/cmdline 2>/dev/null && [ -f /proc/ksyms ]; then +if ! LC_ALL=C grep -iq nomodules /proc/cmdline 2>/dev/null && [ -f /proc/ksyms ]; then USEMODULES=y fi @@ -357,9 +359,9 @@ fi rm -f /lib/modules/preferred /lib/modules/default if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then # If they aren't using a recent sane kernel, make a link for them - if [ ! -n "`uname -r | grep -- "-"`" ]; then + if [ ! -n "`uname -r | LC_ALL=C grep -- "-"`" ]; then ktag="`cat /proc/version`" - mtag=`grep -l "$ktag" /lib/modules/*/.rhkmvtag 2> /dev/null` + mtag=`LC_ALL=C grep -l "$ktag" /lib/modules/*/.rhkmvtag 2> /dev/null` if [ -n "$mtag" ]; then mver=`echo $mtag | sed -e 's,/lib/modules/,,' -e 's,/.rhkmvtag,,' -e 's,[ ].*$,,'` fi @@ -380,7 +382,7 @@ if [ -n "$PNP" -a -f /proc/isapnp -a -x /sbin/sndconfig ]; then fi # Load sound modules if and only if they need persistent DMA buffers -if grep -q "options sound dmabuf=1" /etc/modules.conf 2>/dev/null ; then +if LC_ALL=C grep -q "options sound dmabuf=1" /etc/modules.conf 2>/dev/null ; then RETURN=0 alias=`/sbin/modprobe -c | awk '/^alias sound / { print $3 }'` if [ -n "$alias" -a "$alias" != "off" ]; then @@ -423,7 +425,7 @@ if [ -f /etc/raidtab -a -f /proc/mdstat ]; then for i in `awk '{if ($1=="raiddev") print $2}' /etc/raidtab` do RAIDDEV=`basename $i` - RAIDSTAT=`grep "^$RAIDDEV : active" /proc/mdstat` + RAIDSTAT=`LC_ALL=C grep "^$RAIDDEV : active" /proc/mdstat` if [ -z "$RAIDSTAT" ]; then # First scan the /etc/fstab for the "noauto"-flag # for this device. If found, skip the initialization @@ -437,7 +439,7 @@ if [ -f /etc/raidtab -a -f /proc/mdstat ]; then RESULT=0 RAIDDEV="$RAIDDEV(skipped)" fi - NOAUTO=`grep "^$i" /etc/fstab | grep -c "noauto"` + NOAUTO=`LC_ALL=C grep "^$i" /etc/fstab | LC_ALL=C grep -c "noauto"` if [ $NOAUTO -gt 0 ]; then RESULT=0 RAIDDEV="$RAIDDEV(skipped)" @@ -657,8 +659,8 @@ fi # If a SCSI tape has been detected, load the st module unconditionally # since many SCSI tapes don't deal well with st being loaded and unloaded -if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then - if grep -qv ' 9 st' /proc/devices && [ -n "$USEMODULES" ]; then +if [ -f /proc/scsi/scsi ] && LC_ALL=C grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then + if LC_ALL=C grep -qv ' 9 st' /proc/devices && [ -n "$USEMODULES" ]; then modprobe st >/dev/null 2>&1 fi fi @@ -669,18 +671,18 @@ if [ -n "$needusbstorage" ]; then fi # Ooh, firewire too. -if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then +if ! LC_ALL=C grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then aliases=`/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }'` if [ -n "$aliases" -a "$aliases" != "off" ]; then for alias in $aliases ; do [ "$alias" != "off" ] && action $"Initializing firewire controller ($alias): " modprobe $alias done - grep -q "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe sbp2 >/dev/null 2>&1 + LC_ALL=C grep -q "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe sbp2 >/dev/null 2>&1 fi fi # If they asked for ide-scsi, load it -if grep -q "ide-scsi" /proc/cmdline ; then +if LC_ALL=C grep -q "ide-scsi" /proc/cmdline ; then modprobe ide-cd >/dev/null 2>&1 modprobe ide-scsi >/dev/null 2>&1 fi @@ -738,7 +740,7 @@ if [ -x /sbin/hdparm ]; then fi # Boot time profiles. Yes, this should be somewhere else. -if grep -q "netprofile=" /proc/cmdline ; then +if LC_ALL=C grep -q "netprofile=" /proc/cmdline ; then cmdline=`cat /proc/cmdline` for arg in $cmdline ; do if [ "${arg##netprofile=}" != "${arg}" ]; then -- cgit v1.2.1