aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-04-10 19:57:37 +0100
committerColin Guthrie <colin@mageia.org>2012-04-10 19:57:37 +0100
commited4b0ecc3087b2f509077075b24fb942a5834ca1 (patch)
tree6cad841c32cb15f7709742ed5b3f2a33895f3d15
parentf27c7d383b1e8c5a95fa797c925e8cc5d6a46275 (diff)
downloadinitscripts-ed4b0ecc3087b2f509077075b24fb942a5834ca1.tar
initscripts-ed4b0ecc3087b2f509077075b24fb942a5834ca1.tar.gz
initscripts-ed4b0ecc3087b2f509077075b24fb942a5834ca1.tar.bz2
initscripts-ed4b0ecc3087b2f509077075b24fb942a5834ca1.tar.xz
initscripts-ed4b0ecc3087b2f509077075b24fb942a5834ca1.zip
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.
-rwxr-xr-xmandriva/network-up39
-rwxr-xr-xrc.d/init.d/network21
2 files changed, 31 insertions, 29 deletions
diff --git a/mandriva/network-up b/mandriva/network-up
index 1a1d338b..a4d8e9b8 100755
--- a/mandriva/network-up
+++ b/mandriva/network-up
@@ -33,12 +33,13 @@ cd /etc/sysconfig/network-scripts
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
-interfaces=$(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]/ &/}' | \
- LC_ALL=C sort -k 1,1 -k 2n | \
- LC_ALL=C sed 's/ //')
+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]/ &/}' | \
+ LC_ALL=C grep -v '^ifcfg-' | \
+ LC_ALL=C sort -k 1,1 -k 2n | \
+ LC_ALL=C sed -e 's/ \([0-9]\)/\1/')
function may_have_link() {
local DEVICE=$1
@@ -58,17 +59,17 @@ function should_wait_network() {
unset DEVICE TYPE BOOTPROTO MII_NOT_SUPPORTED PEERDNS DNS1 DNS2
unset REALDEVICE PARENTDEVICE NM_CONTROLLED
LINK_DETECTION_DELAY=$DEFAULT_LINK_DETECTION_DELAY
- eval $(LANG=C fgrep "DEVICE=" ifcfg-$i)
- eval $(LANG=C fgrep "REALDEVICE=" ifcfg-$i)
- eval $(LANG=C fgrep "PARENTDEVICE=" ifcfg-$i)
- eval $(LANG=C fgrep "TYPE=" ifcfg-$i)
- eval $(LANG=C fgrep "BOOTPROTO=" ifcfg-$i)
- eval $(LANG=C fgrep "MII_NOT_SUPPORTED=" ifcfg-$i)
- eval $(LANG=C fgrep "LINK_DETECTION_DELAY=" ifcfg-$i)
- eval $(LANG=C fgrep "PEERDNS=" ifcfg-$i)
- eval $(LANG=C fgrep "DNS1=" ifcfg-$i)
- eval $(LANG=C fgrep "DNS2=" ifcfg-$i)
- eval $(LANG=C fgrep "NM_CONTROLLED=" ifcfg-$i)
+ eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i")
+ eval $(LANG=C grep -F "REALDEVICE=" "ifcfg-$i")
+ eval $(LANG=C grep -F "PARENTDEVICE=" "ifcfg-$i")
+ eval $(LANG=C grep -F "TYPE=" "ifcfg-$i")
+ eval $(LANG=C grep -F "BOOTPROTO=" "ifcfg-$i")
+ eval $(LANG=C grep -F "MII_NOT_SUPPORTED=" "ifcfg-$i")
+ eval $(LANG=C grep -F "LINK_DETECTION_DELAY=" "ifcfg-$i")
+ eval $(LANG=C grep -F "PEERDNS=" "ifcfg-$i")
+ eval $(LANG=C grep -F "DNS1=" "ifcfg-$i")
+ eval $(LANG=C grep -F "DNS2=" "ifcfg-$i")
+ eval $(LANG=C grep -F "NM_CONTROLLED=" "ifcfg-$i")
[ -z "$REALDEVICE" -a -n "$PARENTDEVICE" ] && REALDEVICE=$PARENTDEVICE
[ -z "$REALDEVICE" ] && REALDEVICE=${DEVICE%%:*}
if [ $LINK_DETECTION_DELAY -lt $MIN_LINK_DETECTION_DELAY ]; then
@@ -94,7 +95,7 @@ function should_wait_network() {
fi
# only check interfaces automatically launched
- if LANG=C egrep -q "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i; then
+ if LANG=C grep -q -E "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i"; then
continue
fi
@@ -165,7 +166,7 @@ case "$1" in
for i in $interfaces; do
LINK_DETECTION_DELAY=$DEFAULT_LINK_DETECTION_DELAY
- eval $(LANG=C fgrep "LINK_DETECTION_DELAY=" ifcfg-$i)
+ eval $(LANG=C grep -F "LINK_DETECTION_DELAY=" "ifcfg-$i")
if [ "$LINK_DETECTION_DELAY" -gt $MAX_LINK_DETECTION_DELAY ]; then
MAX_LINK_DETECTION_DELAY=$LINK_DETECTION_DELAY
fi
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