summaryrefslogtreecommitdiffstats
path: root/sbin/sysinstall/stage0.c
blob: 8c5a3679b34d964961faf8a20ea9d36114a8cd4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Copyright (c) 1994, Jordan Hubbard, Paul Richards and Poul-Henning Kamp.
 *
 * All rights reserved.
 *
 * This software may be used, modified, copied, distributed, and
 * sold, in both source and binary form provided that the above
 * copyright and these terms are retained, verbatim, as the first
 * lines of this file.  Under no circumstances is the author
 * responsible for the proper functioning of this software, nor does
 * the author assume any responsibility for damages incurred with
 * its use.
 *
 * [Note: This file bears almost no resemblance to what was here in an
 * earlier incarnation].
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/reboot.h>
#include <dialog.h>

#include "sysinstall.h"

static unsigned char *welcome[] = {
    "1. README",
    "READ THIS FIRST.",
    "2. Release Notes",
    "Read the 2.0 Release Notes (recommended).",
    "3. Troubleshooting",
    "Read this in case of trouble.",
    "4. Partitions and MBRs",
    "Verbose description of how these work.",
    "5. COPYRIGHT",
    "Read FreeBSD Copyright Information.",
    "6. Install",
    "Proceed with full installation.",
    "7. Fixit",
    "Repair existing installation (fixit mode).",
    "8. Quit",
    "Don't do anything, just reboot.",
};

void 
stage0()
{
evil_goto:
    if (dialog_menu("Welcome to FreeBSD!",
		    "Use ALT-F2 and ALT-F1 to toggle between debugging\ninformation screen (ALT-F2) or this dialog screen (ALT-F1)\n\nPlease select one of the following options:", -1, -1, 8, 8, welcome, selection, NULL, NULL))
	ExitSysinstall();

    switch (atoi(selection)) {
    case 1:	/* View the README */
        ShowFile(README_FILE, "Read Me First");
	goto evil_goto;
	break;

    case 2:	/* View the release notes */
        ShowFile(RELNOTES_FILE, "Release Notes");
	goto evil_goto;
	break;

    case 3:	/* View the troubleshooting file */
        ShowFile(TROUBLE_FILE, "Troubleshooting");
	goto evil_goto;
	break;

    case 4:	/* View DISK FAQ */
        ShowFile(HELPME_FILE, "DISK FAQ");
	goto evil_goto;
	break;

    case 5:	/* View copyrights */
        ShowFile(COPYRIGHT_FILE, "COPYRIGHT");
	goto evil_goto;
	break;

    case 6:	/* Proceed (do nothing special, really) */
	fixit = 0;
	break;

    case 7:
	dialog_clear();
	dialog_update();
	dialog_msgbox("WARNING!", 
"The usual install procedure will be invoked, but with most of the
sanity checks disabled.  The suggested course of action is to:
	1. Go to (F)disk and do a (W)rite, and possibly a (B)oot too
	   if your MBR has been wiped.
	2. Go into (D)isklabel and identify your root (/) and swap
	   partitions.
	3. Select (P)roceed to reboot and load the cpio floppy.
	4. You will now be in the stand-alone shell, where you may
	   conduct further repairs with the tools you'll find in
	   /stand.
	5. Good luck...  You'll probably need it.", -1, -1, 1);
	fixit = 1;
	break;

    case 8:
	/* Be neat.. */
	ExitSysinstall();
	break;	/* hope not! :) */
    }
}
OpenPOWER on IntegriCloud