From 4344a5bcba4bde031a05573d024040d9dfdeac85 Mon Sep 17 00:00:00 2001
From: An-Cheng Huang <ancheng@vyatta.com>
Date: Mon, 23 May 2011 08:41:25 -0700
Subject: don't assume hw-id exists since it can be deleted

---
 templates/interfaces/ethernet/node.def | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'templates/interfaces/ethernet/node.def')

diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
index 0b55de8a..a9113e7a 100644
--- a/templates/interfaces/ethernet/node.def
+++ b/templates/interfaces/ethernet/node.def
@@ -15,12 +15,14 @@ syntax:expression: exec \
 
 begin: rm -f /tmp/speed-duplex.$VAR(@)
        if [ -d "/sys/class/net/$VAR(@)" ]; then
-         # assume hw-id always exists (as orig impl did)
          s_mac="$VAR(hw-id/@)"
          if [ -n "$VAR(mac/@)" ]; then
            s_mac="$VAR(mac/@)"
          fi
-         /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(@) --set-mac $s_mac
+         if [ -n "$s_mac" ]; then
+           /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(@) \
+             --set-mac $s_mac
+         fi
        fi
 
 create: ip link set "$VAR(@)" up
-- 
cgit v1.2.3

