summaryrefslogtreecommitdiffstats
path: root/dehydrated/bin/dehydrated-nsupdate
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-05 07:06:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-05 07:06:46 +0000
commit893e0ffd1812ec38a3651eca3ab85928b3090555 (patch)
tree0a8601f7be56c78d2a6ed82c258742af942e4f08 /dehydrated/bin/dehydrated-nsupdate
parentAdding upstream version 20211231. (diff)
downloadopen-infrastructure-service-tools-893e0ffd1812ec38a3651eca3ab85928b3090555.tar.xz
open-infrastructure-service-tools-893e0ffd1812ec38a3651eca3ab85928b3090555.zip
Adding upstream version 20220105.upstream/20220105
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dehydrated/bin/dehydrated-nsupdate')
-rwxr-xr-xdehydrated/bin/dehydrated-nsupdate46
1 files changed, 4 insertions, 42 deletions
diff --git a/dehydrated/bin/dehydrated-nsupdate b/dehydrated/bin/dehydrated-nsupdate
index 0b93145..fa421ea 100755
--- a/dehydrated/bin/dehydrated-nsupdate
+++ b/dehydrated/bin/dehydrated-nsupdate
@@ -2,7 +2,7 @@
# Open Infrastructure: service-tools
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -46,19 +46,6 @@ if command -v kdig > /dev/null 2>&1
then
# knot-dnsutils
DIG="kdig +noidn"
-
- # out-of-tree json output support
- if kdig +json > /dev/null 2>&1
- then
- DIG="${DIG} +json"
- KDIG_JSON="true"
-
- if ! command -v jq > /dev/null 2>&1
- then
- echo "'${HOOK}': need jq for knot-dnsutils with json output" >&2
- exit 1
- fi
- fi
elif command -v dig > /dev/null 2>&1
then
# bind-dnsutils
@@ -92,15 +79,7 @@ do
done
# find txt record to update
-case "${KDIG_JSON}" in
- true)
- CNAME="$(${DIG} "_acme-challenge.${DOMAIN}" | jq -r -M '.answer | .[] | .rdata' | tail -n1)"
- ;;
-
- *)
- CNAME="$(${DIG} +nocomments +noquestion "_acme-challenge.${DOMAIN}" 2>&1 | grep -v '^;' | awk '/CNAME/ { print $5 }' | tail -n1)"
- ;;
-esac
+CNAME="$(${DIG} +nocomments +noquestion "_acme-challenge.${DOMAIN}" 2>&1 | grep -v '^;' | awk '/CNAME/ { print $5 }' | tail -n1)"
if [ -n "${CNAME}" ]
then
@@ -114,28 +93,11 @@ ZONE="${TXT_RECORD}"
while true
do
- case "${KDIG_JSON}" in
- true)
- NAMESERVERS="$(${DIG} NS "${ZONE}" | jq -r -M '.answer | .[] | .rdata')"
- ;;
-
- *)
- NAMESERVERS="$(${DIG} +nocomments +noquestion NS "${ZONE}" 2>&1 | grep -v '^;' | awk '/NS/ { print $5 }')"
- ;;
- esac
+ NAMESERVERS="$(${DIG} +nocomments +noquestion NS "${ZONE}" 2>&1 | grep -v '^;' | awk '/NS/ { print $5 }')"
if [ -n "${NAMESERVERS}" ]
then
- case "${KDIG_JSON}" in
- true)
- ZONE="$(${DIG} NS "${ZONE}" | jq -r -M '.answer | .[] | .rdata' | tail -n1)"
- ;;
-
- *)
- ZONE="$(${DIG} +nocomments +noquestion NS "${ZONE}" 2>&1 | grep -v '^;' | awk '/NS/ { print $1 }' | tail -n1)"
- ;;
- esac
-
+ ZONE="$(${DIG} +nocomments +noquestion NS "${ZONE}" 2>&1 | grep -v '^;' | awk '/NS/ { print $1 }' | tail -n1)"
break
else
ZONE="$(echo "${ZONE}" | cut -d '.' -f 2-)"