Lines Matching refs:hostname

1 # Set the hostname from DHCP data if required
3 # A hostname can either be a short hostname or a FQDN.
9 # This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
10 # where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
11 # DHCPv6 has no hostname option.
12 # RFC4702 section 3.1 says FQDN should be prefered over hostname.
14 # As such, the default is hostname_fqdn=true so that a consistent hostname
18 # If we used to set the hostname, but relinquish control of it, we should
22 # Some systems don't have hostname(1)
26 if [ -r /proc/sys/kernel/hostname ]; then
27 read name </proc/sys/kernel/hostname && echo "$name"
28 elif command -v hostname >/dev/null 2>/dev/null; then
29 hostname
30 elif sysctl kern.hostname >/dev/null 2>&1; then
31 sysctl -n kern.hostname
32 elif sysctl kernel.hostname >/dev/null 2>&1; then
33 sysctl -n kernel.hostname
40 if [ -w /proc/sys/kernel/hostname ]; then
41 echo "$1" >/proc/sys/kernel/hostname
42 elif [ -n "$1" ] && command -v hostname >/dev/null 2>&1; then
43 hostname "$1"
44 elif sysctl kern.hostname >/dev/null 2>&1; then
45 sysctl -w "kern.hostname=$1" >/dev/null
46 elif sysctl kernel.hostname >/dev/null 2>&1; then
47 sysctl -w "kernel.hostname=$1" >/dev/null
49 # May fail to set a blank hostname
50 hostname "$1"
65 # Always load the hostname variable for future use
66 hostname="$(_hostname)"
67 is_default_hostname "$hostname" && return 0
75 [ "$hostname" = "$old_fqdn" ]
77 [ "$hostname" = "${old_fqdn%%.*}" ]
84 [ "$hostname" = \
87 [ "$hostname" = "$old_host_name" ]
90 [ "$hostname" = "${old_host_name%%.*}" ]
92 [ "$hostname" = "$old_host_name" ]
95 # No old hostname
102 [ "$hostname" = "$1" ] && return 0
104 syslog info "Setting hostname: $1"
107 syslog err "Invalid hostname: $1"
143 elif ! is_default_hostname "$hostname"; then