SVN: rc-scripts/trunk/sysconfig/network-scripts/functions.network

arekm arekm at pld-linux.org
Wed Oct 3 15:10:23 CEST 2007


Author: arekm
Date: Wed Oct  3 15:10:23 2007
New Revision: 8771

Modified:
   rc-scripts/trunk/sysconfig/network-scripts/functions.network
Log:
Do sanity check only when configuration file exists.

Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network	Wed Oct  3 15:10:23 2007
@@ -7,6 +7,8 @@
 
 source_config ()
 {
+	typeset foundconfig=0
+
 	DEVNAME=${CONFIG##*/}
 	DEVNAME=${DEVNAME##ifcfg-}
 	DEVNAME=${DEVNAME##tnlcfg-}
@@ -14,15 +16,18 @@
 	if [[ "$CONFIG" = /* ]]; then
 		if [ -f "$CONFIG" ] ; then
 			. "$CONFIG"
+			foundconfig=1
 		fi
 	elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ] ; then
 		. "/etc/sysconfig/interfaces/$CONFIG"
+		foundconfig=1
 	fi
 
 	# This is sanity check so that if you've copied ifcfg-eth0 to ifcfg-eth1
 	# and forgot to alter DEVICE= line you won't accidentally bring down eth0
-	# while executing ifdown eth1.
-	if [ -n "$DEVICE" -a  "$DEVNAME" != "$DEVICE" ]; then
+	# while executing ifdown eth1. We do that only if configuration file exists
+	# (sometimes ifcfg-xyz isn't needed at all like server-side pppoe pppX interfaces)
+	if [ "$foundconfig" -eq "1" -a -n "$DEVICE" -a  "$DEVNAME" != "$DEVICE" ]; then
 		echo >&2 "$0: DEVICE specified in $CONFIG does not match filename. Aborting!"
 		exit 1
 	fi


More information about the pld-cvs-commit mailing list