[pkg-dhcp-commits] [SCM] ISC DHCP packaging for Debian branch, master, updated. debian/4.1.1-P1-16.1-37-g10111a1

Andrew Pollock apollock at debian.org
Sat Aug 27 21:14:13 UTC 2011


The following commit has been merged in the master branch:
commit 10111a150604ed8be44692685e267209494f0066
Author: Andrew Pollock <apollock at debian.org>
Date:   Sat Aug 27 14:13:25 2011 -0700

    harmonize logic for setting the host name
    
    Patch from Peter Marschall:
    
    For the udeb case, require the new hostname to be non-empty
    in order to set it.
    
    For the non-udeb case, set the hostname in Linux & kFreeBSD only if
    1) the new hostname isn't empty
       <=> make sure that we do not reset the hostname to empty
    
    2) the current hostname is empty or '(none)' or 'localhost' or
       is different from the new one from DHCP
       <=> make sure that we set the host name if there is
           no valid one or it changed
    
    This logic is modelled after the one used upstream, and also resembles
    more the logic in the dhclient-scripts used in the udeb packages.
    
    This should fix bug #246155

diff --git a/debian/changelog b/debian/changelog
index 51e8ca6..861d0fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,8 +37,10 @@ isc-dhcp (4.2.2-1) unstable; urgency=low
     IPv6 link-local resolvers
   * debian/dhclient-script.{linux,kfreebsd}: applied patch from Peter Marschall
     to factor out the hostname setting to a separate function
+  * debian/dhclient-script.{linux,kfreebsd}: applied patch from Peter Marschall
+    to harmonize the logic for setting the hostname (closes: #246155)
 
- -- Andrew Pollock <apollock at debian.org>  Sat, 27 Aug 2011 14:08:00 -0700
+ -- Andrew Pollock <apollock at debian.org>  Sat, 27 Aug 2011 14:10:09 -0700
 
 isc-dhcp (4.1.1-P1-18) unstable; urgency=low
 
diff --git a/debian/dhclient-script.kfreebsd b/debian/dhclient-script.kfreebsd
index 95976a7..b58d2bd 100644
--- a/debian/dhclient-script.kfreebsd
+++ b/debian/dhclient-script.kfreebsd
@@ -40,8 +40,18 @@ make_resolv_conf() {
 
 # set host name
 set_hostname() {
-    if [-n "$old_host_name" ] && [ -n "$new_host_name" ]; then
-        hostname "$new_host_name"
+    local current_hostname
+
+    if [ -n "$new_host_name" ]; then
+        current_hostname=$(hostname)
+
+        # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP
+        if [ -z "$current_hostname" ] ||
+           [ "$current_hostname" = '(none)' ] ||
+           [ "$current_hostname" = 'localhost' ] ||
+           [ "$new_host_name" != "$current_hostname" ]; then
+            hostname "$new_host_name"
+        fi
     fi
 }
 
diff --git a/debian/dhclient-script.kfreebsd.udeb b/debian/dhclient-script.kfreebsd.udeb
index 645ec03..8918da0 100644
--- a/debian/dhclient-script.kfreebsd.udeb
+++ b/debian/dhclient-script.kfreebsd.udeb
@@ -33,10 +33,13 @@ make_resolv_conf() {
 # set host name
 set_hostname() {
     local current_hostname
-    current_hostname=$(hostname)
 
-    if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
-        hostname "$new_host_name"
+    if [ -n "$new_host_name" ]; then
+        current_hostname=$(hostname)
+
+        if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
+            hostname "$new_host_name"
+        fi
     fi
 }
 
diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 409be60..efc5f7d 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -85,8 +85,18 @@ make_resolv_conf() {
 
 # set host name
 set_hostname() {
-    if [-n "$old_host_name" ] && [ -n "$new_host_name" ]; then
-        hostname "$new_host_name"
+    local current_hostname
+
+    if [ -n "$new_host_name" ]; then
+        current_hostname=$(hostname)
+
+        # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP
+        if [ -z "$current_hostname" ] ||
+           [ "$current_hostname" = '(none)' ] ||
+           [ "$current_hostname" = 'localhost' ] ||
+           [ "$new_host_name" != "$current_hostname" ]; then
+            hostname "$new_host_name"
+        fi
     fi
 }
 
diff --git a/debian/dhclient-script.linux.udeb b/debian/dhclient-script.linux.udeb
index cef67fc..a50c70c 100644
--- a/debian/dhclient-script.linux.udeb
+++ b/debian/dhclient-script.linux.udeb
@@ -33,10 +33,13 @@ make_resolv_conf() {
 # set host name
 set_hostname() {
     local current_hostname
-    current_hostname=$(cat /proc/sys/kernel/hostname)
 
-    if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
-        echo "$new_host_name" > /proc/sys/kernel/hostname
+    if [ -n "$new_host_name" ]; then
+        current_hostname=$(cat /proc/sys/kernel/hostname)
+
+        if [ -z "$current_hostname" ] || [ "$current_hostname" = "(none)" ]; then
+            echo "$new_host_name" > /proc/sys/kernel/hostname
+        fi
     fi
 }
 

-- 
ISC DHCP packaging for Debian



More information about the pkg-dhcp-commits mailing list