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
39 * $DragonFly: src/sbin/rconfig/rconfig.c,v 1.4 2007/02/20 15:52:43 swildner Exp $
44 const char *WorkDir = "/tmp";
45 const char *ConfigFiles = "/etc/defaults/rconfig.conf:/etc/rconfig.conf";
46 const char *TagDir = "/usr/local/etc/rconfig";
51 static void usage(int code);
52 static void addTag(tag_t *basep, const char *tag, int flags);
55 main(int ac, char **av)
61 while ((ch = getopt(ac, av, "aD:W:irt:f:sv")) != -1) {
63 case 'a': /* auto tag / standard broadcast */
64 addTag(&AddrBase, NULL, 0);
66 case 'W': /* specify working directory */
72 case 'C': /* specify server config file(s) (colon delimited) */
75 case 's': /* run as server using config file */
86 for (i = optind; i < ac; ++i) {
87 if (strchr(av[i], '='))
88 addTag(&VarBase, av[i], 0);
90 addTag(&AddrBase, av[i], 0);
94 if (AddrBase && AddrBase->name == NULL && AddrBase->next) {
96 "You cannot specify both -a AND a list of hosts. If you want\n"
97 "to use auto-broadcast mode with a tag other than 'auto',\n"
98 "just specify the tag without a host, e.g. ':<tag>'\n");
110 addTag(tag_t *basep, const char *name, int flags)
112 tag_t tag = calloc(sizeof(struct tag), 1);
114 while ((*basep) != NULL)
115 basep = &(*basep)->next;
125 fprintf(stderr, "rconfig [-W workdir] [-f servconfig] "
126 "[-s] [var=data]* [server_ip[:tag]]* \n");