]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Fix setting of hostname.
authorTed Lemon <source@isc.org>
Mon, 1 May 2000 17:17:25 +0000 (17:17 +0000)
committerTed Lemon <source@isc.org>
Mon, 1 May 2000 17:17:25 +0000 (17:17 +0000)
client/scripts/bsdos
client/scripts/freebsd
client/scripts/linux
client/scripts/netbsd
client/scripts/nextstep
client/scripts/openbsd
client/scripts/solaris

index d9e44b40d08839a87dffde13ecc2006f5f423a05..e6d0e2a0a3db1f3346a43afda676d2dfae93f0ba 100755 (executable)
@@ -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
index b3b739772c044169bef925e3cefdf4ce63886fe5..a095c12fa232dcf3c7921636cd8ddbd4b26067fe 100755 (executable)
@@ -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
index fc2756e5a2f902a2165f98cd35f6535ea8222e72..603fff5b3535ce863f3727fed614226dc332d454 100755 (executable)
@@ -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.
index d47841e2c8e536d2f97537ebb7a4259e85a00bbd..bb8ffb8c4ec8198e55c75e198f8b73dcbe4a25a8 100755 (executable)
@@ -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
index 15623a38e9a97965465569a8b772ab1ba505ac42..1c8c2a266a6ac115e3e05cf2d1abf5b4ae22ab0a 100644 (file)
@@ -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
index d9e44b40d08839a87dffde13ecc2006f5f423a05..e6d0e2a0a3db1f3346a43afda676d2dfae93f0ba 100644 (file)
@@ -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
index d60feeac90f051188cb9061206609b41ab16566b..12a344c6f6e72e69a01d018df2b08414df112637 100755 (executable)
@@ -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