No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / dhcpcd / dist / dhcpcd-hooks / 30-hostname
bloba19fc0df5526a8bdac18e773ead1cdb8a9475822
1 # Set the hostname from DHCP data if required
3 need_hostname()
5         local hostname=""
7         case "$force_hostname" in
8         [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) ;;
9         *) hostname="$(hostname)";;
10         esac
11         case "$hostname" in
12         ""|"(none)"|localhost|localhost.localdomain)
13                 [ -n "$new_host_name" -o -n "$new_fqdn_name" ];;
14         "$old_host_name"|"$old_fqdn_name")
15                 true;;
16         *)
17                 false;;
18         esac
21 set_hostname()
23         if need_hostname; then
24                 if [ -n "$new_host_name" ]; then
25                         hostname "$new_host_name"
26                 elif [ -n "$new_fqdn_name" ]; then
27                         hostname "$new_fqdn_name"
28                 fi
29         fi
32 case "$reason" in
33 BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)        set_hostname;;
34 esac