aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2007-01-17 18:40:52 +0000
committerBill Nottingham <notting@redhat.com>2007-01-17 18:40:52 +0000
commite545907efa20f665879b0a700f0f5867dbb30b1f (patch)
treee7122a8e9bb773d507daa09cd1251a9a1ee005ab /sysconfig
parent9502830f4bdaaebf1a5721d4bd6195404cbf396d (diff)
downloadinitscripts-e545907efa20f665879b0a700f0f5867dbb30b1f.tar
initscripts-e545907efa20f665879b0a700f0f5867dbb30b1f.tar.gz
initscripts-e545907efa20f665879b0a700f0f5867dbb30b1f.tar.bz2
initscripts-e545907efa20f665879b0a700f0f5867dbb30b1f.tar.xz
initscripts-e545907efa20f665879b0a700f0f5867dbb30b1f.zip
fix logic thinko that can trip up when lookup fails (#220318)
also, clean up ifconfig usage
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifup-post7
1 files changed, 3 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 6fc0753f..28880806 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -85,10 +85,9 @@ if [ "$2" = "boot" -a \
"${DEVICETYPE}" != "ppp" -a \
"${DEVICETYPE}" != "slip" ]; then
if need_hostname; then
- IPADDR=`LANG= LC_ALL= ifconfig ${DEVICE} | grep 'inet addr' |
- awk -F: '{ print $2 } ' | awk '{ print $1 }'`
- eval `/bin/ipcalc --silent --hostname ${IPADDR}`
- if [ "$?" = "0" ]; then
+ IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 }')
+ eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?")
+ if [ "$status" = "0" ]; then
set_hostname $HOSTNAME
fi
fi