aboutsummaryrefslogtreecommitdiffstats
path: root/dhcpcd-hooks/30-hostname
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:04:11 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:04:11 -0800
commit4c5a5fb53bccceff331bae70f748bf9b4609fe0a (patch)
treed6ae69d0d3f4a4d760a3254ec326bca4a8afacfe /dhcpcd-hooks/30-hostname
parente95877ecfa1170d77b1ec1f66752725cdda01b64 (diff)
downloadexternal_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-hostname15
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
}