From: Roy Marples Date: Thu, 4 Dec 2014 13:45:24 +0000 (+0000) Subject: If neither dig nor host are present fall back to getent. X-Git-Tag: v6.6.5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7afdb1d82974ccbb011e5dc3df5cccd74eba8eb;p=thirdparty%2Fdhcpcd.git If neither dig nor host are present fall back to getent. Thanks to admiralnemo, fixes [e0dc4c4459]. --- diff --git a/dhcpcd-hooks/29-lookup-hostname b/dhcpcd-hooks/29-lookup-hostname index 8661fccd..04ad275e 100644 --- a/dhcpcd-hooks/29-lookup-hostname +++ b/dhcpcd-hooks/29-lookup-hostname @@ -18,6 +18,12 @@ lookup_hostname() | sed 's/.* domain name pointer \(.*\)./\1/' return 0 fi + elif type getent >/dev/null 2>&1; then + h=$(getent hosts $new_ip_address) + if [ $? = 0 ]; then + echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/' + return 0 + fi fi return 1 }