From 231dbd84f5affd0d940ffd87c7ee4c4b8b81ff16 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 14 May 2014 08:03:35 -0400 Subject: [PATCH] use ip command to replace ifconfig in xcatroot for diskless on rh3 --- .../share/xcat/netboot/rh/dracut_033/xcatroot | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 4cde3f1ca..feed0dcd3 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -218,6 +218,25 @@ else fi cd / +function getdevfrommac() { + boothwaddr=$1 + ip link show | while read line + do + dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1` + if [ "X$dev" != "X" ]; then + devname=$dev + fi + + if [ "X$devname" != "X" ]; then + hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'` + if [ "X$hwaddr" = "X$boothwaddr" ]; then + echo $devname + fi + fi + done +} + + if [ -z $STATEMNT ]; then for lf in /tmp/dhclient.*.lease; do netif=${lf#*.} @@ -233,7 +252,7 @@ if [ -z $STATEMNT ]; then MACX=`ip link show $netdev | grep ether | awk '{print $2}'` elif [ ! -z "$BOOTIF" ]; then MACX=$BOOTIF - ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + ETHX=$(getdevfrommac $BOOTIF) fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then