From 9a9fb0cd8b5ebde6ea23423a103aba5c11981d0d Mon Sep 17 00:00:00 2001 From: casjay Date: Tue, 20 May 2025 17:21:02 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/etc/docker/init.d/02-named.sh --- .../usr/local/etc/docker/init.d/02-named.sh | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/rootfs/usr/local/etc/docker/init.d/02-named.sh b/rootfs/usr/local/etc/docker/init.d/02-named.sh index 6786a3e..41e9ffa 100755 --- a/rootfs/usr/local/etc/docker/init.d/02-named.sh +++ b/rootfs/usr/local/etc/docker/init.d/02-named.sh @@ -363,24 +363,15 @@ EOF if [ -d "$DATA_DIR/remote" ]; then for dns_file in "$DATA_DIR/remote"/*; do - file_name="$(basename "$dns_file")" - domain_name="$(basename "${dns_file%.*}")" - main_server="$(grep -sh 'masters ' "$dns_file" | sed 's/^[ \t]*//' | grep '^' || echo 'masters { '${DNS_REMOTE_SERVER:-$DNS_SERVER_PRIMARY}'; };')" - if [ -n "$domain_name" ]; then - cat <>"$DNS_ZONE_FILE" -# ********** begin $domain_name ********** -zone "$domain_name" { - type slave; - $main_server - file "$VAR_DIR/secondary/$file_name"; -}; -# ********** end $domain_name ********** - -EOF - - grep -qs "$domain_name" "$DNS_ZONE_FILE" && echo "Secondary $domain_name to $DNS_ZONE_FILE" - else - echo "Failed to get domain name from $dns_file" | tee -a "$LOG_DIR/init.txt" >&2 + if [ -s "$dns_file" ]; then + file_name="$(basename "$dns_file")" + domain_name="$(basename "${dns_file%.*}")" + if [ -n "$domain_name" ]; then + cat "$dns_file" | sed 's|REPLACE_VAR_DIR|'$VAR_DIR'|g' >>"$DNS_ZONE_FILE" + grep -qs "$domain_name" "$DNS_ZONE_FILE" && echo "Secondary $domain_name to $DNS_ZONE_FILE" + else + echo "Failed to get domain name from $dns_file" | tee -a "$LOG_DIR/init.txt" >&2 + fi fi done fi