aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-post
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1998-03-10 15:51:16 +0000
committerErik Troan <ewt@redhat.com>1998-03-10 15:51:16 +0000
commit54a18ea25de3965e7ae907c3238569eb01803bf1 (patch)
treef7406baec5ce06d0a15382b0504c860256721fc7 /sysconfig/network-scripts/ifup-post
parentfb0f2343a9f5f284e7b75adf60fa33f50181b3fb (diff)
downloadinitscripts-54a18ea25de3965e7ae907c3238569eb01803bf1.tar
initscripts-54a18ea25de3965e7ae907c3238569eb01803bf1.tar.gz
initscripts-54a18ea25de3965e7ae907c3238569eb01803bf1.tar.bz2
initscripts-54a18ea25de3965e7ae907c3238569eb01803bf1.tar.xz
initscripts-54a18ea25de3965e7ae907c3238569eb01803bf1.zip
1) added need_hostname and set_hostname functions
2) changed hostname lookup to use ipcalc
Diffstat (limited to 'sysconfig/network-scripts/ifup-post')
-rwxr-xr-xsysconfig/network-scripts/ifup-post12
1 files changed, 5 insertions, 7 deletions
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 6a57d866..35c9a6d2 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -5,6 +5,7 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
. network-functions
+need_hostname
source_config
DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`
@@ -25,13 +26,10 @@ if [ "$ISALIAS" = no ] ; then
unset allow_null_glob_expansion
fi
-if [ `hostname` = '(none)' -o `hostname` = localhost -a ${DEVICE} != lo ]; then
- IPADDR=`ifconfig ${DEVICE} | grep 'inet addr' | awk -F: '{ print $2 } ' | awk '{ print $1 }'`
- host=`host ${IPADDR} | grep Name: | awk '{ print $2 }'`
- if [ -n "$host" ]; then
- echo "$host" > /etc/HOSTNAME
- hostname $host
- fi
+if [ -n "$NEEDHOSTNAME" -a ${DEVICE} != lo ]; then
+ IPADDR=`ifconfig ${DEVICE} | grep 'inet addr' |
+ awk -F: '{ print $2 } ' | awk '{ print $1 }'`
+ eval `/sbin/ipcalc --silent --hostname ${IPADDR}` && set_hostname $HOSTNAME
fi
# Notify programs that have requested notification