diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 72a1f4ba9..e18f532a5 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -236,7 +236,8 @@ 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=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index ce7baeb96..8c4ced961 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1154,7 +1154,8 @@ for i in `cat /proc/cmdline`; do NETDEV=`echo \$i |awk -F= '{print \$2}'` elif [ "\$KEY" == 'BOOTIF' ]; then VALUE=`echo \$i |awk -F= '{print \$2}'|sed -e s/^01-// -e s/-/:/g` - BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'` + #BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'` + BOOTIF=\`ip -oneline link show |grep -i \$VALUE|awk -F ':' '{print \$2}'|grep -o \"[^ ]\+\( \+[^ ]\+\)*\"\` elif [ "\$KEY" == 'XCAT' ]; then VALUE=`echo \$i |awk -F= '{print \$2}'` # format: XCAT=xcatmaster:3001 diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index b02abe09f..894a86a1c 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -166,7 +166,8 @@ 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=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then diff --git a/xCAT-server/share/xcat/scripts/genduiduuid.sh b/xCAT-server/share/xcat/scripts/genduiduuid.sh index 1cfa20dfa..e9bf49317 100644 --- a/xCAT-server/share/xcat/scripts/genduiduuid.sh +++ b/xCAT-server/share/xcat/scripts/genduiduuid.sh @@ -13,7 +13,8 @@ if [ -r /sys/devices/virtual/dmi/id/product_uuid ]; then duid=$duid$octnum done duid=$duid'";' - for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do + #for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do + for interface in `ip -4 -oneline link show|grep -i ether |awk -F ":" '{print $2}'| grep -o "[^ ]\+\( \+[^ ]\+\)*"`; do echo $duid > /var/lib/dhclient/dhclient6-$interface.leases done echo $duid > /var/lib/dhclient/dhclient6.leases diff --git a/xCAT-server/share/xcat/scripts/genula.sh b/xCAT-server/share/xcat/scripts/genula.sh index 74103ab57..ac8220d77 100644 --- a/xCAT-server/share/xcat/scripts/genula.sh +++ b/xCAT-server/share/xcat/scripts/genula.sh @@ -20,7 +20,8 @@ TIMESTAMP=$(printf "%08X:%08X" $SECONDS $NTPTICKS) #next, get a mac address and convert to eui64 EUIPAD="FF:FE" -MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}') +#MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}') +MAC=$(ip -oneline link show|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|sed -ne "s/.*link\/ether //p"|awk -F ' ' '{print $1}') FIRSTBYTE=${MAC%%:*} FIRSTBYTE=$(printf %02X $((0x$FIRSTBYTE|2))) OTHERMANUF=${MAC%%:??:??:??} diff --git a/xCAT-server/share/xcat/scripts/xHRM b/xCAT-server/share/xcat/scripts/xHRM index 470893c00..d184130b4 100755 --- a/xCAT-server/share/xcat/scripts/xHRM +++ b/xCAT-server/share/xcat/scripts/xHRM @@ -7,13 +7,15 @@ function get_def_interface { #we are, however, presuming ipv4 for the moment retval=$(ping -c 1 `hostname`|head -n 1|cut -d\( -f 2|cut -d\) -f 1) if [ -z "$retval" -o "127.0.0.1" = "$retval" ]; then #ok, that didn't pan out, now we grab the first address that looks sane - retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1` + #retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1` + retval=`ip -4 -oneline addr show|grep -v "127.0.0.1"|grep -v '169.254'|head -n 1|awk -F 'inet ' '{print $2}'|awk -F '/' '{print $1}'` fi if [ -z "$retval" ]; then echo "ERROR: Unable to reasonably guess the 'default' interface" >&2 exit 1 fi - iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'` + #iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'` + iface=`ip -4 -oneline addr show|grep -i $retval|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` if [ -z "$iface" ]; then echo "ERROR: Unable to reasonably guess the default interface" >&2 exit 1 @@ -118,7 +120,8 @@ elif [ "bridgeprereq" = "$1" ]; then # get the port for installation if [ -n "$INSTALLNIC" ]; then if [[ "$INSTALLNIC" = mac ]] || [[ "$INSTALLNIC" = MAC ]]; then - INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'` + #INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'` + INSPORT=`ip -oneline link show|grep -i ether|grep -i $MACADDRESS|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` else INSPORT=$INSTALLNIC fi