mirror of
https://github.com/uklans/cache-domains
synced 2025-06-19 07:52:56 +02:00
create-unbound.sh and create-unbound.sh will now ignore empty entries, which may result into corrupt config files causing at least unbound (and probably also dnsmasq) to fail starting up
https://github.com/uklans/cache-domains/issues/157
This commit is contained in:
parent
019ec04f27
commit
84e9a378b3
@ -69,6 +69,10 @@ while read -r entry; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
parsed=$(echo $fileentry)
|
parsed=$(echo $fileentry)
|
||||||
|
# Ignore empty lines
|
||||||
|
if [[ -z "$parsed" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if grep -qx "$parsed" "$outputfile"; then
|
if grep -qx "$parsed" "$outputfile"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -42,6 +42,7 @@ while read entry; do
|
|||||||
cacheip=$(jq -r 'if type == "array" then .[] else . end' <<< ${!cacheipname} | xargs)
|
cacheip=$(jq -r 'if type == "array" then .[] else . end' <<< ${!cacheipname} | xargs)
|
||||||
while read fileid; do
|
while read fileid; do
|
||||||
while read filename; do
|
while read filename; do
|
||||||
|
isvalid=false
|
||||||
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
destfilename=$(echo $filename | sed -e 's/txt/conf/')
|
||||||
outputfile=${outputdir}/${destfilename}
|
outputfile=${outputdir}/${destfilename}
|
||||||
touch $outputfile
|
touch $outputfile
|
||||||
@ -52,14 +53,23 @@ while read entry; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
parsed=$(echo $fileentry | sed -e "s/^\*\.//")
|
parsed=$(echo $fileentry | sed -e "s/^\*\.//")
|
||||||
|
# Ignore empty lines
|
||||||
|
if [[ -z "$parsed" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if grep -qx "$parsed" $outputfile; then
|
if grep -qx "$parsed" $outputfile; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
isvalid=true
|
||||||
echo " local-zone: \"${parsed}\" redirect" >> $outputfile
|
echo " local-zone: \"${parsed}\" redirect" >> $outputfile
|
||||||
for i in ${cacheip}; do
|
for i in ${cacheip}; do
|
||||||
echo " local-data: \"${parsed} 30 IN A ${i}\"" >> $outputfile
|
echo " local-data: \"${parsed} 30 IN A ${i}\"" >> $outputfile
|
||||||
done
|
done
|
||||||
done <<< $(cat ${basedir}/$filename | sort);
|
done <<< $(cat ${basedir}/$filename | sort);
|
||||||
|
# Delete files with no entries
|
||||||
|
if [[ $isvalid == false ]]; then
|
||||||
|
rm $outputfile
|
||||||
|
fi
|
||||||
done <<< $(jq -r ".cache_domains[$entry].domain_files[$fileid]" $path)
|
done <<< $(jq -r ".cache_domains[$entry].domain_files[$fileid]" $path)
|
||||||
done <<< $(jq -r ".cache_domains[$entry].domain_files | to_entries[] | .key" $path)
|
done <<< $(jq -r ".cache_domains[$entry].domain_files | to_entries[] | .key" $path)
|
||||||
done <<< $(jq -r '.cache_domains | to_entries[] | .key' $path)
|
done <<< $(jq -r '.cache_domains | to_entries[] | .key' $path)
|
||||||
|
Loading…
Reference in New Issue
Block a user