From ed4b0ecc3087b2f509077075b24fb942a5834ca1 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 10 Apr 2012 19:57:37 +0100 Subject: network: Deal with ifcfg-* file that have spaces in them. This can happen on the ifcfg-Auto* files created by NM. It may be more sensible overall to just skip such files, but incase any other invalid files are found, they are now simply skipped to avoid errors. --- rc.d/init.d/network | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'rc.d/init.d/network') diff --git a/rc.d/init.d/network b/rc.d/init.d/network index b7d521c9..e9d22dd7 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -51,9 +51,10 @@ cd /etc/sysconfig/network-scripts interfaces=$(/bin/ls ifcfg* | \ LC_ALL=C sed -e "$__sed_discard_ignored_files" \ -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \ - -e '/ifcfg-[A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \ + -e '/ifcfg-[ A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \ + LC_ALL=C grep -v '^ifcfg-' | \ LC_ALL=C sort -k 1,1 -k 2n | \ - LC_ALL=C sed 's/ //') + LC_ALL=C sed -e 's/ \([0-9]\)/\1/') rc=0 # See how we were called. @@ -126,9 +127,9 @@ case "$1" in # bring up all other interfaces configured to come up at boot time for i in $interfaces; do unset DEVICE TYPE SLAVE - eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) - eval $(LANG=C grep -F "TYPE=" ifcfg-$i) - eval $(LANG=C grep -F "SLAVE=" ifcfg-$i) + eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i") + eval $(LANG=C grep -F "TYPE=" "ifcfg-$i") + eval $(LANG=C grep -F "SLAVE=" "ifcfg-$i") if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi @@ -162,7 +163,7 @@ case "$1" in continue fi - if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then + if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i" > /dev/null ; then # this loads the module, to preserve ordering is_available $i continue @@ -189,7 +190,7 @@ case "$1" in # Bring up xDSL and VPN interfaces for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do - if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then + if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i" >/dev/null 2>&1 ; then # If we're in confirmation mode, get user confirmation. if [ -f /var/run/confirm ]; then confirm $i @@ -248,8 +249,8 @@ case "$1" in # get list of bonding, vpn, and xdsl interfaces for i in $interfaces; do unset DEVICE TYPE - eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) - eval $(LANG=C grep -F "TYPE=" ifcfg-$i) + eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i") + eval $(LANG=C grep -F "TYPE=" "ifcfg-$i") if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi @@ -282,7 +283,7 @@ case "$1" in done for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do - (. ./ifcfg-$i + (. "./ifcfg-$i" if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi if ! check_device_down $DEVICE; then -- cgit v1.2.1