2 * rconfig - Remote configurator
4 * rconfig [-W workingdir] [server_ip[:tag]]
5 * rconfig [-f configfile] -s
7 * Copyright (c) 2003,2004 The DragonFly Project. All rights reserved.
9 * This code is derived from software contributed to The DragonFly Project
10 * by Matthew Dillon <dillon@backplane.com>
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in
20 * the documentation and/or other materials provided with the
22 * 3. Neither the name of The DragonFly Project nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific, prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
34 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 const char *WorkDir
= "/tmp";
44 const char *ConfigFiles
= "/etc/defaults/rconfig.conf:/etc/rconfig.conf";
45 const char *TagDir
= "/usr/local/etc/rconfig";
50 static void usage(int code
);
51 static void addTag(tag_t
*basep
, const char *tag
, int flags
);
54 main(int ac
, char **av
)
60 while ((ch
= getopt(ac
, av
, "aW:T:C:sv")) != -1) {
62 case 'a': /* auto tag / standard broadcast */
63 addTag(&AddrBase
, NULL
, 0);
65 case 'W': /* specify working directory */
71 case 'C': /* specify server config file(s) (colon delimited) */
74 case 's': /* run as server using config file */
85 for (i
= optind
; i
< ac
; ++i
) {
86 if (strchr(av
[i
], '='))
87 addTag(&VarBase
, av
[i
], 0);
89 addTag(&AddrBase
, av
[i
], 0);
93 if (AddrBase
&& AddrBase
->name
== NULL
&& AddrBase
->next
) {
95 "You cannot specify both -a AND a list of hosts. If you want\n"
96 "to use auto-broadcast mode with a tag other than 'auto',\n"
97 "just specify the tag without a host, e.g. ':<tag>'\n");
109 addTag(tag_t
*basep
, const char *name
, int flags
)
111 tag_t tag
= calloc(sizeof(struct tag
), 1);
113 while ((*basep
) != NULL
)
114 basep
= &(*basep
)->next
;
125 "rconfig [-a] [-v] [-W workdir] [host[:tag] ...]\n"
126 "rconfig -s [-C configfiles] [-W workdir] [-T tagdir] "
127 "[-v] [bind_address ...]\n");