diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
commit | 830407e88f9d40d954356c3754f2647f91d5c06a (patch) | |
tree | d6a0ece6feea91f3c656166dbaa884ef8a29740e /scripts/update-root-hints.sh | |
parent | Initial commit. (diff) | |
download | knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.tar.xz knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.zip |
Adding upstream version 5.6.0.upstream/5.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | scripts/update-root-hints.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/update-root-hints.sh b/scripts/update-root-hints.sh new file mode 100755 index 0000000..5f7a564 --- /dev/null +++ b/scripts/update-root-hints.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0-or-later +set -o nounset -o xtrace + +TEMP_FILE=/tmp/root.hints +HINTS_FILE=etc/root.hints + +# download latest root hints +wget -O ${TEMP_FILE} https://www.internic.net/domain/named.root + +# strip comments for diff +sed '/^;/d' ${TEMP_FILE} > ${TEMP_FILE}.clean +sed '/^;/d' ${HINTS_FILE} > ${HINTS_FILE}.clean + +# check for changes +diff ${TEMP_FILE}.clean ${HINTS_FILE}.clean >/dev/null +CHANGED=$? + +if [ $CHANGED -ne 0 ]; then + # update root.hints + mv ${TEMP_FILE} ${HINTS_FILE} +fi + +# cleanup +rm -f ${TEMP_FILE} ${TEMP_FILE}.clean ${HINTS_FILE}.clean + +# signal change with exit code +exit $CHANGED |