append dot if hostname contains domain

This commit is contained in:
f 2021-04-01 16:56:20 -03:00
parent 72e5499ab9
commit 34b0a70b4f

View file

@ -9,12 +9,15 @@ test -z "${IP6}" && exit 1
test -z "${KNOT}" && exit 1
test -z "${DOMAIN}" && exit 1
# Add a dot if the hostname contains the domain
echo "${HOSTNAME}" | grep -q "\.${DOMAIN}$" && DOT="."
knsupdate <<DNS
server ${KNOT}
zone ${DOMAIN}.
origin ${DOMAIN}.
ttl 60
add ${HOSTNAME} AAAA ${IP6}
add ${HOSTNAME}${DOT} AAAA ${IP6}
send
quit
DNS