Improve logging and detection of domain name

This commit is contained in:
Michael Boelen 2016-10-23 16:25:38 +02:00
parent f18ef5c210
commit 270f2e4fb1

View File

@ -188,7 +188,7 @@
#fi
LogText "Test: Checking if dnsdomainname command is available"
if [ ! "${DNSDOMAINNAMEBINARY}" = "" ]; then
if [ ! -z "${DNSDOMAINNAMEBINARY}" ]; then
FIND2=$(${DNSDOMAINNAMEBINARY} 2> /dev/null)
if [ ! "${FIND2}" = "" ]; then
LogText "Result: dnsdomainname command returned a value"
@ -207,13 +207,12 @@
LogText "Result: using domain name from ${ROOTDIR}etc/resolv.conf"
DOMAINNAME=${RESOLV_DOMAINNAME}
else
LogText "Result: using domain name from FQDN hostname"
#DOMAINNAME=${FQDN#${HOSTNAME}.}
DOMAINNAME=`echo ${FQDN} | ${CUTBINARY} -d . -f2-`
LogText "Result: using domain name from FQDN hostname (${FQDN})"
DOMAINNAME=$(echo ${FQDN} | ${AWKBINARY} -F. '{print $2}')
fi
fi
if [ ! "${DOMAINNAME}" = "" ]; then
if [ ! -z "${DOMAINNAME}" ]; then
LogText "Result: found domain name"
Report "domainname=${DOMAINNAME}"
Display --indent 2 --text "- Searching DNS domain name" --result "${STATUS_FOUND}" --color GREEN