Mercurial > hg > anonet-resdb
annotate scripts/addmissingcidr.sh @ 1232:216dfce70e8e draft
added 21.104.100.0/24
author | root <root@x> |
---|---|
date | Wed, 28 Nov 2018 06:19:22 +0000 |
parents | 0e5d4b7fc3d8 |
children |
rev | line source |
---|---|
1212
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
1 #!/bin/sh |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
2 # adds missing ip/*/*/cidr entries |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
3 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
4 cd db || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
5 cd ip || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
6 for a in * |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
7 do |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
8 [ -e "$a" ] || continue |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
9 ia=$((0x$a)) || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
10 cd "$a" || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
11 for b in * |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
12 do |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
13 [ -e "$b" ] || continue |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
14 ib=$((0x$b)) || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
15 cd "$b" || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
16 for c in * |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
17 do |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
18 [ -e "$c" ] || continue |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
19 ic=$((0x$c)) || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
20 cd "$c" || exit 1 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
21 if [ ! -e cidr ] |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
22 then |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
23 printf "%d.%d.%d.0/24\n" "$ia" "$ib" "$ic"> cidr |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
24 printf "ip/%s/%s/%s %d.%d.%d.0/24\n" "$a" "$b" "$c" "$ia" "$ib" "$ic" >&2 |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
25 fi |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
26 cd .. |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
27 done |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
28 cd .. |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
29 done |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
30 cd .. |
0e5d4b7fc3d8
add missing cidr entry, fix abslimit's IP entry, tweak bind autogen script
cathugger <cathugger@cock.li>
parents:
diff
changeset
|
31 done |