From: Ted Lemon Date: Mon, 1 May 2000 17:17:25 +0000 (+0000) Subject: Fix setting of hostname. X-Git-Tag: V3-BETA-2-PATCH-1~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f56e4372836458a27cd655254aff904fdaa44ba;p=thirdparty%2Fdhcp.git Fix setting of hostname. --- diff --git a/client/scripts/bsdos b/client/scripts/bsdos index d9e44b40d..e6d0e2a0a 100755 --- a/client/scripts/bsdos +++ b/client/scripts/bsdos @@ -72,12 +72,22 @@ fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ 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 ] && \ [ x$alias_ip_address != x$old_ip_address ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 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 route delete $old_ip_address 127.1 >/dev/null 2>&1 for router in $old_routers; do diff --git a/client/scripts/freebsd b/client/scripts/freebsd index b3b739772..a095c12fa 100755 --- a/client/scripts/freebsd +++ b/client/scripts/freebsd @@ -72,10 +72,11 @@ fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - current_hostname=`/bin/hostname` + current_hostname=`hostname` if [ x$current_hostname = x ] || \ [ 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 fi fi @@ -84,7 +85,8 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 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 route delete $old_ip_address 127.1 >/dev/null 2>&1 for router in $old_routers; do diff --git a/client/scripts/linux b/client/scripts/linux index fc2756e5a..603fff5b3 100755 --- a/client/scripts/linux +++ b/client/scripts/linux @@ -99,10 +99,12 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ current_hostname=`hostname` if [ x$current_hostname = x ] || \ [ 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 fi fi + if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ [ x$alias_ip_address != x$old_ip_address ]; then # Possible new alias. Remove old alias. diff --git a/client/scripts/netbsd b/client/scripts/netbsd index d47841e2c..bb8ffb8c4 100755 --- a/client/scripts/netbsd +++ b/client/scripts/netbsd @@ -72,10 +72,11 @@ fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - current_hostname=`/bin/hostname` + current_hostname=`hostname` if [ x$current_hostname = x ] || \ [ 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 fi fi diff --git a/client/scripts/nextstep b/client/scripts/nextstep index 15623a38e..1c8c2a266 100644 --- a/client/scripts/nextstep +++ b/client/scripts/nextstep @@ -13,8 +13,19 @@ if [ x$reason = xPREINIT ]; then fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - 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 + 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$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 for router in $new_routers ; do route add default $router 1 >/dev/null 2>&1 diff --git a/client/scripts/openbsd b/client/scripts/openbsd index d9e44b40d..e6d0e2a0a 100644 --- a/client/scripts/openbsd +++ b/client/scripts/openbsd @@ -72,12 +72,22 @@ fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ 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 ] && \ [ x$alias_ip_address != x$old_ip_address ]; then ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 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 route delete $old_ip_address 127.1 >/dev/null 2>&1 for router in $old_routers; do diff --git a/client/scripts/solaris b/client/scripts/solaris index d60feeac9..12a344c6f 100755 --- a/client/scripts/solaris +++ b/client/scripts/solaris @@ -81,6 +81,15 @@ fi if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ [ 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 ] && \ [ x$alias_ip_address != x$old_ip_address ]; then $ifconfig ${interface}:1 inet 0 down > /dev/null 2>&1