No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / bind / dist / contrib / dbus / SetForwarders
blob8ee4ce1005bc9ffc32b133b3e3fa0b758a10581f
1 #!/bin/bash
3 # This script uses the named D-BUS support, which must be enabled in
4 # the running named with the named '-D' option, to set the forwarding zones
5 # in the running server.
6 #
7 # One zone argument is required, followed by any number of server IP (v4 or v6)
8 # addresses. If the server IP address list is empty, any forwarders for the zone
9 # will be removed.
11 # Usage:
12 # SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server IP> [...<server IP>] ]
14 # Copyright(C) Jason Vas Dias<jvdias@redhat.com> Red Hat Inc. 2005
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation at
19 # http://www.fsf.org/licensing/licenses/gpl.txt
20 # and included in this software distribution as the "LICENSE" file.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 usage() { echo "Usage: SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server> [...<server>] ]"; }
28 type=''
29 if [ $# -eq 0 ]; then
30 usage;
31 exit 1;
32 elif [ "$1" = "-t" ]; then
33 if [ $# -lt 2 ]; then
34 echo '-t option requires an argument.'
35 exit 1;
36 fi;
37 type=$2;
38 shift 2;
39 fi;
40 if [ $# -lt 1 ]; then
41 echo '<zone> first argument required.'
42 exit 1;
43 fi;
44 zone='string:'"$1";
45 shift;
46 servers='';
47 if [ $# -gt 0 ]; then
48 for svr in $*; do
49 servers="$servers string:$svr";
50 done
51 fi;
52 dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.SetForwarders $zone $type $servers;