3 # Copyright (C) 2010, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
17 # Id: zone-edit.sh.in,v 1.2 2010/12/21 23:47:08 tbox Exp
20 mkdir
${dir} ||
exit 1
21 trap "/bin/rm -rf ${dir}" 0
24 exec_prefix
=@exec_prefix@
29 checkzone
=${sbindir}/named-checkzone
30 nsupdate
=${bindir}/nsupdate
33 0) echo "Usage: zone-edit <zone> [dig options] [ -- nsupdate options ]"; exit 0 ;;
36 # What kind of echo are we using?
38 if test "X$try" = "X-n "
64 ${dig} axfr
"$zone" $digopts |
65 awk '$4 == "RRSIG" || $4 == "NSEC" || $4 == "NSEC3" || $4 == "NSEC3PARAM" { next; } { print; }' > ${dir}/old
69 ${checkzone} -q -D "$zone" ${dir}/old > ${dir}/ooo
74 cp ${dir}/ooo
${dir}/new
77 if ${VISUAL:-${EDITOR:-/bin/ed}} ${dir}/new
79 if ${checkzone} -q -D "$zone" ${dir}/new > ${dir}/nnn
81 sort ${dir}/ooo
> ${dir}/s1
82 sort ${dir}/nnn
> ${dir}/s2
83 comm -23 ${dir}/s1
${dir}/s2 |
84 sed 's/^/update delete /' > ${dir}/ccc
85 comm -13 ${dir}/s1
${dir}/s2 |
86 sed 's/^/update add /' >> ${dir}/ccc
92 echo ${echo_arg} "Update (u), Abort (a), Redo (r), Modify (m), Display (d) : $bsc"
107 cat ${dir}/ccc |
more
110 cp ${dir}/ooo
${dir}/new
121 echo ${echo_arg} "Abort (a), Redo (r), Modify (m) : $bsc"
128 cp ${dir}/ooo
${dir}/new
140 echo ${echo_arg} "Abort (a), Redo (r), Modify (m) : $bsc"
147 cp ${dir}/ooo
${dir}/new