replace ifconfig with ip
This commit is contained in:
parent
5c278f3396
commit
5dd913d220
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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%%:??:??:??}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user