1 # Lookup the hostname in DNS if not set
5 [ -z "$new_ip_address" ] && return 1
6 # Silly ISC programs love to send error text to stdout
7 if command -v dig >/dev/null 2>&1; then
8 h=$(dig +short -x $new_ip_address)
10 echo "$h" | sed 's/\.$//'
13 elif command -v host >/dev/null 2>&1; then
14 h=$(host $new_ip_address)
17 | sed 's/.* domain name pointer \(.*\)./\1/'
20 elif command -v getent >/dev/null 2>&1; then
21 h=$(getent hosts $new_ip_address)
23 echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/'
32 if [ -z "${new_host_name}${new_fqdn_name}" ]; then
33 export new_host_name="$(lookup_hostname)"