diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:11 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:11 -0800 |
commit | 4c5a5fb53bccceff331bae70f748bf9b4609fe0a (patch) | |
tree | d6ae69d0d3f4a4d760a3254ec326bca4a8afacfe /dhcpcd-hooks/30-hostname | |
parent | e95877ecfa1170d77b1ec1f66752725cdda01b64 (diff) | |
download | external_dhcpcd-4c5a5fb53bccceff331bae70f748bf9b4609fe0a.zip external_dhcpcd-4c5a5fb53bccceff331bae70f748bf9b4609fe0a.tar.gz external_dhcpcd-4c5a5fb53bccceff331bae70f748bf9b4609fe0a.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'dhcpcd-hooks/30-hostname')
-rw-r--r-- | dhcpcd-hooks/30-hostname | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/dhcpcd-hooks/30-hostname b/dhcpcd-hooks/30-hostname index 500ec0f..b2e5fc8 100644 --- a/dhcpcd-hooks/30-hostname +++ b/dhcpcd-hooks/30-hostname @@ -3,16 +3,23 @@ need_hostname() { case "$(hostname)" in - ""|"(none)"|localhost) [ -n "${new_host_name}" ];; - "${old_host_name}") true;; - *) false;; + ""|"(none)"|localhost|localhost.localdomain) + [ -n "${new_host_name}" -o -n "${new_fqdn_name}" ];; + "${old_host_name}"|"${old_fqdn_name}") + true;; + *) + false;; esac } set_hostname() { if need_hostname; then - hostname "${new_host_name}" + if [ -n "${new_host_name}" ]; then + hostname "${new_host_name}" + else + hostname "${new_fqdn_name}" + fi fi } |