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