Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / contrib / scripts / zone-edit.sh.in
blobb3c9acfbc6142fd020164c5e691c6e06aa88c7dd
1 #!/bin/sh
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
19 dir=/tmp/zone-edit.$$
20 mkdir ${dir} || exit 1
21 trap "/bin/rm -rf ${dir}" 0
23 prefix=@prefix@
24 exec_prefix=@exec_prefix@
25 bindir=@bindir@
26 sbindir=@sbindir@
28 dig=${bindir}/dig
29 checkzone=${sbindir}/named-checkzone
30 nsupdate=${bindir}/nsupdate
32 case $# in
33 0) echo "Usage: zone-edit <zone> [dig options] [ -- nsupdate options ]"; exit 0 ;;
34 esac
36 # What kind of echo are we using?
37 try=`echo -n ""`
38 if test "X$try" = "X-n "
39 then
40 echo_arg=""
41 bsc="\\c"
42 else
43 echo_arg="-n"
44 bsc=""
47 zone="${1}"
48 shift
49 digopts=
50 while test $# -ne 0
52 case "${1}" in
53 --)
54 shift
55 break
58 digopts="$digopts $1"
59 shift
61 esac
62 done
64 ${dig} axfr "$zone" $digopts |
65 awk '$4 == "RRSIG" || $4 == "NSEC" || $4 == "NSEC3" || $4 == "NSEC3PARAM" { next; } { print; }' > ${dir}/old
67 if test -s ${dir}/old
68 then
69 ${checkzone} -q -D "$zone" ${dir}/old > ${dir}/ooo
72 if test -s ${dir}/ooo
73 then
74 cp ${dir}/ooo ${dir}/new
75 while :
77 if ${VISUAL:-${EDITOR:-/bin/ed}} ${dir}/new
78 then
79 if ${checkzone} -q -D "$zone" ${dir}/new > ${dir}/nnn
80 then
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
87 if test -s ${dir}/ccc
88 then
89 cat ${dir}/ccc | more
90 while :
92 echo ${echo_arg} "Update (u), Abort (a), Redo (r), Modify (m), Display (d) : $bsc"
93 read ans
94 case "$ans" in
97 echo zone "$zone"
98 cat ${dir}/ccc
99 echo send
100 ) | ${nsupdate} "$@"
101 break 2
104 break 2
107 cat ${dir}/ccc | more
110 cp ${dir}/ooo ${dir}/new
111 break
114 break
116 esac
117 done
118 else
119 while :
121 echo ${echo_arg} "Abort (a), Redo (r), Modify (m) : $bsc"
122 read ans
123 case "$ans" in
125 break 2
128 cp ${dir}/ooo ${dir}/new
129 break
132 break
134 esac
135 done
137 else
138 while :
140 echo ${echo_arg} "Abort (a), Redo (r), Modify (m) : $bsc"
141 read ans
142 case "$ans" in
144 break 2
147 cp ${dir}/ooo ${dir}/new
148 break
151 break
153 esac
154 done
157 done