# Set the hostname from DHCP data if required

need_hostname()
{
	case "$(hostname)" in
		""|"(none)"|localhost|"localhost.localdomain")	[ -n "${new_host_name}" ];;
		"${old_host_name}") 	true;;
		*) 			false;;
	esac
}

set_hostname()
{
	if need_hostname; then
		hostname "${new_host_name}"
	fi
}

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	set_hostname;;
esac
