- #!/bin/bash
- #
- # This is sed to convert bind master "named.conf.local" into
- # slave "named.conf.local" for paired secondary server.
- #
- # Example from:
- # zone "example.com" {
- # type master;
- # file "/etc/bind/local-zones/example.com.zone";
- # };
- #
- # Example to:
- # zone "example.com" {
- # type slave;
- # file "/etc/bind/local-zones/example.com.zone";
- # masters {
- # 10.10.3.21;
- # };
- #};
- #
- # Script was written for a very specific set of input files, it may barf
- # if you try to use it on yours. In particular you can't have more than one
- # instance of "};" other than the one terminating each block.
- #
- # Eli Fulkerson 2015
- if [ -z "$1" ]; then
- echo "Syntax: enslave.sh inputfilename";
- exit 1;
- fi
- #@@set this as appropriate
- MASTERNS="8.8.8.8";
- cat $1 | sed "s/type master\;/type slave\;/g" | sed "s/}\;/\tmasters {\n\t\t`echo $MASTERNS`;\n\t}\;\n}\;/g"
Raw Paste