2 * Copyright (c)2004 The DragonFly Project. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * Neither the name of the DragonFly Project nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 * OF THE POSSIBILITY OF SUCH DAMAGE.
36 * Main program for installer backend.
37 * $Id: main.c,v 1.18 2005/03/11 19:57:27 cpressey Exp $
48 #define _(String) gettext (String)
50 #define _(String) (String)
53 #include "libaura/mem.h"
55 #include "libdfui/dfui.h"
56 #include "libdfui/dump.h"
57 #include "libdfui/system.h"
60 #include "pathnames.h"
62 static void usage(char **);
65 main(int argc, char **argv)
68 char *rendezvous = NULL;
72 int booted_from_livecd = 0;
73 int upgrade_menu_toggle = 0;
76 setlocale (LC_ALL, "");
77 bindtextdomain (PACKAGE, LOCALEDIR);
82 * XXX TODO: set transport and rendezvous from
83 * corresponding environment variables, if set.
86 strlcpy(os_root, DEFAULT_OS_ROOT, sizeof(os_root));
89 dfui_debug_file = fopen("/tmp/dfuibe_installer_debug.log", "w");
93 * Get command-line arguments.
95 while ((opt = getopt(argc, argv, "o:r:t:")) != -1) {
98 strlcpy(os_root, optarg, sizeof(os_root));
101 rendezvous = aura_strdup(optarg);
104 transport = user_get_transport(optarg);
115 transport = user_get_transport("tcp");
117 if (rendezvous == NULL) {
118 if (transport == DFUI_TRANSPORT_TCP)
119 rendezvous = aura_strdup("9999");
121 rendezvous = aura_strdup("test");
124 do_reboot = flow(transport, rendezvous, os_root,
125 booted_from_livecd, upgrade_menu_toggle);
137 fprintf(stderr, _("Usage: %s [-o rootdir] [-r rendezvous] "
138 "[-t caps|npipe|tcp]\n"), argv[0]);