summaryrefslogtreecommitdiff
path: root/scripts/nameserver_autogen/dnsmasq_tld_conffile
blob: 5ba285389cc57e54774ee56398e611c2bff3d47d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#
# Call this script directly from the git root and redirect 
# its output to a file.
# This file should then be imported in the dnsmasq.conf 
# using the conf-file=path-to-this-file statement.
#

sh scripts/check_db_safety || exit 1

for a in $(ls db/ip/); do
	for b in $(ls db/ip/${a}); do
		for c in $(ls db/ip/${a}/${b}); do
			if [ -d db/ip/${a}/${b}/${c}/ns/ ]; then
			 	for ns in $(cat db/ip/${a}/${b}/${c}/ns/*); do
					A1=$(scripts/hex2dec ${a})
					B1=$(scripts/hex2dec ${b})
					C1=$(scripts/hex2dec ${c})
					STR="server=/${C1}.${B1}.${A1}.in-addr.arpa/${ns}"
					echo $STR
				done
			fi
		done
	done
done

echo

for tld in $(ls db/dom/); do 
	for domain in $(ls db/dom/${tld}/); do 
		for ns in $(cat db/dom/${tld}/${domain}/ns/*); do 
			STR="server=/${domain}.${tld}/${ns}"
			echo $STR
		done; 
	done; 
done