2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 15:56:00 +00:00

Fix setting of hostname.

This commit is contained in:
Ted Lemon
2000-05-01 17:17:25 +00:00
parent 134ceef89f
commit 9f56e43728
7 changed files with 55 additions and 10 deletions

View File

@@ -72,12 +72,22 @@ fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
current_hostname=`hostname`
if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then
if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name
fi
fi
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then [ x$alias_ip_address != x$old_ip_address ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
then
ifconfig $interface inet -alias $old_ip_address $medium ifconfig $interface inet -alias $old_ip_address $medium
route delete $old_ip_address 127.1 >/dev/null 2>&1 route delete $old_ip_address 127.1 >/dev/null 2>&1
for router in $old_routers; do for router in $old_routers; do

View File

@@ -72,10 +72,11 @@ fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
current_hostname=`/bin/hostname` current_hostname=`hostname`
if [ x$current_hostname = x ] || \ if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then [ x$current_hostname = x$old_host_name ]; then
if [ x$new_host_name != x$old_host_name ]; then if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name hostname $new_host_name
fi fi
fi fi
@@ -84,7 +85,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
then
ifconfig $interface inet -alias $old_ip_address $medium ifconfig $interface inet -alias $old_ip_address $medium
route delete $old_ip_address 127.1 >/dev/null 2>&1 route delete $old_ip_address 127.1 >/dev/null 2>&1
for router in $old_routers; do for router in $old_routers; do

View File

@@ -99,10 +99,12 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
current_hostname=`hostname` current_hostname=`hostname`
if [ x$current_hostname = x ] || \ if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then [ x$current_hostname = x$old_host_name ]; then
if [ x$new_host_name != x$old_host_name ]; then if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name hostname $new_host_name
fi fi
fi fi
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then [ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias. # Possible new alias. Remove old alias.

View File

@@ -72,10 +72,11 @@ fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
current_hostname=`/bin/hostname` current_hostname=`hostname`
if [ x$current_hostname = x ] || \ if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then [ x$current_hostname = x$old_host_name ]; then
if [ x$new_host_name != x$old_host_name ]; then if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name hostname $new_host_name
fi fi
fi fi

View File

@@ -13,8 +13,19 @@ if [ x$reason = xPREINIT ]; then
fi fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then current_hostname=`hostname`
ifconfig $interface $new_ip_address netmask $new_subnet_mask >/dev/null 2>&1 if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then
if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name
fi
fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
then
ifconfig $interface $new_ip_address netmask $new_subnet_mask \
>/dev/null 2>&1
route add $new_ip_address 127.1 0 >/dev/null 2>&1 route add $new_ip_address 127.1 0 >/dev/null 2>&1
for router in $new_routers ; do for router in $new_routers ; do
route add default $router 1 >/dev/null 2>&1 route add default $router 1 >/dev/null 2>&1

View File

@@ -72,12 +72,22 @@ fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
current_hostname=`hostname`
if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then
if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name
fi
fi
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then [ x$alias_ip_address != x$old_ip_address ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
then
ifconfig $interface inet -alias $old_ip_address $medium ifconfig $interface inet -alias $old_ip_address $medium
route delete $old_ip_address 127.1 >/dev/null 2>&1 route delete $old_ip_address 127.1 >/dev/null 2>&1
for router in $old_routers; do for router in $old_routers; do

View File

@@ -81,6 +81,15 @@ fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
current_hostname=`hostname`
if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then
if [ x$current_hostname = x ] || \
[ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name
fi
fi
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then [ x$alias_ip_address != x$old_ip_address ]; then
$ifconfig ${interface}:1 inet 0 down > /dev/null 2>&1 $ifconfig ${interface}:1 inet 0 down > /dev/null 2>&1