get ip addr with getent

Build kdump image will fail when kdump.conf has net option with a host name
instead of ip address.

Handle this just as what we do in rhel6: use getent to get the ip addr.

Signed-off-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Dave Young 2012-03-29 14:56:06 +08:00 committed by Cong Wang
parent 726d9319cb
commit 985fcae6ec
1 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,9 @@ install() {
_server=$(echo $config_val | sed -e 's#\(.*\):.*#\1#')
fi
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n $need_dns ] && _server=`getent hosts $_server|cut -d' ' -f1`
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
#the field in the ip output changes if we go to another subnet