diff options
author | Bill Nottingham <notting@redhat.com> | 2001-08-07 06:48:29 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2001-08-07 06:48:29 +0000 |
commit | 644a0180b7e35b3286616517ca589c9bd5608c81 (patch) | |
tree | 4aca889e63ebc7237519b9d9cc73ce48ffdb847e | |
parent | d34451922aebdabfc5495b174ad960b0a0188304 (diff) | |
download | initscripts-644a0180b7e35b3286616517ca589c9bd5608c81.tar initscripts-644a0180b7e35b3286616517ca589c9bd5608c81.tar.gz initscripts-644a0180b7e35b3286616517ca589c9bd5608c81.tar.bz2 initscripts-644a0180b7e35b3286616517ca589c9bd5608c81.tar.xz initscripts-644a0180b7e35b3286616517ca589c9bd5608c81.zip |
use awk, not grep & other cruft (#49616)
exit happily if ifup is called on a device that doesn't exist and has
no alias (fixes all those nasty PCMCIA onboot complaints)
-rw-r--r-- | po/initscripts.pot | 2 | ||||
-rwxr-xr-x | rc.d/init.d/network | 2 | ||||
-rwxr-xr-x | rc.d/rc.sysinit | 8 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 12 |
4 files changed, 14 insertions, 10 deletions
diff --git a/po/initscripts.pot b/po/initscripts.pot index 4d63e1e8..196c0fde 100644 --- a/po/initscripts.pot +++ b/po/initscripts.pot @@ -145,7 +145,7 @@ msgid "error in $FILE: IPADDR_START and IPADDR_END don't argree" msgstr "" #: /etc/sysconfig/network-scripts/ifup:88 -msgid "Device does not seem to be present, delaying ${DEVICE} initialization." +msgid "$alias device does not seem to be present, delaying ${DEVICE} initialization." msgstr "" #: /etc/rc.d/init.d/netfs:148 diff --git a/rc.d/init.d/network b/rc.d/init.d/network index b1983871..7ab4ec75 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -31,7 +31,7 @@ fi # If IPv6 is explicitly configured, make sure it's available. if [ "$NETWORKING_IPV6" = "yes" ]; then - alias=`modprobe -c | grep net-pf-10 | awk '{ print $3 }'` + alias=`modprobe -c | awk '/^alias net-pf-10 / { print $3 }'` if [ "$alias" != "ipv6" -a ! -f /proc/net/if_inet6 ]; then echo "alias net-pf-10 ipv6" >> /etc/modules.conf fi diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 6b134798..6006907d 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -160,12 +160,12 @@ 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 - aliases=`/sbin/modprobe -c | egrep -s "^alias[[:space:]]+usb-controller" | awk '{ print $3 }'` + aliases=`/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }'` if [ -n "$aliases" -a "$aliases" != "off" ] ; then modprobe usbcore action $"Mounting USB filesystem: " mount -t usbdevfs usbdevfs /proc/bus/usb for alias in $aliases ; do - action $"Initializing USB controller ($alias): " modprobe $alias + [ "$alias" != "off" ] && action $"Initializing USB controller ($alias): " modprobe $alias done [ $? -eq 0 -a -n "$aliases" ] && usb=1 fi @@ -403,12 +403,12 @@ fi # Load sound modules iff they need persistent DMA buffers if grep -q "options sound dmabuf=1" /etc/modules.conf 2>/dev/null ; then RETURN=0 - alias=`/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" | awk '{ print $3 }'` + alias=`/sbin/modprobe -c | awk '/^alias sound / { print $3 }'` if [ -n "$alias" -a "$alias" != "off" ] ; then action $"Loading sound module ($alias): " modprobe $alias RETURN=$? fi - alias=`/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" | awk '{ print $3 }'` + alias=`/sbin/modprobe -c | awk '/^alias sound-slot-0 / { print $3 }'` if [ -n "$alias" -a "$alias" != "off" ] ; then action $"Loading sound module ($alias): " modprobe $alias RETURN=$? diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index de25961d..7bc43c4c 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -50,11 +50,11 @@ source_config if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] then - exit + exit 0 fi if [ -n "$IN_HOTPLUG" -a "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ] then - exit + exit 0 fi # figure out more about what we are dealing with @@ -88,8 +88,12 @@ fi # is this device available? (this catches PCMCIA devices for us) LC_ALL= LANG= ip -o link | grep -q ${REALDEVICE} if [ "$?" = "1" ]; then - LC_ALL=C modprobe -c | grep -q ${REALDEVICE} && modprobe ${REALDEVICE} || { - echo $"Device does not seem to be present, delaying ${DEVICE} initialization." + alias=`modprobe -c | awk "/^alias ${REALDEVICE} / { print \\$3 }"` + if [ -z "$alias" -o "$alias" = "off" ]; then + exit 0 + fi + modprobe $alias || { + echo $"$alias device does not seem to be present, delaying ${DEVICE} initialization." exit 1 } fi |