The upstart task sets the system hostname from /etc/hostname (falling back to "localhost" if that file is not readable or is empty and no hostname has yet been set).
The idea here would be honor new_host_name for the same use cases (if the /etc/hostname file is non-empty). That would support both the first case (honor DHCP new_host_name if no hostname=localhost) and the case the debian bug tries to cover (honor further DHCP new_host_name if hostname was previously set by DHCP)
Something like:
if [ -n "$new_host_name" ]; then
if [ ! -s /etc/hostname ]; then
hostname "$new_host_name"
fi
fi
The upstart task sets the system hostname from /etc/hostname (falling back to "localhost" if that file is not readable or is empty and no hostname has yet been set).
The idea here would be honor new_host_name for the same use cases (if the /etc/hostname file is non-empty). That would support both the first case (honor DHCP new_host_name if no hostname=localhost) and the case the debian bug tries to cover (honor further DHCP new_host_name if hostname was previously set by DHCP)
Something like:
if [ -n "$new_host_name" ]; then
if [ ! -s /etc/hostname ]; then
hostname "$new_host_name"
fi
fi