From 9f56e4372836458a27cd655254aff904fdaa44ba Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Mon, 1 May 2000 17:17:25 +0000 Subject: Fix setting of hostname. --- client/scripts/bsdos | 12 +++++++++++- client/scripts/freebsd | 8 +++++--- client/scripts/linux | 4 +++- client/scripts/netbsd | 5 +++-- client/scripts/nextstep | 15 +++++++++++++-- client/scripts/openbsd | 12 +++++++++++- client/scripts/solaris | 9 +++++++++ 7 files changed, 55 insertions(+), 10 deletions(-) (limited to 'client/scripts') diff --git a/client/scripts/bsdos b/client/scripts/bsdos index d9e44b40..e6d0e2a0 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 b3b73977..a095c12f 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 fc2756e5..603fff5b 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 d47841e2..bb8ffb8c 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 15623a38..1c8c2a26 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 d9e44b40..e6d0e2a0 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 d60feeac..12a344c6 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 -- cgit v1.2.1