[projects/rc-scripts] If an iface type is specified NEVER override it

mmazur mmazur at pld-linux.org
Tue Feb 10 15:34:13 CET 2015


commit 91b0c353706fec3118c4fc0fd688e40c35259c0e
Author: Mariusz Mazur <mmazur at axeos.com>
Date:   Tue Feb 10 15:33:47 2015 +0100

    If an iface type is specified NEVER override it

 lib/functions.network | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/lib/functions.network b/lib/functions.network
index f873086..0543059 100644
--- a/lib/functions.network
+++ b/lib/functions.network
@@ -182,13 +182,14 @@ setup_ip_param ()
 {
 	# detect network device type (ie. dummy, eth for dummy0, eth0 ..)
 	if [ -z "$DEVICETYPE" ]; then
-		DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ')
+		# If there's a dot, it's a vlan
+		if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then
+			DEVICETYPE=vlan
+		else
+			DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ')
+		fi
 	fi
 
-	# Setup DEVICETYPE for special cases.
-	if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then
-		DEVICETYPE=vlan
-	fi
 
 	# real name of device (ie. is eth0 for eth0,eth0:1,eth0:alias)
 	SUBDEVICE=$(echo "$DEVICE" | grep -E "([0-9]+:[0-9]+)")
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/91b0c353706fec3118c4fc0fd688e40c35259c0e



More information about the pld-cvs-commit mailing list