From 1636b11e4b95b9822a0c35129802ca182e5a7895 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 12 Mar 2015 07:02:35 -0700 Subject: [PATCH] fix defect #4595 [FVT]:CN ip is not correctly configured on sles11.3 when installnic and primarynic is blank --- xCAT-server/share/xcat/install/scripts/chroot.sles | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/chroot.sles b/xCAT-server/share/xcat/install/scripts/chroot.sles index 7698db4e8..cf22e985a 100644 --- a/xCAT-server/share/xcat/install/scripts/chroot.sles +++ b/xCAT-server/share/xcat/install/scripts/chroot.sles @@ -46,7 +46,15 @@ if [ -z "$PRINIC" ] then for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do if [ "${karg%%=*}" = "BOOTIF" ]; then - export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'` + #export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'` + export PRINIC=${karg#*=01:} + export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://` + fi + if [ "${karg%%=*}" = "netdevice" ]; then + export PRINIC="${karg#*=}"; + if [ "${#PRINIC}" = "20" ]; then + export PRINIC=${PRINIC:3:21} + fi fi done if [ -z "$PRINIC" ]; then @@ -57,7 +65,8 @@ if [ -z "$PRINIC" ] then export PRINIC=eth0 elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then - export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + #export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://` fi echo 'export PRINIC='"$PRINIC" > /mnt/tmp/prinicsetting ]]>