Commit | Line | Data |
---|---|---|
3988a733 | 1 | #!/bin/bash |
711a0748 | 2 | |
9028e234 IJ |
3 | # Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk> |
4 | # Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk> | |
5 | # Copyright 1999,2003 | |
6 | # Chancellor Masters and Scholars of the University of Cambridge | |
7 | # Copyright 2010 Tony Finch <fanf@dotat.at> | |
711a0748 | 8 | # |
9 | # This is free software; you can redistribute it and/or modify it | |
10 | # under the terms of the GNU General Public License as published by | |
9028e234 | 11 | # the Free Software Foundation; either version 3 of the License, or |
711a0748 | 12 | # (at your option) any later version. |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, but | |
15 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | # General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
9028e234 | 20 | # along with userv-utils; if not, see http://www.gnu.org/licenses/. |
711a0748 | 21 | |
3988a733 | 22 | set -e |
23 | zone=$1 | |
24 | test -d ../zone,$zone | |
25 | ||
26 | ah="` | |
27 | adnshost +Do +Dt -Cf -t soa $zone. || \ | |
28 | (test $? == 6 && echo . . 1 0 0 0 0) | |
29 | `" | |
30 | re='.* \([0-9][0-9]*\) [0-9][0-9]* [0-9][0-9]* [0-9][0-9]* [0-9][0-9]*$' | |
31 | serial="`expr 1 + match \"$ah\" \"$re\"`" | |
32 | ||
33 | sed <Manual -e 's/^[ ]*%SERIAL[ ]*$/ '" $serial;serial/" >Zone.new | |
34 | cat [_0-9a-z]*,data >>Zone.new | |
35 | mv Zone.new Zone | |
36 | ||
37 | echo "serial $serial" | |
38 | userv root ndc-reload |