summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-01 21:56:32 +0000
committerjkh <jkh@FreeBSD.org>1995-05-01 21:56:32 +0000
commite3598880e349017837533ba4e1967b87751ddeff (patch)
tree66e8a7a94085501f4c4c4f035003b8f42ba879d5
parentd0d51976ab3315b9d155a3551f319e36b88b260c (diff)
downloadFreeBSD-src-e3598880e349017837533ba4e1967b87751ddeff.zip
FreeBSD-src-e3598880e349017837533ba4e1967b87751ddeff.tar.gz
Commit my latest changes before having a nap. Still not close to done,
nor is it in sync with my working sources, but it leaves me less CVS hassles to bring in the new files at this time. Still no documentation to translate quite yet, but soon. This stuff is actually very close now.
-rw-r--r--release/sysinstall/Makefile9
-rw-r--r--release/sysinstall/devices.c122
-rw-r--r--release/sysinstall/dmenu.c63
-rw-r--r--release/sysinstall/install.c133
-rw-r--r--release/sysinstall/media.c14
-rw-r--r--release/sysinstall/menus.c132
-rw-r--r--release/sysinstall/misc.c14
-rw-r--r--release/sysinstall/msg.c37
-rw-r--r--release/sysinstall/sysinstall.h79
-rw-r--r--release/sysinstall/system.c58
-rw-r--r--release/sysinstall/variable.c80
-rw-r--r--usr.sbin/sade/Makefile9
-rw-r--r--usr.sbin/sade/devices.c122
-rw-r--r--usr.sbin/sade/dmenu.c63
-rw-r--r--usr.sbin/sade/install.c133
-rw-r--r--usr.sbin/sade/menus.c132
-rw-r--r--usr.sbin/sade/misc.c14
-rw-r--r--usr.sbin/sade/msg.c37
-rw-r--r--usr.sbin/sade/sade.h79
-rw-r--r--usr.sbin/sade/system.c58
-rw-r--r--usr.sbin/sade/variable.c80
-rw-r--r--usr.sbin/sysinstall/Makefile9
-rw-r--r--usr.sbin/sysinstall/devices.c122
-rw-r--r--usr.sbin/sysinstall/dmenu.c63
-rw-r--r--usr.sbin/sysinstall/install.c133
-rw-r--r--usr.sbin/sysinstall/media.c14
-rw-r--r--usr.sbin/sysinstall/menus.c132
-rw-r--r--usr.sbin/sysinstall/misc.c14
-rw-r--r--usr.sbin/sysinstall/msg.c37
-rw-r--r--usr.sbin/sysinstall/sysinstall.h79
-rw-r--r--usr.sbin/sysinstall/system.c58
-rw-r--r--usr.sbin/sysinstall/variable.c80
32 files changed, 1895 insertions, 314 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile
index 84f5c1d..62b3c37 100644
--- a/release/sysinstall/Makefile
+++ b/release/sysinstall/Makefile
@@ -6,10 +6,13 @@ CLEANFILES= makedevs.c rtermcap
SRCS = globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
- termcap.c makedevs.c media.c
+ termcap.c makedevs.c media.c variable.c \
+ devices.c
+
+CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
+
+LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
-CFLAGS += -Wall -g -static
-LDADD = -ldialog -lncurses -lmytinfo
DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c
new file mode 100644
index 0000000..0f57283
--- /dev/null
+++ b/release/sysinstall/devices.c
@@ -0,0 +1,122 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+#include "libdisk.h"
+
+/* Get all device information for a given device class */
+Device *
+device_get_all(DeviceType which, int *ndevs)
+{
+ char **names;
+ Device *devs = NULL;
+
+ *ndevs = 0;
+ if (which == DEVICE_TYPE_DISK || which == DEVICE_TYPE_ANY) {
+ if ((names = Disk_Names()) != NULL) {
+ int i;
+
+ for (i = 0; names[i]; i++)
+ ++*ndevs;
+ devs = safe_malloc(sizeof(Device) * (*ndevs + 1));
+ for (i = 0; names[i]; i++) {
+ strcpy(devs[i].name, names[i]);
+ devs[i].type = DEVICE_TYPE_DISK;
+ }
+ devs[i].name[0] = '\0';
+ free(names);
+ }
+ }
+ /* put detection for other classes here just as soon as I figure out how */
+ return devs;
+}
+
+void
+device_print_chunk(struct chunk *c1, int offset, int *row)
+{
+ CHAR_N
+
+ if (!c1)
+ return;
+ mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
+ c1->offset, c1->size, c1->end, c1->name, c1->type,
+ chunk_n[c1->type], c1->subtype, c1->flags);
+ device_print_chunk(c1->part, offset + 2, row);
+ device_print_chunk(c1->next, offset, row);
+}
+
+int
+device_slice_disk(char *disk)
+{
+ struct disk *d;
+ char *p;
+ int row;
+
+ d = Open_Disk(disk);
+ if (!d)
+ msgFatal("Couldn't open disk `%s'!", disk);
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ dialog_clear();
+ while (1) {
+ clear();
+ mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
+ mvprintw(1, 0,
+ "Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
+ d->real_cyl, d->real_hd, d->real_sect,
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ row = 5;
+ device_print_chunk(d->chunks, 0, &row);
+ move(23, 0);
+ addstr("Done!");
+ if (getch() == 'q')
+ return 0;
+ }
+ return 0;
+}
diff --git a/release/sysinstall/dmenu.c b/release/sysinstall/dmenu.c
index f49e4cd..36bc88c 100644
--- a/release/sysinstall/dmenu.c
+++ b/release/sysinstall/dmenu.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: dmenu.c,v 1.2 1995/04/27 18:03:52 jkh Exp $
+ * $Id: dmenu.c,v 1.3 1995/04/29 19:33:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,7 +63,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
char *title = tmp->title;
char *prompt = tmp->prompt;
- if (menu->options & DMENU_RADIO_TYPE) {
+ if (menu->options & (DMENU_RADIO_TYPE | DMENU_MULTIPLE_TYPE)) {
if (*title == '*') {
addme = "ON";
++title;
@@ -80,11 +80,11 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
nitems = item_add(nitems, NULL, curr, max); /* Terminate it */
while (1) {
+ char buf[FILENAME_MAX];
+
/* Any helpful hints, put 'em up! */
- if (menu->helpline)
- use_helpline(menu->helpline);
- if (menu->helpfile)
- use_helpfile(menu->helpfile);
+ use_helpline(menu->helpline);
+ use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
if (menu->options & DMENU_NORMAL_TYPE) {
@@ -106,17 +106,30 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
(unsigned char **)nitems,
(unsigned char *)result);
}
+ else if (menu->options & DMENU_MULTIPLE_TYPE) {
+ rval = dialog_checklist((unsigned char *)menu->title,
+ (unsigned char *)menu->prompt,
+ -1, -1,
+ n > MAX_MENU ? MAX_MENU : n,
+ n,
+ (unsigned char **)nitems,
+ (unsigned char *)result);
+ }
dialog_clear();
if (!rval) {
- for (tmp = menu->items; tmp->title; tmp++)
- if (!strcmp(result,
- (*tmp->title == '*') ? tmp->title + 1 :
- tmp->title))
- break;
- if (!tmp->title)
- msgFatal("Menu item `%s' not found??", result);
+ if (menu->options & DMENU_MULTIPLE_TYPE)
+ tmp = &(menu->items[0]);
+ else {
+ for (tmp = menu->items; tmp->title; tmp++)
+ if (!strcmp(result,
+ (*tmp->title == '*') ? tmp->title + 1 :
+ tmp->title))
+ break;
+ if (!tmp->title)
+ msgFatal("Menu item `%s' not found??", result);
+ }
}
- else if (rval == 255)
+ else if (rval == -1)
tmp = &shellAction;
else {
items_free(nitems, curr, max);
@@ -149,11 +162,14 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
/* Same as above, but execute it in a prgbox */
case DMENU_SYSTEM_COMMAND_BOX:
+ use_helpfile(NULL);
+ use_helpline("Select OK to dismiss this dialog");
dialog_prgbox(tmp->title, (char *)tmp->ptr, 22, 76, 1, 1);
+ dialog_clear();
break;
case DMENU_CALL:
- if (((int (*)())tmp->ptr)()) {
+ if (((int (*)())tmp->ptr)(result)) {
items_free(nitems, curr, max);
return;
}
@@ -163,20 +179,9 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
- case DMENU_SET_VARIABLE: {
- Variable *newvar;
-
- if (!index((char *)tmp->ptr, '='))
- msgWarn("Improperly formatted variable: %s", tmp->ptr);
- putenv((char *)tmp->ptr);
- newvar = (Variable *)malloc(sizeof(Variable));
- if (!newvar)
- msgFatal("Out of Memory!");
- strncpy(newvar->value, tmp->ptr, 1024);
- newvar->next = VarHead;
- VarHead = newvar;
- msgInfo("Setting option %s", newvar->value);
- }
+ case DMENU_SET_VARIABLE:
+ variable_set((char *)tmp->ptr);
+ msgInfo("Setting option %s", tmp->ptr);
break;
default:
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index ee1efa0..23ad2d2 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ * $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -43,22 +43,145 @@
#include "sysinstall.h"
+static int
+installHook(char *str)
+{
+ int rcode = 0;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ while (str) {
+ char *cp;
+
+ cp = index(str, ' ');
+ if (cp)
+ *cp++ = 0;
+ rcode = !device_slice_disk(str);
+ str = cp;
+ }
+ return rcode;
+}
+
+/* Create a menu listing all the devices in the system. */
+static DMenu *
+getAllDisks(DMenu *menu, Device **rdevs)
+{
+ Device *devices;
+ int numdevs;
+
+ devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
+ *rdevs = devices;
+ if (!devices) {
+ msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully.");
+ return NULL;
+ }
+ else {
+ Device *start;
+ DMenu *tmp;
+ int i;
+
+ tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
+ (sizeof(DMenuItem) * (numdevs + 1)));
+ bcopy(menu, tmp, sizeof(DMenu));
+ for (start = devices, i = 0; start->name[0]; start++, i++) {
+ tmp->items[i].title = start->name;
+ if (!strncmp(start->name, "sd", 2))
+ tmp->items[i].prompt = "SCSI disk";
+ else if (!strncmp(start->name, "wd", 2))
+ tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
+ else
+ msgFatal("Unknown disk type: %s!", start->name);
+ tmp->items[i].type = DMENU_CALL;
+ tmp->items[i].ptr = installHook;
+ tmp->items[i].disabled = FALSE;
+ }
+ tmp->items[i].type = DMENU_NOP;
+ tmp->items[i].title = NULL;
+ return tmp;
+ }
+}
+
int
-installCustom(void)
+installCustom(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system custom");
- return 0;
+ variable_set2("install_type", "custom");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
}
int
-installExpress(void)
+installExpress(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system express");
+ variable_set2("install_type", "express");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
+}
+
+int
+installMaint(char *str)
+{
+ msgConfirm("Sorry, maintainance mode is not implemented in this version.");
+ return 0;
+}
+
+int
+installSetDeveloper(char *str)
+{
+ /* Dists = DIST_BIN | DIST_MAN | DIST_FOO; */
+ return 0;
+}
+
+int
+installSetXDeveloper(char *str)
+{
+ return 0;
+}
+
+int
+installSetUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetXUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetMinimum(char *str)
+{
return 0;
}
int
-installMaint(void)
+installSetEverything(char *str)
{
return 0;
}
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index b6febca..4e9b72a 100644
--- a/release/sysinstall/media.c
+++ b/release/sysinstall/media.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: media.c,v 1.1 1995/04/27 18:05:10 jkh Exp $
+ * $Id: media.c,v 1.2 1995/04/29 19:33:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -46,7 +46,7 @@
* be a CD.
*/
int
-mediaSetCDROM(void)
+mediaSetCDROM(char *str)
{
return 0;
}
@@ -56,7 +56,7 @@ mediaSetCDROM(void)
* be a floppy
*/
int
-mediaSetFloppy(void)
+mediaSetFloppy(char *str)
{
return 0;
}
@@ -66,7 +66,7 @@ mediaSetFloppy(void)
* be a DOS partition.
*/
int
-mediaSetDOS(void)
+mediaSetDOS(char *str)
{
return 0;
}
@@ -76,7 +76,7 @@ mediaSetDOS(void)
* be a tape drive.
*/
int
-mediaSetTape(void)
+mediaSetTape(char *str)
{
return 0;
}
@@ -86,7 +86,7 @@ mediaSetTape(void)
* be an ftp server
*/
int
-mediaSetFTP(void)
+mediaSetFTP(char *str)
{
return 0;
}
@@ -96,7 +96,7 @@ mediaSetFTP(void)
* be some sort of mounted filesystem (it's also mounted at this point)
*/
int
-mediaSetFS(void)
+mediaSetFS(char *str)
{
return 0;
}
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index c4afad5..40180137 100644
--- a/release/sysinstall/menus.c
+++ b/release/sysinstall/menus.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: menus.c,v 1.2 1995/04/27 18:03:54 jkh Exp $
+ * $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,10 +50,12 @@
* expansion.
*/
+/* Forward decls for submenus */
extern DMenu MenuDocumentation;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
+extern DMenu MenuDistributions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -63,10 +65,10 @@ DMenu MenuInitial = {
select one of the options below by using the arrow keys or typing the\n\
first character of the option name you're interested in. Invoke an\n\
option by pressing enter.", /* prompt */
- "Press F1 for further help", /* help line */
- "help/initial.hlp", /* help file */
+ "Press F1 for usage instructions", /* help line */
+ "usage.hlp", /* help file */
{ { "Usage", "Quick start - How to use this menu system.", /* U */
- DMENU_DISPLAY_FILE, (void *)"help/initial.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0 },
{ "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
{ "Lang", "Select natural language options.", /* L */
@@ -77,6 +79,8 @@ option by pressing enter.", /* prompt */
DMENU_CALL, (void *)installCustom, 0 },
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
DMENU_CALL, (void *)installMaint, 0 },
+ { "Bootmsg", "Read the boot messages again.", /* B */
+ DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
{ NULL } },
};
@@ -90,16 +94,16 @@ Hardware guide! New users should also read the Install document for\n\
a step-by-step tutorial on installing FreeBSD. For general information,\n\
consult the README file. If you're having other problems, you may find\n\
answers in the FAQ.",
- "Having trouble? Press F1 for help!", /* help line */
- "help/usage.hlp", /* help file */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
{ { "README", "Read this for a general description of FreeBSD", /* R */
- DMENU_DISPLAY_FILE, (void *)"help/readme.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"readme.hlp", 0 },
{ "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
- DMENU_DISPLAY_FILE, (void *)"help/hardware.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0 },
{ "Install", "A step-by-step guide to installing FreeBSD.", /* I */
- DMENU_DISPLAY_FILE, (void *)"help/install.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"install.hlp", 0 },
{ "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
- DMENU_DISPLAY_FILE, (void *)"help/faq.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0 },
{ NULL } },
};
@@ -113,25 +117,31 @@ DMenu MenuLanguage = {
DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
"Natural language selection", /* title */
"Please specify the language you'd like to use by default.\n\n\
-While almost all of the system's documentation is still\n\
-written in english (and may never be translated), there are a few\n\
-guides and types of system documentation that may be written in your\n\
+While almost all of the system's documentation is still written\n\
+in english (and may never be translated), there are a few guides\n\
+and types of system documentation that may be written in your\n\
preferred language. When such are found, they will be used instead\n\
of the english versions.", /* prompt */
"Press F1 for more information", /* help line */
- "help/language.hlp", /* help file */
+ "language.hlp", /* help file */
{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=da_DK.ISO8859-1", 0 },
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ DMENU_SET_VARIABLE, (void *)"LANG=nl_NL.ISO8859-1", 0 },
{ "*English", "English language (system default)", /* E */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=en_US.ISO8859-1", 0 },
{ "French", "French language and character set (ISO-8859-1)", /* F */
- DMENU_SET_VARIABLE, (void *)"LANG=fr", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=fr_FR.ISO8859-1", 0 },
{ "German", "German language and character set (ISO-8859-1)", /* G */
- DMENU_SET_VARIABLE, (void *)"LANG=de", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=de_DE.ISO8859-1", 0 },
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ DMENU_SET_VARIABLE, (void *)"LANG=it_IT.ISO8859-1", 0 },
{ "Japanese", "Japanese language and character set (JIS?)", /* J */
- DMENU_SET_VARIABLE, (void *)"LANG=jp", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ja_JP.EUC", 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
- DMENU_SET_VARIABLE, (void *)"LANG=ru", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
{ NULL } },
};
@@ -140,11 +150,13 @@ DMenu MenuMedia = {
DMENU_NORMAL_TYPE,
"Choose Installation Media",
"FreeBSD can be installed from a variety of different installation\n\
-media, from floppies to the Internet. If you're installing FreeBSD from\n\
-a supported CDROM drive then this is generally the best method to\n\
-use unless you have some overriding reason for using another method.",
+media, ranging from floppies to the Internet. If you're installing\n\
+FreeBSD from a supported CDROM drive then this is generally the best\n\
+method to use unless you have some overriding reason for using another\n\
+method. Please also note that the DES distribution is NOT available on \n\
+CDROM due to U.S. export restrictions.",
"Press F1 for more information on the various media types",
- "help/media.hlp",
+ "media.hlp",
{ { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0 },
{ "FLOPPY", "Install from a floppy disk set",
@@ -164,10 +176,58 @@ use unless you have some overriding reason for using another method.",
DMenu MenuInstallType = {
DMENU_NORMAL_TYPE,
"Choose Installation Type",
- "blah blah",
- NULL,
- NULL,
- { { NULL } },
+ "As a convenience, we provide several `canned' installation types. \
+These pick what we consider to be the most reasonable defaults for the \
+type of system in question. If you would prefer to pick and choose \
+the list of distributions yourself, simply select `custom'.",
+ "Press F1 for more information on the various distributions",
+ "install_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
+ DMENU_CALL, (void *)installSetDeveloper, 0 },
+ { "X-Developer", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXDeveloper, 0 },
+ { "User", "General user. Binaries and doc but no sources.",
+ DMENU_CALL, (void *)installSetUser, 0 },
+ { "X-User", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXUser, 0 },
+ { "Minimal", "The smallest configuration possible.",
+ DMENU_CALL, (void *)installSetMinimum, 0 },
+ { "Everything", "The entire kitchen sink, plus bedroom suite.",
+ DMENU_CALL, (void *)installSetEverything, 0 },
+ { "Custom", "I don't want it canned! I want to drive!",
+ DMENU_SUBMENU, (void *)&MenuDistributions, 0 },
+ { NULL } },
+};
+
+DMenu MenuDistributions = {
+ DMENU_MULTIPLE_TYPE,
+ "Select the distributions you wish to install.",
+ "Please check off the distributions you wish to install.",
+ "Press F1 for a more complete description of these distributions.",
+ "distribution_types.hlp",
+ { { "*bin", "Binary base distribution (required)",
+ DMENU_NOP, NULL, 0 },
+ { "commercial", "Commercial demos and shareware",
+ DMENU_NOP, NULL, 0 },
+ { "compat1x", "FreeBSD 1.x binary compatability package",
+ DMENU_NOP, NULL, 0 },
+ { "DES", "DES encryption code and sources",
+ DMENU_NOP, NULL, 0 },
+ { "dict", "Spelling checker disctionary files",
+ DMENU_NOP, NULL, 0 },
+ { "games", "Games and other amusements (non-commercial)",
+ DMENU_NOP, NULL, 0 },
+ { "info", "GNU info files",
+ DMENU_NOP, NULL, 0 },
+ { "man", "System manual pages - strongly recommended",
+ DMENU_NOP, NULL, 0 },
+ { "proflibs", "Profiled versions of the libraries",
+ DMENU_NOP, NULL, 0 },
+ { "src", "Sources for everything but DES",
+ DMENU_NOP, NULL, 0 },
+ { "XFree86", "The XFree86 3.1.1 distribution",
+ DMENU_NOP, NULL, 0 },
+ { NULL } },
};
/* The installation options menu */
@@ -180,6 +240,20 @@ DMenu MenuInstallOptions = {
{ { NULL } },
};
+DMenu MenuDiskDevices = {
+ DMENU_MULTIPLE_TYPE,
+ "Select Drive(s)",
+ "Please select the drive, or drives, on which you wish to install\n\
+FreeBSD. You need to select at least one drive containing some free\n\
+space, though FreeBSD can be installed across several drives if you do\n\
+not have the required space on a single drive. If you wish to boot\n\
+off a drive that's not a `zero drive', you will have the option to install\n\
+a boot manager later.",
+ "drives.hlp",
+ "Press F1 for more information on what you see here.",
+ { { NULL } },
+};
+
/* The main installation menu */
DMenu MenuInstall = {
DMENU_NORMAL_TYPE,
@@ -190,7 +264,7 @@ of installation you want to have (and where). There are also a number\n\
of options you can specify in the Options menu. If you do not wish to\n\
install FreeBSD at this time, you may select Cancel to leave this menu",
"You may wish to read the install guide - press F1 to do so",
- "help/install.hlp",
+ "install.hlp",
{ { "Media", "Choose Installation media type", /* M */
DMENU_SUBMENU, (void *)&MenuMedia, 0 },
{ "Type", "Choose the type of installation you want", /* T */
diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c
index 4f789e2..794c498 100644
--- a/release/sysinstall/misc.c
+++ b/release/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.1.1.1 1995/04/27 12:50:35 jkh Exp $
+ * $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -98,6 +98,18 @@ safe_free(void *ptr)
free(ptr);
}
+/* A malloc that checks errors */
+void *
+safe_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (!ptr)
+ msgFatal("Out of memory!");
+ return ptr;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c
index c9fd5ce..bbb918b 100644
--- a/release/sysinstall/msg.c
+++ b/release/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id$
+ * $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -129,3 +129,38 @@ msgFatal(char *fmt, ...)
systemShutdown();
}
+/* Put up a message in a popup confirmation box */
+void
+msgConfirm(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_mesgbox("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+}
+
+/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
+int
+msgYesNo(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+ int ret;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ ret = dialog_yesno("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+ return ret;
+}
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 1b318f4..525afd1 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.2 1995/04/27 18:03:55 jkh Exp $
+ * $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,13 +50,23 @@
#include <unistd.h>
#include <dialog.h>
+/*** Defines ***/
+
/* Bitfields for menu options */
#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */
#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */
#define DMENU_MULTIPLE_TYPE 0x4 /* Multiple choice menu */
#define DMENU_SELECTION_RETURNS 0x8 /* Select item then exit */
-/* Types */
+/* variable limits */
+#define VAR_NAME_MAX 128
+#define VAR_VALUE_MAX 1024
+
+/* device limits */
+#define DEV_NAME_MAX 128
+
+
+/*** Types ***/
typedef unsigned int Boolean;
typedef enum {
@@ -68,6 +78,7 @@ typedef enum {
DMENU_SET_VARIABLE, /* Set an environment/system var */
DMENU_CALL, /* Call back a C function */
DMENU_CANCEL, /* Cancel out of this menu */
+ DMENU_NOP, /* Do nothing special for item */
} DMenuItemType;
typedef struct _dmenuItem {
@@ -75,7 +86,7 @@ typedef struct _dmenuItem {
char *prompt; /* Our prompt */
DMenuItemType type; /* What type of item we are */
void *ptr; /* Generic data ptr */
- int disabled; /* Are we temporarily disabled? */
+ Boolean disabled; /* Are we temporarily disabled? */
} DMenuItem;
typedef struct _dmenu {
@@ -90,11 +101,29 @@ typedef struct _dmenu {
/* A sysconfig variable */
typedef struct _variable {
struct _variable *next;
- char value[1024];
+ char name[VAR_NAME_MAX];
+ char value[VAR_VALUE_MAX];
} Variable;
-
-/* Externs */
+typedef enum {
+ DEVICE_TYPE_ANY,
+ DEVICE_TYPE_DISK,
+ DEVICE_TYPE_FLOPPY,
+ DEVICE_TYPE_NETWORK,
+ DEVICE_TYPE_CDROM,
+ DEVICE_TYPE_TAPE,
+ DEVICE_TYPE_SERIAL,
+ DEVICE_TYPE_PARALLEL,
+} DeviceType;
+
+/* A "device" from sysinstall's point of view */
+typedef struct _device {
+ char name[DEV_NAME_MAX];
+ DeviceType type;
+} Device;
+
+
+/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
extern int DebugFD; /* Where diagnostic output goes */
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
@@ -106,15 +135,21 @@ extern Variable *VarHead; /* The head of the variable chain */
extern DMenu MenuDocumenation, MenuInitial, MenuLanguage;
-/* Prototypes */
+/*** Prototypes ***/
/* globals.c */
extern void globalsInit(void);
/* install.c */
-extern int installCustom(void);
-extern int installExpress(void);
-extern int installMaint(void);
+extern int installCustom(char *str);
+extern int installExpress(char *str);
+extern int installMaint(char *str);
+extern int installSetDeveloper(char *str);
+extern int installSetXDeveloper(char *str);
+extern int installSetUser(char *str);
+extern int installSetXUser(char *str);
+extern int installSetMinimum(char *str);
+extern int installSetEverything(char *str);
/* system.c */
extern void systemInitialize(int argc, char **argv);
@@ -123,6 +158,7 @@ extern void systemWelcome(void);
extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
+extern char *systemHelpFile(char *file, char *buf);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
@@ -135,6 +171,7 @@ extern char *string_concat(char *p1, char *p2);
extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
+extern void *safe_malloc(size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);
@@ -148,14 +185,24 @@ extern void msgInfo(char *fmt, ...);
extern void msgWarn(char *fmt, ...);
extern void msgError(char *fmt, ...);
extern void msgFatal(char *fmt, ...);
+extern void msgConfirm(char *fmt, ...);
+extern int msgYesNo(char *fmt, ...);
/* media.c */
-extern int mediaSetCDROM(void);
-extern int mediaSetFloppy(void);
-extern int mediaSetDOS(void);
-extern int mediaSetTape(void);
-extern int mediaSetFTP(void);
-extern int mediaSetFS(void);
+extern int mediaSetCDROM(char *str);
+extern int mediaSetFloppy(char *str);
+extern int mediaSetDOS(char *str);
+extern int mediaSetTape(char *str);
+extern int mediaSetFTP(char *str);
+extern int mediaSetFS(char *str);
+
+/* devices.c */
+extern Device *device_get_all(DeviceType type, int *ndevs);
+extern int device_slice_disk(char *disk);
+
+/* variables.c */
+extern void variable_set(char *var);
+extern void variable_set2(char *name, char *value);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index cbf7549..4e59d9b 100644
--- a/release/sysinstall/system.c
+++ b/release/sysinstall/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
+ * $Id: system.c,v 1.2 1995/04/29 19:33:06 jkh Exp $
*
* Jordan Hubbard
*
@@ -128,7 +128,7 @@ systemShellEscape(void)
dialog_update();
move(0, 0);
standout();
- addstr("Type `exit' to leave this shell and continue installallation");
+ addstr("Type `exit' to leave this shell and continue installation");
standend();
refresh();
end_dialog();
@@ -146,30 +146,56 @@ systemShellEscape(void)
int
systemDisplayFile(char *file)
{
- char buf[FILENAME_MAX], *cp, *fname = NULL;
+ char *fname = NULL;
+ char buf[FILENAME_MAX];
- if (file_readable(file))
- fname = file;
- else if ((cp = getenv("LANG")) != NULL) {
- snprintf(buf, FILENAME_MAX, "%s/%s", cp, file);
- if (file_readable(buf))
- fname = buf;
- }
- else {
- snprintf(buf, FILENAME_MAX, "english/%s", file);
- if (file_readable(buf))
- fname = buf;
- }
+ fname = systemHelpFile(file, buf);
if (!fname) {
snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file);
- dialog_msgbox("Sorry!", buf, -1, -1, 1);
+ use_helpfile(NULL);
+ use_helpline(NULL);
+ dialog_mesgbox("Sorry!", buf, -1, -1);
dialog_clear_norefresh();
return 1;
}
else {
dialog_clear_norefresh();
+ use_helpfile(NULL);
+ use_helpline(NULL);
dialog_textbox(file, fname, LINES, COLS);
dialog_clear_norefresh();
}
return 0;
}
+
+char *
+systemHelpFile(char *file, char *buf)
+{
+ char *cp, *fname = NULL;
+
+ if (!file)
+ return NULL;
+
+ if ((cp = getenv("LANG")) != NULL) {
+ snprintf(buf, FILENAME_MAX, "help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ else {
+ snprintf(buf, FILENAME_MAX, "help/en_US.ISO8859-1/%s", file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/en_US.ISO8859-1/%s",
+ file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ return fname;
+}
diff --git a/release/sysinstall/variable.c b/release/sysinstall/variable.c
new file mode 100644
index 0000000..5a64f91
--- /dev/null
+++ b/release/sysinstall/variable.c
@@ -0,0 +1,80 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+
+/* Routines for dealing with variable lists */
+
+void
+variable_set(char *var)
+{
+ char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
+ Variable *newvar;
+
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
+ if ((cp = index(tmp, '=')) == NULL)
+ msgFatal("Invalid variable format: %s", var);
+ *cp = '\0';
+ strncpy(newvar->name, tmp, VAR_NAME_MAX);
+ strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
+
+void
+variable_set2(char *var, char *value)
+{
+ Variable *newvar;
+
+ if (!var || !value)
+ msgFatal("Null name or value passed to set_variable2!");
+ setenv(var, value, 1);
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(newvar->name, var, VAR_NAME_MAX);
+ strncpy(newvar->value, value, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 84f5c1d..62b3c37 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -6,10 +6,13 @@ CLEANFILES= makedevs.c rtermcap
SRCS = globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
- termcap.c makedevs.c media.c
+ termcap.c makedevs.c media.c variable.c \
+ devices.c
+
+CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
+
+LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
-CFLAGS += -Wall -g -static
-LDADD = -ldialog -lncurses -lmytinfo
DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
new file mode 100644
index 0000000..0f57283
--- /dev/null
+++ b/usr.sbin/sade/devices.c
@@ -0,0 +1,122 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+#include "libdisk.h"
+
+/* Get all device information for a given device class */
+Device *
+device_get_all(DeviceType which, int *ndevs)
+{
+ char **names;
+ Device *devs = NULL;
+
+ *ndevs = 0;
+ if (which == DEVICE_TYPE_DISK || which == DEVICE_TYPE_ANY) {
+ if ((names = Disk_Names()) != NULL) {
+ int i;
+
+ for (i = 0; names[i]; i++)
+ ++*ndevs;
+ devs = safe_malloc(sizeof(Device) * (*ndevs + 1));
+ for (i = 0; names[i]; i++) {
+ strcpy(devs[i].name, names[i]);
+ devs[i].type = DEVICE_TYPE_DISK;
+ }
+ devs[i].name[0] = '\0';
+ free(names);
+ }
+ }
+ /* put detection for other classes here just as soon as I figure out how */
+ return devs;
+}
+
+void
+device_print_chunk(struct chunk *c1, int offset, int *row)
+{
+ CHAR_N
+
+ if (!c1)
+ return;
+ mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
+ c1->offset, c1->size, c1->end, c1->name, c1->type,
+ chunk_n[c1->type], c1->subtype, c1->flags);
+ device_print_chunk(c1->part, offset + 2, row);
+ device_print_chunk(c1->next, offset, row);
+}
+
+int
+device_slice_disk(char *disk)
+{
+ struct disk *d;
+ char *p;
+ int row;
+
+ d = Open_Disk(disk);
+ if (!d)
+ msgFatal("Couldn't open disk `%s'!", disk);
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ dialog_clear();
+ while (1) {
+ clear();
+ mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
+ mvprintw(1, 0,
+ "Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
+ d->real_cyl, d->real_hd, d->real_sect,
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ row = 5;
+ device_print_chunk(d->chunks, 0, &row);
+ move(23, 0);
+ addstr("Done!");
+ if (getch() == 'q')
+ return 0;
+ }
+ return 0;
+}
diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c
index f49e4cd..36bc88c 100644
--- a/usr.sbin/sade/dmenu.c
+++ b/usr.sbin/sade/dmenu.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: dmenu.c,v 1.2 1995/04/27 18:03:52 jkh Exp $
+ * $Id: dmenu.c,v 1.3 1995/04/29 19:33:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,7 +63,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
char *title = tmp->title;
char *prompt = tmp->prompt;
- if (menu->options & DMENU_RADIO_TYPE) {
+ if (menu->options & (DMENU_RADIO_TYPE | DMENU_MULTIPLE_TYPE)) {
if (*title == '*') {
addme = "ON";
++title;
@@ -80,11 +80,11 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
nitems = item_add(nitems, NULL, curr, max); /* Terminate it */
while (1) {
+ char buf[FILENAME_MAX];
+
/* Any helpful hints, put 'em up! */
- if (menu->helpline)
- use_helpline(menu->helpline);
- if (menu->helpfile)
- use_helpfile(menu->helpfile);
+ use_helpline(menu->helpline);
+ use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
if (menu->options & DMENU_NORMAL_TYPE) {
@@ -106,17 +106,30 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
(unsigned char **)nitems,
(unsigned char *)result);
}
+ else if (menu->options & DMENU_MULTIPLE_TYPE) {
+ rval = dialog_checklist((unsigned char *)menu->title,
+ (unsigned char *)menu->prompt,
+ -1, -1,
+ n > MAX_MENU ? MAX_MENU : n,
+ n,
+ (unsigned char **)nitems,
+ (unsigned char *)result);
+ }
dialog_clear();
if (!rval) {
- for (tmp = menu->items; tmp->title; tmp++)
- if (!strcmp(result,
- (*tmp->title == '*') ? tmp->title + 1 :
- tmp->title))
- break;
- if (!tmp->title)
- msgFatal("Menu item `%s' not found??", result);
+ if (menu->options & DMENU_MULTIPLE_TYPE)
+ tmp = &(menu->items[0]);
+ else {
+ for (tmp = menu->items; tmp->title; tmp++)
+ if (!strcmp(result,
+ (*tmp->title == '*') ? tmp->title + 1 :
+ tmp->title))
+ break;
+ if (!tmp->title)
+ msgFatal("Menu item `%s' not found??", result);
+ }
}
- else if (rval == 255)
+ else if (rval == -1)
tmp = &shellAction;
else {
items_free(nitems, curr, max);
@@ -149,11 +162,14 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
/* Same as above, but execute it in a prgbox */
case DMENU_SYSTEM_COMMAND_BOX:
+ use_helpfile(NULL);
+ use_helpline("Select OK to dismiss this dialog");
dialog_prgbox(tmp->title, (char *)tmp->ptr, 22, 76, 1, 1);
+ dialog_clear();
break;
case DMENU_CALL:
- if (((int (*)())tmp->ptr)()) {
+ if (((int (*)())tmp->ptr)(result)) {
items_free(nitems, curr, max);
return;
}
@@ -163,20 +179,9 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
- case DMENU_SET_VARIABLE: {
- Variable *newvar;
-
- if (!index((char *)tmp->ptr, '='))
- msgWarn("Improperly formatted variable: %s", tmp->ptr);
- putenv((char *)tmp->ptr);
- newvar = (Variable *)malloc(sizeof(Variable));
- if (!newvar)
- msgFatal("Out of Memory!");
- strncpy(newvar->value, tmp->ptr, 1024);
- newvar->next = VarHead;
- VarHead = newvar;
- msgInfo("Setting option %s", newvar->value);
- }
+ case DMENU_SET_VARIABLE:
+ variable_set((char *)tmp->ptr);
+ msgInfo("Setting option %s", tmp->ptr);
break;
default:
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index ee1efa0..23ad2d2 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ * $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -43,22 +43,145 @@
#include "sysinstall.h"
+static int
+installHook(char *str)
+{
+ int rcode = 0;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ while (str) {
+ char *cp;
+
+ cp = index(str, ' ');
+ if (cp)
+ *cp++ = 0;
+ rcode = !device_slice_disk(str);
+ str = cp;
+ }
+ return rcode;
+}
+
+/* Create a menu listing all the devices in the system. */
+static DMenu *
+getAllDisks(DMenu *menu, Device **rdevs)
+{
+ Device *devices;
+ int numdevs;
+
+ devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
+ *rdevs = devices;
+ if (!devices) {
+ msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully.");
+ return NULL;
+ }
+ else {
+ Device *start;
+ DMenu *tmp;
+ int i;
+
+ tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
+ (sizeof(DMenuItem) * (numdevs + 1)));
+ bcopy(menu, tmp, sizeof(DMenu));
+ for (start = devices, i = 0; start->name[0]; start++, i++) {
+ tmp->items[i].title = start->name;
+ if (!strncmp(start->name, "sd", 2))
+ tmp->items[i].prompt = "SCSI disk";
+ else if (!strncmp(start->name, "wd", 2))
+ tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
+ else
+ msgFatal("Unknown disk type: %s!", start->name);
+ tmp->items[i].type = DMENU_CALL;
+ tmp->items[i].ptr = installHook;
+ tmp->items[i].disabled = FALSE;
+ }
+ tmp->items[i].type = DMENU_NOP;
+ tmp->items[i].title = NULL;
+ return tmp;
+ }
+}
+
int
-installCustom(void)
+installCustom(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system custom");
- return 0;
+ variable_set2("install_type", "custom");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
}
int
-installExpress(void)
+installExpress(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system express");
+ variable_set2("install_type", "express");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
+}
+
+int
+installMaint(char *str)
+{
+ msgConfirm("Sorry, maintainance mode is not implemented in this version.");
+ return 0;
+}
+
+int
+installSetDeveloper(char *str)
+{
+ /* Dists = DIST_BIN | DIST_MAN | DIST_FOO; */
+ return 0;
+}
+
+int
+installSetXDeveloper(char *str)
+{
+ return 0;
+}
+
+int
+installSetUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetXUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetMinimum(char *str)
+{
return 0;
}
int
-installMaint(void)
+installSetEverything(char *str)
{
return 0;
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index c4afad5..40180137 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: menus.c,v 1.2 1995/04/27 18:03:54 jkh Exp $
+ * $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,10 +50,12 @@
* expansion.
*/
+/* Forward decls for submenus */
extern DMenu MenuDocumentation;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
+extern DMenu MenuDistributions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -63,10 +65,10 @@ DMenu MenuInitial = {
select one of the options below by using the arrow keys or typing the\n\
first character of the option name you're interested in. Invoke an\n\
option by pressing enter.", /* prompt */
- "Press F1 for further help", /* help line */
- "help/initial.hlp", /* help file */
+ "Press F1 for usage instructions", /* help line */
+ "usage.hlp", /* help file */
{ { "Usage", "Quick start - How to use this menu system.", /* U */
- DMENU_DISPLAY_FILE, (void *)"help/initial.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0 },
{ "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
{ "Lang", "Select natural language options.", /* L */
@@ -77,6 +79,8 @@ option by pressing enter.", /* prompt */
DMENU_CALL, (void *)installCustom, 0 },
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
DMENU_CALL, (void *)installMaint, 0 },
+ { "Bootmsg", "Read the boot messages again.", /* B */
+ DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
{ NULL } },
};
@@ -90,16 +94,16 @@ Hardware guide! New users should also read the Install document for\n\
a step-by-step tutorial on installing FreeBSD. For general information,\n\
consult the README file. If you're having other problems, you may find\n\
answers in the FAQ.",
- "Having trouble? Press F1 for help!", /* help line */
- "help/usage.hlp", /* help file */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
{ { "README", "Read this for a general description of FreeBSD", /* R */
- DMENU_DISPLAY_FILE, (void *)"help/readme.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"readme.hlp", 0 },
{ "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
- DMENU_DISPLAY_FILE, (void *)"help/hardware.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0 },
{ "Install", "A step-by-step guide to installing FreeBSD.", /* I */
- DMENU_DISPLAY_FILE, (void *)"help/install.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"install.hlp", 0 },
{ "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
- DMENU_DISPLAY_FILE, (void *)"help/faq.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0 },
{ NULL } },
};
@@ -113,25 +117,31 @@ DMenu MenuLanguage = {
DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
"Natural language selection", /* title */
"Please specify the language you'd like to use by default.\n\n\
-While almost all of the system's documentation is still\n\
-written in english (and may never be translated), there are a few\n\
-guides and types of system documentation that may be written in your\n\
+While almost all of the system's documentation is still written\n\
+in english (and may never be translated), there are a few guides\n\
+and types of system documentation that may be written in your\n\
preferred language. When such are found, they will be used instead\n\
of the english versions.", /* prompt */
"Press F1 for more information", /* help line */
- "help/language.hlp", /* help file */
+ "language.hlp", /* help file */
{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=da_DK.ISO8859-1", 0 },
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ DMENU_SET_VARIABLE, (void *)"LANG=nl_NL.ISO8859-1", 0 },
{ "*English", "English language (system default)", /* E */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=en_US.ISO8859-1", 0 },
{ "French", "French language and character set (ISO-8859-1)", /* F */
- DMENU_SET_VARIABLE, (void *)"LANG=fr", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=fr_FR.ISO8859-1", 0 },
{ "German", "German language and character set (ISO-8859-1)", /* G */
- DMENU_SET_VARIABLE, (void *)"LANG=de", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=de_DE.ISO8859-1", 0 },
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ DMENU_SET_VARIABLE, (void *)"LANG=it_IT.ISO8859-1", 0 },
{ "Japanese", "Japanese language and character set (JIS?)", /* J */
- DMENU_SET_VARIABLE, (void *)"LANG=jp", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ja_JP.EUC", 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
- DMENU_SET_VARIABLE, (void *)"LANG=ru", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
{ NULL } },
};
@@ -140,11 +150,13 @@ DMenu MenuMedia = {
DMENU_NORMAL_TYPE,
"Choose Installation Media",
"FreeBSD can be installed from a variety of different installation\n\
-media, from floppies to the Internet. If you're installing FreeBSD from\n\
-a supported CDROM drive then this is generally the best method to\n\
-use unless you have some overriding reason for using another method.",
+media, ranging from floppies to the Internet. If you're installing\n\
+FreeBSD from a supported CDROM drive then this is generally the best\n\
+method to use unless you have some overriding reason for using another\n\
+method. Please also note that the DES distribution is NOT available on \n\
+CDROM due to U.S. export restrictions.",
"Press F1 for more information on the various media types",
- "help/media.hlp",
+ "media.hlp",
{ { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0 },
{ "FLOPPY", "Install from a floppy disk set",
@@ -164,10 +176,58 @@ use unless you have some overriding reason for using another method.",
DMenu MenuInstallType = {
DMENU_NORMAL_TYPE,
"Choose Installation Type",
- "blah blah",
- NULL,
- NULL,
- { { NULL } },
+ "As a convenience, we provide several `canned' installation types. \
+These pick what we consider to be the most reasonable defaults for the \
+type of system in question. If you would prefer to pick and choose \
+the list of distributions yourself, simply select `custom'.",
+ "Press F1 for more information on the various distributions",
+ "install_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
+ DMENU_CALL, (void *)installSetDeveloper, 0 },
+ { "X-Developer", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXDeveloper, 0 },
+ { "User", "General user. Binaries and doc but no sources.",
+ DMENU_CALL, (void *)installSetUser, 0 },
+ { "X-User", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXUser, 0 },
+ { "Minimal", "The smallest configuration possible.",
+ DMENU_CALL, (void *)installSetMinimum, 0 },
+ { "Everything", "The entire kitchen sink, plus bedroom suite.",
+ DMENU_CALL, (void *)installSetEverything, 0 },
+ { "Custom", "I don't want it canned! I want to drive!",
+ DMENU_SUBMENU, (void *)&MenuDistributions, 0 },
+ { NULL } },
+};
+
+DMenu MenuDistributions = {
+ DMENU_MULTIPLE_TYPE,
+ "Select the distributions you wish to install.",
+ "Please check off the distributions you wish to install.",
+ "Press F1 for a more complete description of these distributions.",
+ "distribution_types.hlp",
+ { { "*bin", "Binary base distribution (required)",
+ DMENU_NOP, NULL, 0 },
+ { "commercial", "Commercial demos and shareware",
+ DMENU_NOP, NULL, 0 },
+ { "compat1x", "FreeBSD 1.x binary compatability package",
+ DMENU_NOP, NULL, 0 },
+ { "DES", "DES encryption code and sources",
+ DMENU_NOP, NULL, 0 },
+ { "dict", "Spelling checker disctionary files",
+ DMENU_NOP, NULL, 0 },
+ { "games", "Games and other amusements (non-commercial)",
+ DMENU_NOP, NULL, 0 },
+ { "info", "GNU info files",
+ DMENU_NOP, NULL, 0 },
+ { "man", "System manual pages - strongly recommended",
+ DMENU_NOP, NULL, 0 },
+ { "proflibs", "Profiled versions of the libraries",
+ DMENU_NOP, NULL, 0 },
+ { "src", "Sources for everything but DES",
+ DMENU_NOP, NULL, 0 },
+ { "XFree86", "The XFree86 3.1.1 distribution",
+ DMENU_NOP, NULL, 0 },
+ { NULL } },
};
/* The installation options menu */
@@ -180,6 +240,20 @@ DMenu MenuInstallOptions = {
{ { NULL } },
};
+DMenu MenuDiskDevices = {
+ DMENU_MULTIPLE_TYPE,
+ "Select Drive(s)",
+ "Please select the drive, or drives, on which you wish to install\n\
+FreeBSD. You need to select at least one drive containing some free\n\
+space, though FreeBSD can be installed across several drives if you do\n\
+not have the required space on a single drive. If you wish to boot\n\
+off a drive that's not a `zero drive', you will have the option to install\n\
+a boot manager later.",
+ "drives.hlp",
+ "Press F1 for more information on what you see here.",
+ { { NULL } },
+};
+
/* The main installation menu */
DMenu MenuInstall = {
DMENU_NORMAL_TYPE,
@@ -190,7 +264,7 @@ of installation you want to have (and where). There are also a number\n\
of options you can specify in the Options menu. If you do not wish to\n\
install FreeBSD at this time, you may select Cancel to leave this menu",
"You may wish to read the install guide - press F1 to do so",
- "help/install.hlp",
+ "install.hlp",
{ { "Media", "Choose Installation media type", /* M */
DMENU_SUBMENU, (void *)&MenuMedia, 0 },
{ "Type", "Choose the type of installation you want", /* T */
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
index 4f789e2..794c498 100644
--- a/usr.sbin/sade/misc.c
+++ b/usr.sbin/sade/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.1.1.1 1995/04/27 12:50:35 jkh Exp $
+ * $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -98,6 +98,18 @@ safe_free(void *ptr)
free(ptr);
}
+/* A malloc that checks errors */
+void *
+safe_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (!ptr)
+ msgFatal("Out of memory!");
+ return ptr;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
index c9fd5ce..bbb918b 100644
--- a/usr.sbin/sade/msg.c
+++ b/usr.sbin/sade/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id$
+ * $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -129,3 +129,38 @@ msgFatal(char *fmt, ...)
systemShutdown();
}
+/* Put up a message in a popup confirmation box */
+void
+msgConfirm(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_mesgbox("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+}
+
+/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
+int
+msgYesNo(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+ int ret;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ ret = dialog_yesno("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+ return ret;
+}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 1b318f4..525afd1 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.2 1995/04/27 18:03:55 jkh Exp $
+ * $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,13 +50,23 @@
#include <unistd.h>
#include <dialog.h>
+/*** Defines ***/
+
/* Bitfields for menu options */
#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */
#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */
#define DMENU_MULTIPLE_TYPE 0x4 /* Multiple choice menu */
#define DMENU_SELECTION_RETURNS 0x8 /* Select item then exit */
-/* Types */
+/* variable limits */
+#define VAR_NAME_MAX 128
+#define VAR_VALUE_MAX 1024
+
+/* device limits */
+#define DEV_NAME_MAX 128
+
+
+/*** Types ***/
typedef unsigned int Boolean;
typedef enum {
@@ -68,6 +78,7 @@ typedef enum {
DMENU_SET_VARIABLE, /* Set an environment/system var */
DMENU_CALL, /* Call back a C function */
DMENU_CANCEL, /* Cancel out of this menu */
+ DMENU_NOP, /* Do nothing special for item */
} DMenuItemType;
typedef struct _dmenuItem {
@@ -75,7 +86,7 @@ typedef struct _dmenuItem {
char *prompt; /* Our prompt */
DMenuItemType type; /* What type of item we are */
void *ptr; /* Generic data ptr */
- int disabled; /* Are we temporarily disabled? */
+ Boolean disabled; /* Are we temporarily disabled? */
} DMenuItem;
typedef struct _dmenu {
@@ -90,11 +101,29 @@ typedef struct _dmenu {
/* A sysconfig variable */
typedef struct _variable {
struct _variable *next;
- char value[1024];
+ char name[VAR_NAME_MAX];
+ char value[VAR_VALUE_MAX];
} Variable;
-
-/* Externs */
+typedef enum {
+ DEVICE_TYPE_ANY,
+ DEVICE_TYPE_DISK,
+ DEVICE_TYPE_FLOPPY,
+ DEVICE_TYPE_NETWORK,
+ DEVICE_TYPE_CDROM,
+ DEVICE_TYPE_TAPE,
+ DEVICE_TYPE_SERIAL,
+ DEVICE_TYPE_PARALLEL,
+} DeviceType;
+
+/* A "device" from sysinstall's point of view */
+typedef struct _device {
+ char name[DEV_NAME_MAX];
+ DeviceType type;
+} Device;
+
+
+/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
extern int DebugFD; /* Where diagnostic output goes */
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
@@ -106,15 +135,21 @@ extern Variable *VarHead; /* The head of the variable chain */
extern DMenu MenuDocumenation, MenuInitial, MenuLanguage;
-/* Prototypes */
+/*** Prototypes ***/
/* globals.c */
extern void globalsInit(void);
/* install.c */
-extern int installCustom(void);
-extern int installExpress(void);
-extern int installMaint(void);
+extern int installCustom(char *str);
+extern int installExpress(char *str);
+extern int installMaint(char *str);
+extern int installSetDeveloper(char *str);
+extern int installSetXDeveloper(char *str);
+extern int installSetUser(char *str);
+extern int installSetXUser(char *str);
+extern int installSetMinimum(char *str);
+extern int installSetEverything(char *str);
/* system.c */
extern void systemInitialize(int argc, char **argv);
@@ -123,6 +158,7 @@ extern void systemWelcome(void);
extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
+extern char *systemHelpFile(char *file, char *buf);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
@@ -135,6 +171,7 @@ extern char *string_concat(char *p1, char *p2);
extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
+extern void *safe_malloc(size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);
@@ -148,14 +185,24 @@ extern void msgInfo(char *fmt, ...);
extern void msgWarn(char *fmt, ...);
extern void msgError(char *fmt, ...);
extern void msgFatal(char *fmt, ...);
+extern void msgConfirm(char *fmt, ...);
+extern int msgYesNo(char *fmt, ...);
/* media.c */
-extern int mediaSetCDROM(void);
-extern int mediaSetFloppy(void);
-extern int mediaSetDOS(void);
-extern int mediaSetTape(void);
-extern int mediaSetFTP(void);
-extern int mediaSetFS(void);
+extern int mediaSetCDROM(char *str);
+extern int mediaSetFloppy(char *str);
+extern int mediaSetDOS(char *str);
+extern int mediaSetTape(char *str);
+extern int mediaSetFTP(char *str);
+extern int mediaSetFS(char *str);
+
+/* devices.c */
+extern Device *device_get_all(DeviceType type, int *ndevs);
+extern int device_slice_disk(char *disk);
+
+/* variables.c */
+extern void variable_set(char *var);
+extern void variable_set2(char *name, char *value);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index cbf7549..4e59d9b 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
+ * $Id: system.c,v 1.2 1995/04/29 19:33:06 jkh Exp $
*
* Jordan Hubbard
*
@@ -128,7 +128,7 @@ systemShellEscape(void)
dialog_update();
move(0, 0);
standout();
- addstr("Type `exit' to leave this shell and continue installallation");
+ addstr("Type `exit' to leave this shell and continue installation");
standend();
refresh();
end_dialog();
@@ -146,30 +146,56 @@ systemShellEscape(void)
int
systemDisplayFile(char *file)
{
- char buf[FILENAME_MAX], *cp, *fname = NULL;
+ char *fname = NULL;
+ char buf[FILENAME_MAX];
- if (file_readable(file))
- fname = file;
- else if ((cp = getenv("LANG")) != NULL) {
- snprintf(buf, FILENAME_MAX, "%s/%s", cp, file);
- if (file_readable(buf))
- fname = buf;
- }
- else {
- snprintf(buf, FILENAME_MAX, "english/%s", file);
- if (file_readable(buf))
- fname = buf;
- }
+ fname = systemHelpFile(file, buf);
if (!fname) {
snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file);
- dialog_msgbox("Sorry!", buf, -1, -1, 1);
+ use_helpfile(NULL);
+ use_helpline(NULL);
+ dialog_mesgbox("Sorry!", buf, -1, -1);
dialog_clear_norefresh();
return 1;
}
else {
dialog_clear_norefresh();
+ use_helpfile(NULL);
+ use_helpline(NULL);
dialog_textbox(file, fname, LINES, COLS);
dialog_clear_norefresh();
}
return 0;
}
+
+char *
+systemHelpFile(char *file, char *buf)
+{
+ char *cp, *fname = NULL;
+
+ if (!file)
+ return NULL;
+
+ if ((cp = getenv("LANG")) != NULL) {
+ snprintf(buf, FILENAME_MAX, "help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ else {
+ snprintf(buf, FILENAME_MAX, "help/en_US.ISO8859-1/%s", file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/en_US.ISO8859-1/%s",
+ file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ return fname;
+}
diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c
new file mode 100644
index 0000000..5a64f91
--- /dev/null
+++ b/usr.sbin/sade/variable.c
@@ -0,0 +1,80 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+
+/* Routines for dealing with variable lists */
+
+void
+variable_set(char *var)
+{
+ char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
+ Variable *newvar;
+
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
+ if ((cp = index(tmp, '=')) == NULL)
+ msgFatal("Invalid variable format: %s", var);
+ *cp = '\0';
+ strncpy(newvar->name, tmp, VAR_NAME_MAX);
+ strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
+
+void
+variable_set2(char *var, char *value)
+{
+ Variable *newvar;
+
+ if (!var || !value)
+ msgFatal("Null name or value passed to set_variable2!");
+ setenv(var, value, 1);
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(newvar->name, var, VAR_NAME_MAX);
+ strncpy(newvar->value, value, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index 84f5c1d..62b3c37 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -6,10 +6,13 @@ CLEANFILES= makedevs.c rtermcap
SRCS = globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
- termcap.c makedevs.c media.c
+ termcap.c makedevs.c media.c variable.c \
+ devices.c
+
+CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
+
+LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
-CFLAGS += -Wall -g -static
-LDADD = -ldialog -lncurses -lmytinfo
DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
new file mode 100644
index 0000000..0f57283
--- /dev/null
+++ b/usr.sbin/sysinstall/devices.c
@@ -0,0 +1,122 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+#include "libdisk.h"
+
+/* Get all device information for a given device class */
+Device *
+device_get_all(DeviceType which, int *ndevs)
+{
+ char **names;
+ Device *devs = NULL;
+
+ *ndevs = 0;
+ if (which == DEVICE_TYPE_DISK || which == DEVICE_TYPE_ANY) {
+ if ((names = Disk_Names()) != NULL) {
+ int i;
+
+ for (i = 0; names[i]; i++)
+ ++*ndevs;
+ devs = safe_malloc(sizeof(Device) * (*ndevs + 1));
+ for (i = 0; names[i]; i++) {
+ strcpy(devs[i].name, names[i]);
+ devs[i].type = DEVICE_TYPE_DISK;
+ }
+ devs[i].name[0] = '\0';
+ free(names);
+ }
+ }
+ /* put detection for other classes here just as soon as I figure out how */
+ return devs;
+}
+
+void
+device_print_chunk(struct chunk *c1, int offset, int *row)
+{
+ CHAR_N
+
+ if (!c1)
+ return;
+ mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
+ c1->offset, c1->size, c1->end, c1->name, c1->type,
+ chunk_n[c1->type], c1->subtype, c1->flags);
+ device_print_chunk(c1->part, offset + 2, row);
+ device_print_chunk(c1->next, offset, row);
+}
+
+int
+device_slice_disk(char *disk)
+{
+ struct disk *d;
+ char *p;
+ int row;
+
+ d = Open_Disk(disk);
+ if (!d)
+ msgFatal("Couldn't open disk `%s'!", disk);
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ dialog_clear();
+ while (1) {
+ clear();
+ mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
+ mvprintw(1, 0,
+ "Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
+ d->real_cyl, d->real_hd, d->real_sect,
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ row = 5;
+ device_print_chunk(d->chunks, 0, &row);
+ move(23, 0);
+ addstr("Done!");
+ if (getch() == 'q')
+ return 0;
+ }
+ return 0;
+}
diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c
index f49e4cd..36bc88c 100644
--- a/usr.sbin/sysinstall/dmenu.c
+++ b/usr.sbin/sysinstall/dmenu.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: dmenu.c,v 1.2 1995/04/27 18:03:52 jkh Exp $
+ * $Id: dmenu.c,v 1.3 1995/04/29 19:33:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,7 +63,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
char *title = tmp->title;
char *prompt = tmp->prompt;
- if (menu->options & DMENU_RADIO_TYPE) {
+ if (menu->options & (DMENU_RADIO_TYPE | DMENU_MULTIPLE_TYPE)) {
if (*title == '*') {
addme = "ON";
++title;
@@ -80,11 +80,11 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
nitems = item_add(nitems, NULL, curr, max); /* Terminate it */
while (1) {
+ char buf[FILENAME_MAX];
+
/* Any helpful hints, put 'em up! */
- if (menu->helpline)
- use_helpline(menu->helpline);
- if (menu->helpfile)
- use_helpfile(menu->helpfile);
+ use_helpline(menu->helpline);
+ use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
if (menu->options & DMENU_NORMAL_TYPE) {
@@ -106,17 +106,30 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
(unsigned char **)nitems,
(unsigned char *)result);
}
+ else if (menu->options & DMENU_MULTIPLE_TYPE) {
+ rval = dialog_checklist((unsigned char *)menu->title,
+ (unsigned char *)menu->prompt,
+ -1, -1,
+ n > MAX_MENU ? MAX_MENU : n,
+ n,
+ (unsigned char **)nitems,
+ (unsigned char *)result);
+ }
dialog_clear();
if (!rval) {
- for (tmp = menu->items; tmp->title; tmp++)
- if (!strcmp(result,
- (*tmp->title == '*') ? tmp->title + 1 :
- tmp->title))
- break;
- if (!tmp->title)
- msgFatal("Menu item `%s' not found??", result);
+ if (menu->options & DMENU_MULTIPLE_TYPE)
+ tmp = &(menu->items[0]);
+ else {
+ for (tmp = menu->items; tmp->title; tmp++)
+ if (!strcmp(result,
+ (*tmp->title == '*') ? tmp->title + 1 :
+ tmp->title))
+ break;
+ if (!tmp->title)
+ msgFatal("Menu item `%s' not found??", result);
+ }
}
- else if (rval == 255)
+ else if (rval == -1)
tmp = &shellAction;
else {
items_free(nitems, curr, max);
@@ -149,11 +162,14 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
/* Same as above, but execute it in a prgbox */
case DMENU_SYSTEM_COMMAND_BOX:
+ use_helpfile(NULL);
+ use_helpline("Select OK to dismiss this dialog");
dialog_prgbox(tmp->title, (char *)tmp->ptr, 22, 76, 1, 1);
+ dialog_clear();
break;
case DMENU_CALL:
- if (((int (*)())tmp->ptr)()) {
+ if (((int (*)())tmp->ptr)(result)) {
items_free(nitems, curr, max);
return;
}
@@ -163,20 +179,9 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
- case DMENU_SET_VARIABLE: {
- Variable *newvar;
-
- if (!index((char *)tmp->ptr, '='))
- msgWarn("Improperly formatted variable: %s", tmp->ptr);
- putenv((char *)tmp->ptr);
- newvar = (Variable *)malloc(sizeof(Variable));
- if (!newvar)
- msgFatal("Out of Memory!");
- strncpy(newvar->value, tmp->ptr, 1024);
- newvar->next = VarHead;
- VarHead = newvar;
- msgInfo("Setting option %s", newvar->value);
- }
+ case DMENU_SET_VARIABLE:
+ variable_set((char *)tmp->ptr);
+ msgInfo("Setting option %s", tmp->ptr);
break;
default:
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index ee1efa0..23ad2d2 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ * $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -43,22 +43,145 @@
#include "sysinstall.h"
+static int
+installHook(char *str)
+{
+ int rcode = 0;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ while (str) {
+ char *cp;
+
+ cp = index(str, ' ');
+ if (cp)
+ *cp++ = 0;
+ rcode = !device_slice_disk(str);
+ str = cp;
+ }
+ return rcode;
+}
+
+/* Create a menu listing all the devices in the system. */
+static DMenu *
+getAllDisks(DMenu *menu, Device **rdevs)
+{
+ Device *devices;
+ int numdevs;
+
+ devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
+ *rdevs = devices;
+ if (!devices) {
+ msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully.");
+ return NULL;
+ }
+ else {
+ Device *start;
+ DMenu *tmp;
+ int i;
+
+ tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
+ (sizeof(DMenuItem) * (numdevs + 1)));
+ bcopy(menu, tmp, sizeof(DMenu));
+ for (start = devices, i = 0; start->name[0]; start++, i++) {
+ tmp->items[i].title = start->name;
+ if (!strncmp(start->name, "sd", 2))
+ tmp->items[i].prompt = "SCSI disk";
+ else if (!strncmp(start->name, "wd", 2))
+ tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
+ else
+ msgFatal("Unknown disk type: %s!", start->name);
+ tmp->items[i].type = DMENU_CALL;
+ tmp->items[i].ptr = installHook;
+ tmp->items[i].disabled = FALSE;
+ }
+ tmp->items[i].type = DMENU_NOP;
+ tmp->items[i].title = NULL;
+ return tmp;
+ }
+}
+
int
-installCustom(void)
+installCustom(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system custom");
- return 0;
+ variable_set2("install_type", "custom");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
}
int
-installExpress(void)
+installExpress(char *str)
{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+ Device *devs;
+
msgInfo("Installating the system express");
+ variable_set2("install_type", "express");
+ menu = getAllDisks(&MenuDiskDevices, &devs);
+ if (!menu)
+ return 0;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ free(devs);
+ return 1;
+}
+
+int
+installMaint(char *str)
+{
+ msgConfirm("Sorry, maintainance mode is not implemented in this version.");
+ return 0;
+}
+
+int
+installSetDeveloper(char *str)
+{
+ /* Dists = DIST_BIN | DIST_MAN | DIST_FOO; */
+ return 0;
+}
+
+int
+installSetXDeveloper(char *str)
+{
+ return 0;
+}
+
+int
+installSetUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetXUser(char *str)
+{
+ return 0;
+}
+
+int
+installSetMinimum(char *str)
+{
return 0;
}
int
-installMaint(void)
+installSetEverything(char *str)
{
return 0;
}
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index b6febca..4e9b72a 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/sysinstall/media.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: media.c,v 1.1 1995/04/27 18:05:10 jkh Exp $
+ * $Id: media.c,v 1.2 1995/04/29 19:33:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -46,7 +46,7 @@
* be a CD.
*/
int
-mediaSetCDROM(void)
+mediaSetCDROM(char *str)
{
return 0;
}
@@ -56,7 +56,7 @@ mediaSetCDROM(void)
* be a floppy
*/
int
-mediaSetFloppy(void)
+mediaSetFloppy(char *str)
{
return 0;
}
@@ -66,7 +66,7 @@ mediaSetFloppy(void)
* be a DOS partition.
*/
int
-mediaSetDOS(void)
+mediaSetDOS(char *str)
{
return 0;
}
@@ -76,7 +76,7 @@ mediaSetDOS(void)
* be a tape drive.
*/
int
-mediaSetTape(void)
+mediaSetTape(char *str)
{
return 0;
}
@@ -86,7 +86,7 @@ mediaSetTape(void)
* be an ftp server
*/
int
-mediaSetFTP(void)
+mediaSetFTP(char *str)
{
return 0;
}
@@ -96,7 +96,7 @@ mediaSetFTP(void)
* be some sort of mounted filesystem (it's also mounted at this point)
*/
int
-mediaSetFS(void)
+mediaSetFS(char *str)
{
return 0;
}
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index c4afad5..40180137 100644
--- a/usr.sbin/sysinstall/menus.c
+++ b/usr.sbin/sysinstall/menus.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: menus.c,v 1.2 1995/04/27 18:03:54 jkh Exp $
+ * $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,10 +50,12 @@
* expansion.
*/
+/* Forward decls for submenus */
extern DMenu MenuDocumentation;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
+extern DMenu MenuDistributions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -63,10 +65,10 @@ DMenu MenuInitial = {
select one of the options below by using the arrow keys or typing the\n\
first character of the option name you're interested in. Invoke an\n\
option by pressing enter.", /* prompt */
- "Press F1 for further help", /* help line */
- "help/initial.hlp", /* help file */
+ "Press F1 for usage instructions", /* help line */
+ "usage.hlp", /* help file */
{ { "Usage", "Quick start - How to use this menu system.", /* U */
- DMENU_DISPLAY_FILE, (void *)"help/initial.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0 },
{ "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
{ "Lang", "Select natural language options.", /* L */
@@ -77,6 +79,8 @@ option by pressing enter.", /* prompt */
DMENU_CALL, (void *)installCustom, 0 },
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
DMENU_CALL, (void *)installMaint, 0 },
+ { "Bootmsg", "Read the boot messages again.", /* B */
+ DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
{ NULL } },
};
@@ -90,16 +94,16 @@ Hardware guide! New users should also read the Install document for\n\
a step-by-step tutorial on installing FreeBSD. For general information,\n\
consult the README file. If you're having other problems, you may find\n\
answers in the FAQ.",
- "Having trouble? Press F1 for help!", /* help line */
- "help/usage.hlp", /* help file */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
{ { "README", "Read this for a general description of FreeBSD", /* R */
- DMENU_DISPLAY_FILE, (void *)"help/readme.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"readme.hlp", 0 },
{ "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
- DMENU_DISPLAY_FILE, (void *)"help/hardware.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0 },
{ "Install", "A step-by-step guide to installing FreeBSD.", /* I */
- DMENU_DISPLAY_FILE, (void *)"help/install.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"install.hlp", 0 },
{ "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
- DMENU_DISPLAY_FILE, (void *)"help/faq.hlp", 0 },
+ DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0 },
{ NULL } },
};
@@ -113,25 +117,31 @@ DMenu MenuLanguage = {
DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
"Natural language selection", /* title */
"Please specify the language you'd like to use by default.\n\n\
-While almost all of the system's documentation is still\n\
-written in english (and may never be translated), there are a few\n\
-guides and types of system documentation that may be written in your\n\
+While almost all of the system's documentation is still written\n\
+in english (and may never be translated), there are a few guides\n\
+and types of system documentation that may be written in your\n\
preferred language. When such are found, they will be used instead\n\
of the english versions.", /* prompt */
"Press F1 for more information", /* help line */
- "help/language.hlp", /* help file */
+ "language.hlp", /* help file */
{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=da_DK.ISO8859-1", 0 },
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ DMENU_SET_VARIABLE, (void *)"LANG=nl_NL.ISO8859-1", 0 },
{ "*English", "English language (system default)", /* E */
- DMENU_SET_VARIABLE, (void *)"LANG=en", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=en_US.ISO8859-1", 0 },
{ "French", "French language and character set (ISO-8859-1)", /* F */
- DMENU_SET_VARIABLE, (void *)"LANG=fr", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=fr_FR.ISO8859-1", 0 },
{ "German", "German language and character set (ISO-8859-1)", /* G */
- DMENU_SET_VARIABLE, (void *)"LANG=de", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=de_DE.ISO8859-1", 0 },
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ DMENU_SET_VARIABLE, (void *)"LANG=it_IT.ISO8859-1", 0 },
{ "Japanese", "Japanese language and character set (JIS?)", /* J */
- DMENU_SET_VARIABLE, (void *)"LANG=jp", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ja_JP.EUC", 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
- DMENU_SET_VARIABLE, (void *)"LANG=ru", 0 },
+ DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
{ NULL } },
};
@@ -140,11 +150,13 @@ DMenu MenuMedia = {
DMENU_NORMAL_TYPE,
"Choose Installation Media",
"FreeBSD can be installed from a variety of different installation\n\
-media, from floppies to the Internet. If you're installing FreeBSD from\n\
-a supported CDROM drive then this is generally the best method to\n\
-use unless you have some overriding reason for using another method.",
+media, ranging from floppies to the Internet. If you're installing\n\
+FreeBSD from a supported CDROM drive then this is generally the best\n\
+method to use unless you have some overriding reason for using another\n\
+method. Please also note that the DES distribution is NOT available on \n\
+CDROM due to U.S. export restrictions.",
"Press F1 for more information on the various media types",
- "help/media.hlp",
+ "media.hlp",
{ { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0 },
{ "FLOPPY", "Install from a floppy disk set",
@@ -164,10 +176,58 @@ use unless you have some overriding reason for using another method.",
DMenu MenuInstallType = {
DMENU_NORMAL_TYPE,
"Choose Installation Type",
- "blah blah",
- NULL,
- NULL,
- { { NULL } },
+ "As a convenience, we provide several `canned' installation types. \
+These pick what we consider to be the most reasonable defaults for the \
+type of system in question. If you would prefer to pick and choose \
+the list of distributions yourself, simply select `custom'.",
+ "Press F1 for more information on the various distributions",
+ "install_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
+ DMENU_CALL, (void *)installSetDeveloper, 0 },
+ { "X-Developer", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXDeveloper, 0 },
+ { "User", "General user. Binaries and doc but no sources.",
+ DMENU_CALL, (void *)installSetUser, 0 },
+ { "X-User", "Same as above, but includes XFree86.",
+ DMENU_CALL, (void *)installSetXUser, 0 },
+ { "Minimal", "The smallest configuration possible.",
+ DMENU_CALL, (void *)installSetMinimum, 0 },
+ { "Everything", "The entire kitchen sink, plus bedroom suite.",
+ DMENU_CALL, (void *)installSetEverything, 0 },
+ { "Custom", "I don't want it canned! I want to drive!",
+ DMENU_SUBMENU, (void *)&MenuDistributions, 0 },
+ { NULL } },
+};
+
+DMenu MenuDistributions = {
+ DMENU_MULTIPLE_TYPE,
+ "Select the distributions you wish to install.",
+ "Please check off the distributions you wish to install.",
+ "Press F1 for a more complete description of these distributions.",
+ "distribution_types.hlp",
+ { { "*bin", "Binary base distribution (required)",
+ DMENU_NOP, NULL, 0 },
+ { "commercial", "Commercial demos and shareware",
+ DMENU_NOP, NULL, 0 },
+ { "compat1x", "FreeBSD 1.x binary compatability package",
+ DMENU_NOP, NULL, 0 },
+ { "DES", "DES encryption code and sources",
+ DMENU_NOP, NULL, 0 },
+ { "dict", "Spelling checker disctionary files",
+ DMENU_NOP, NULL, 0 },
+ { "games", "Games and other amusements (non-commercial)",
+ DMENU_NOP, NULL, 0 },
+ { "info", "GNU info files",
+ DMENU_NOP, NULL, 0 },
+ { "man", "System manual pages - strongly recommended",
+ DMENU_NOP, NULL, 0 },
+ { "proflibs", "Profiled versions of the libraries",
+ DMENU_NOP, NULL, 0 },
+ { "src", "Sources for everything but DES",
+ DMENU_NOP, NULL, 0 },
+ { "XFree86", "The XFree86 3.1.1 distribution",
+ DMENU_NOP, NULL, 0 },
+ { NULL } },
};
/* The installation options menu */
@@ -180,6 +240,20 @@ DMenu MenuInstallOptions = {
{ { NULL } },
};
+DMenu MenuDiskDevices = {
+ DMENU_MULTIPLE_TYPE,
+ "Select Drive(s)",
+ "Please select the drive, or drives, on which you wish to install\n\
+FreeBSD. You need to select at least one drive containing some free\n\
+space, though FreeBSD can be installed across several drives if you do\n\
+not have the required space on a single drive. If you wish to boot\n\
+off a drive that's not a `zero drive', you will have the option to install\n\
+a boot manager later.",
+ "drives.hlp",
+ "Press F1 for more information on what you see here.",
+ { { NULL } },
+};
+
/* The main installation menu */
DMenu MenuInstall = {
DMENU_NORMAL_TYPE,
@@ -190,7 +264,7 @@ of installation you want to have (and where). There are also a number\n\
of options you can specify in the Options menu. If you do not wish to\n\
install FreeBSD at this time, you may select Cancel to leave this menu",
"You may wish to read the install guide - press F1 to do so",
- "help/install.hlp",
+ "install.hlp",
{ { "Media", "Choose Installation media type", /* M */
DMENU_SUBMENU, (void *)&MenuMedia, 0 },
{ "Type", "Choose the type of installation you want", /* T */
diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c
index 4f789e2..794c498 100644
--- a/usr.sbin/sysinstall/misc.c
+++ b/usr.sbin/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.1.1.1 1995/04/27 12:50:35 jkh Exp $
+ * $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -98,6 +98,18 @@ safe_free(void *ptr)
free(ptr);
}
+/* A malloc that checks errors */
+void *
+safe_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (!ptr)
+ msgFatal("Out of memory!");
+ return ptr;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c
index c9fd5ce..bbb918b 100644
--- a/usr.sbin/sysinstall/msg.c
+++ b/usr.sbin/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id$
+ * $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -129,3 +129,38 @@ msgFatal(char *fmt, ...)
systemShutdown();
}
+/* Put up a message in a popup confirmation box */
+void
+msgConfirm(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_mesgbox("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+}
+
+/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
+int
+msgYesNo(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+ int ret;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ ret = dialog_yesno("User Confirmation Request", errstr, -1, -1);
+ free(errstr);
+ return ret;
+}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 1b318f4..525afd1 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.2 1995/04/27 18:03:55 jkh Exp $
+ * $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,13 +50,23 @@
#include <unistd.h>
#include <dialog.h>
+/*** Defines ***/
+
/* Bitfields for menu options */
#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */
#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */
#define DMENU_MULTIPLE_TYPE 0x4 /* Multiple choice menu */
#define DMENU_SELECTION_RETURNS 0x8 /* Select item then exit */
-/* Types */
+/* variable limits */
+#define VAR_NAME_MAX 128
+#define VAR_VALUE_MAX 1024
+
+/* device limits */
+#define DEV_NAME_MAX 128
+
+
+/*** Types ***/
typedef unsigned int Boolean;
typedef enum {
@@ -68,6 +78,7 @@ typedef enum {
DMENU_SET_VARIABLE, /* Set an environment/system var */
DMENU_CALL, /* Call back a C function */
DMENU_CANCEL, /* Cancel out of this menu */
+ DMENU_NOP, /* Do nothing special for item */
} DMenuItemType;
typedef struct _dmenuItem {
@@ -75,7 +86,7 @@ typedef struct _dmenuItem {
char *prompt; /* Our prompt */
DMenuItemType type; /* What type of item we are */
void *ptr; /* Generic data ptr */
- int disabled; /* Are we temporarily disabled? */
+ Boolean disabled; /* Are we temporarily disabled? */
} DMenuItem;
typedef struct _dmenu {
@@ -90,11 +101,29 @@ typedef struct _dmenu {
/* A sysconfig variable */
typedef struct _variable {
struct _variable *next;
- char value[1024];
+ char name[VAR_NAME_MAX];
+ char value[VAR_VALUE_MAX];
} Variable;
-
-/* Externs */
+typedef enum {
+ DEVICE_TYPE_ANY,
+ DEVICE_TYPE_DISK,
+ DEVICE_TYPE_FLOPPY,
+ DEVICE_TYPE_NETWORK,
+ DEVICE_TYPE_CDROM,
+ DEVICE_TYPE_TAPE,
+ DEVICE_TYPE_SERIAL,
+ DEVICE_TYPE_PARALLEL,
+} DeviceType;
+
+/* A "device" from sysinstall's point of view */
+typedef struct _device {
+ char name[DEV_NAME_MAX];
+ DeviceType type;
+} Device;
+
+
+/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
extern int DebugFD; /* Where diagnostic output goes */
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
@@ -106,15 +135,21 @@ extern Variable *VarHead; /* The head of the variable chain */
extern DMenu MenuDocumenation, MenuInitial, MenuLanguage;
-/* Prototypes */
+/*** Prototypes ***/
/* globals.c */
extern void globalsInit(void);
/* install.c */
-extern int installCustom(void);
-extern int installExpress(void);
-extern int installMaint(void);
+extern int installCustom(char *str);
+extern int installExpress(char *str);
+extern int installMaint(char *str);
+extern int installSetDeveloper(char *str);
+extern int installSetXDeveloper(char *str);
+extern int installSetUser(char *str);
+extern int installSetXUser(char *str);
+extern int installSetMinimum(char *str);
+extern int installSetEverything(char *str);
/* system.c */
extern void systemInitialize(int argc, char **argv);
@@ -123,6 +158,7 @@ extern void systemWelcome(void);
extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
+extern char *systemHelpFile(char *file, char *buf);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
@@ -135,6 +171,7 @@ extern char *string_concat(char *p1, char *p2);
extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
+extern void *safe_malloc(size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);
@@ -148,14 +185,24 @@ extern void msgInfo(char *fmt, ...);
extern void msgWarn(char *fmt, ...);
extern void msgError(char *fmt, ...);
extern void msgFatal(char *fmt, ...);
+extern void msgConfirm(char *fmt, ...);
+extern int msgYesNo(char *fmt, ...);
/* media.c */
-extern int mediaSetCDROM(void);
-extern int mediaSetFloppy(void);
-extern int mediaSetDOS(void);
-extern int mediaSetTape(void);
-extern int mediaSetFTP(void);
-extern int mediaSetFS(void);
+extern int mediaSetCDROM(char *str);
+extern int mediaSetFloppy(char *str);
+extern int mediaSetDOS(char *str);
+extern int mediaSetTape(char *str);
+extern int mediaSetFTP(char *str);
+extern int mediaSetFS(char *str);
+
+/* devices.c */
+extern Device *device_get_all(DeviceType type, int *ndevs);
+extern int device_slice_disk(char *disk);
+
+/* variables.c */
+extern void variable_set(char *var);
+extern void variable_set2(char *name, char *value);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index cbf7549..4e59d9b 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
+ * $Id: system.c,v 1.2 1995/04/29 19:33:06 jkh Exp $
*
* Jordan Hubbard
*
@@ -128,7 +128,7 @@ systemShellEscape(void)
dialog_update();
move(0, 0);
standout();
- addstr("Type `exit' to leave this shell and continue installallation");
+ addstr("Type `exit' to leave this shell and continue installation");
standend();
refresh();
end_dialog();
@@ -146,30 +146,56 @@ systemShellEscape(void)
int
systemDisplayFile(char *file)
{
- char buf[FILENAME_MAX], *cp, *fname = NULL;
+ char *fname = NULL;
+ char buf[FILENAME_MAX];
- if (file_readable(file))
- fname = file;
- else if ((cp = getenv("LANG")) != NULL) {
- snprintf(buf, FILENAME_MAX, "%s/%s", cp, file);
- if (file_readable(buf))
- fname = buf;
- }
- else {
- snprintf(buf, FILENAME_MAX, "english/%s", file);
- if (file_readable(buf))
- fname = buf;
- }
+ fname = systemHelpFile(file, buf);
if (!fname) {
snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file);
- dialog_msgbox("Sorry!", buf, -1, -1, 1);
+ use_helpfile(NULL);
+ use_helpline(NULL);
+ dialog_mesgbox("Sorry!", buf, -1, -1);
dialog_clear_norefresh();
return 1;
}
else {
dialog_clear_norefresh();
+ use_helpfile(NULL);
+ use_helpline(NULL);
dialog_textbox(file, fname, LINES, COLS);
dialog_clear_norefresh();
}
return 0;
}
+
+char *
+systemHelpFile(char *file, char *buf)
+{
+ char *cp, *fname = NULL;
+
+ if (!file)
+ return NULL;
+
+ if ((cp = getenv("LANG")) != NULL) {
+ snprintf(buf, FILENAME_MAX, "help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ else {
+ snprintf(buf, FILENAME_MAX, "help/en_US.ISO8859-1/%s", file);
+ if (file_readable(buf))
+ fname = buf;
+ else {
+ snprintf(buf, FILENAME_MAX, "/stand/help/en_US.ISO8859-1/%s",
+ file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ }
+ return fname;
+}
diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c
new file mode 100644
index 0000000..5a64f91
--- /dev/null
+++ b/usr.sbin/sysinstall/variable.c
@@ -0,0 +1,80 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+
+/* Routines for dealing with variable lists */
+
+void
+variable_set(char *var)
+{
+ char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
+ Variable *newvar;
+
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
+ if ((cp = index(tmp, '=')) == NULL)
+ msgFatal("Invalid variable format: %s", var);
+ *cp = '\0';
+ strncpy(newvar->name, tmp, VAR_NAME_MAX);
+ strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
+
+void
+variable_set2(char *var, char *value)
+{
+ Variable *newvar;
+
+ if (!var || !value)
+ msgFatal("Null name or value passed to set_variable2!");
+ setenv(var, value, 1);
+ newvar = (Variable *)safe_malloc(sizeof(Variable));
+ strncpy(newvar->name, var, VAR_NAME_MAX);
+ strncpy(newvar->value, value, VAR_VALUE_MAX);
+ newvar->next = VarHead;
+ VarHead = newvar;
+ setenv(newvar->name, newvar->value, 1);
+}
OpenPOWER on IntegriCloud