main.c revision 8727
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated for what's essentially a complete rewrite.
6 *
7 * $Id: main.c,v 1.9 1995/05/24 09:00:36 jkh Exp $
8 *
9 * Copyright (c) 1995
10 *	Jordan Hubbard.  All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer,
17 *    verbatim and that no modifications are made prior to this
18 *    point in the file.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 *    notice, this list of conditions and the following disclaimer in the
21 *    documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 *    must display the following acknowledgement:
24 *	This product includes software developed by Jordan Hubbard
25 *	for the FreeBSD Project.
26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
27 *    endorse or promote products derived from this software without specific
28 *    prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED.  IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 */
43
44#include "sysinstall.h"
45
46int
47main(int argc, char **argv)
48{
49    int choice, scroll, curr, max;
50
51    if (geteuid() != 0) {
52	fprintf(stderr, "Warning:  This utility should be run as root.\n");
53	sleep(1);
54    }
55    /* Set up whatever things need setting up */
56    systemInitialize(argc, argv);
57
58    /* Probe for all relevant devices on the system */
59    deviceGetAll();
60
61    /* Welcome user to FreeBSD */
62    systemWelcome();
63
64    /* Default to English */
65    lang_set_English(NULL);
66
67    /* Default to passive mode ftp since it's the only thing we currently support :-( */
68    variable_set2("ftpPassive", "yes");
69
70    /* Begin user dialog at outer menu */
71    while (1) {
72	choice = scroll = curr = max = 0;
73	dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
74	if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit?  System will reboot."))
75	    break;
76    }
77    /* Say goodnight, Gracie */
78    systemShutdown();
79
80    /* If we're running as init, we should never get here */
81    return 0;
82}
83