summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-16 02:53:31 +0000
committerjkh <jkh@FreeBSD.org>1995-05-16 02:53:31 +0000
commit78baa7daa2277e0e7dd73a985847ead284b36551 (patch)
tree613dfed0fbc81719d1686eec3d022f605e6f0a22
parent9de827c98085791c80cf2d99d483e6af2bb0249c (diff)
downloadFreeBSD-src-78baa7daa2277e0e7dd73a985847ead284b36551.zip
FreeBSD-src-78baa7daa2277e0e7dd73a985847ead284b36551.tar.gz
This does _not yet compile_; I'm simply bringing in my changes from
this weekend in order to more easily sync with my CVS tree at home. Another commit relative to these changes will follow shortly.
-rw-r--r--release/sysinstall/Makefile3
-rw-r--r--release/sysinstall/command.c76
-rw-r--r--release/sysinstall/decode.c6
-rw-r--r--release/sysinstall/devices.c505
-rw-r--r--release/sysinstall/disks.c588
-rw-r--r--release/sysinstall/dist.c199
-rw-r--r--release/sysinstall/dmenu.c15
-rw-r--r--release/sysinstall/globals.c4
-rw-r--r--release/sysinstall/install.c200
-rw-r--r--release/sysinstall/label.c602
-rw-r--r--release/sysinstall/main.c4
-rw-r--r--release/sysinstall/media.c116
-rw-r--r--release/sysinstall/menus.c501
-rw-r--r--release/sysinstall/sysinstall.h61
-rw-r--r--release/sysinstall/tcpip.c326
-rw-r--r--release/sysinstall/wizard.c442
-rw-r--r--usr.sbin/sade/Makefile3
-rw-r--r--usr.sbin/sade/command.c76
-rw-r--r--usr.sbin/sade/devices.c505
-rw-r--r--usr.sbin/sade/disks.c588
-rw-r--r--usr.sbin/sade/dmenu.c15
-rw-r--r--usr.sbin/sade/globals.c4
-rw-r--r--usr.sbin/sade/install.c200
-rw-r--r--usr.sbin/sade/label.c602
-rw-r--r--usr.sbin/sade/main.c4
-rw-r--r--usr.sbin/sade/menus.c501
-rw-r--r--usr.sbin/sade/sade.h61
-rw-r--r--usr.sbin/sade/wizard.c442
-rw-r--r--usr.sbin/sysinstall/Makefile3
-rw-r--r--usr.sbin/sysinstall/command.c76
-rw-r--r--usr.sbin/sysinstall/devices.c505
-rw-r--r--usr.sbin/sysinstall/disks.c588
-rw-r--r--usr.sbin/sysinstall/dist.c199
-rw-r--r--usr.sbin/sysinstall/dmenu.c15
-rw-r--r--usr.sbin/sysinstall/globals.c4
-rw-r--r--usr.sbin/sysinstall/install.c200
-rw-r--r--usr.sbin/sysinstall/label.c602
-rw-r--r--usr.sbin/sysinstall/main.c4
-rw-r--r--usr.sbin/sysinstall/media.c116
-rw-r--r--usr.sbin/sysinstall/menus.c501
-rw-r--r--usr.sbin/sysinstall/sysinstall.h61
-rw-r--r--usr.sbin/sysinstall/tcpip.c326
-rw-r--r--usr.sbin/sysinstall/wizard.c442
43 files changed, 6142 insertions, 4149 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile
index 24baf10..ad6e00b 100644
--- a/release/sysinstall/Makefile
+++ b/release/sysinstall/Makefile
@@ -8,7 +8,8 @@ SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
- disks.c command.c decode.c
+ disks.c command.c decode.c label.c \
+ tcpip.c
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
diff --git a/release/sysinstall/command.c b/release/sysinstall/command.c
index a143be0..5d59426 100644
--- a/release/sysinstall/command.c
+++ b/release/sysinstall/command.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: command.c,v 1.1 1995/05/08 06:08:27 jkh Exp $
+ * $Id: command.c,v 1.2 1995/05/11 09:01:24 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,7 +47,10 @@
typedef struct {
char key[FILENAME_MAX];
- char *cmds[MAX_NUM_COMMANDS];
+ struct {
+ enum { CMD_SHELL, CMD_FUNCTION } type;
+ void *ptr, *data;
+ } cmds[MAX_NUM_COMMANDS];
int ncmds;
} Command;
@@ -55,6 +58,7 @@ typedef struct {
static Command *commandStack[MAX_CMDS];
int numCommands;
+/* Nuke the command stack */
void
command_clear(void)
{
@@ -62,13 +66,15 @@ command_clear(void)
for (i = 0; i < numCommands; i++)
for (j = 0; j < commandStack[i]->ncmds; j++)
- free(commandStack[i]->cmds[j]);
+ if (commandStack[i]->cmds[j].type == CMD_SHELL)
+ free(commandStack[i]->cmds[j].ptr);
free(commandStack[i]);
numCommands = 0;
}
+/* Add a shell command under a given key */
void
-command_add(char *key, char *fmt, ...)
+command_shell_add(char *key, char *fmt, ...)
{
va_list args;
char *cmd;
@@ -82,22 +88,59 @@ command_add(char *key, char *fmt, ...)
/* First, look for the key already present and add a command to it */
for (i = 0; i < numCommands; i++) {
if (!strcmp(commandStack[i]->key, key)) {
- commandStack[i]->cmds[commandStack[i]->ncmds++] = cmd;
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
msgFatal("More than %d commands stacked up behind %s??",
MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_SHELL;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)cmd;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = NULL;
+ ++(commandStack[i]->ncmds);
return;
}
}
+ if (numCommands == MAX_CMDS)
+ msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
/* If we fell to here, it's a new key */
commandStack[numCommands] = safe_malloc(sizeof(Command));
strcpy(commandStack[numCommands]->key, key);
commandStack[numCommands]->ncmds = 1;
- commandStack[numCommands++]->cmds[0] = cmd;
+ commandStack[numCommands]->cmds[0].type = CMD_SHELL;
+ commandStack[numCommands]->cmds[0].ptr = (void *)cmd;
+ commandStack[numCommands]->cmds[0].data = NULL;
+}
+
+/* Add a shell command under a given key */
+void
+command_func_add(char *key, commandFunc func, void *data)
+{
+ int i;
+
+ /* First, look for the key already present and add a command to it */
+ for (i = 0; i < numCommands; i++) {
+ if (!strcmp(commandStack[i]->key, key)) {
+ if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
+ msgFatal("More than %d commands stacked up behind %s??",
+ MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_FUNC;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)func;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = data;
+ ++(commandStack[i]->ncmds);
+ return;
+ }
+ }
if (numCommands == MAX_CMDS)
msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
+ /* If we fell to here, it's a new key */
+ commandStack[numCommands] = safe_malloc(sizeof(Command));
+ strcpy(commandStack[numCommands]->key, key);
+ commandStack[numCommands]->ncmds = 1;
+ commandStack[numCommands]->cmds[0].type = CMD_FUNC;
+ commandStack[numCommands++]->cmds[0].ptr = (void *)func;
}
+/* arg to sort */
static int
sort_compare(const void *p1, const void *p2)
{
@@ -110,17 +153,30 @@ command_sort(void)
qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
}
+/* Run all accumulated commands in sorted order */
void
command_execute(void)
{
int i, j, ret;
+ commandFunc func;
for (i = 0; i < numCommands; i++) {
for (j = 0; j < commandStack[i]->ncmds; j++) {
- msgNotify("Executing command: %s", commandStack[i]->cmds[j]);
- ret = system(commandStack[i]->cmds[j]);
- msgDebug("Command: %s returns status %d\n",
- commandStack[i]->cmds[j], ret);
+ if (commandStack[i].type == CMD_SHELL) {
+ msgNotify("Executing command: %s",
+ commandStack[i]->cmds[j].ptr);
+ ret = system((char *)commandStack[i]->cmds[j].ptr);
+ msgDebug("Command `%s' returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
+ else {
+ func = (commandFunc)commandStack[i]->cmds.ptr;
+ msgNotify("Executing internal command @ %0x", func);
+ ret = (*func)(commandStack[i]->cmds.key,
+ commandStack[i]->cmds.data);
+ msgDebug("Function @ %x returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
}
}
}
diff --git a/release/sysinstall/decode.c b/release/sysinstall/decode.c
index 4c91353..a3d965f 100644
--- a/release/sysinstall/decode.c
+++ b/release/sysinstall/decode.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: decode.c,v 1.1 1995/05/10 07:44:54 jkh Exp $
+ * $Id: decode.c,v 1.2 1995/05/11 06:10:43 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -60,9 +60,7 @@ Boolean
dispatch(DMenuItem *tmp, char *name)
{
Boolean failed = FALSE;
- int choice, scroll, curr, max;
- choice = scroll = curr = max = 0;
switch (tmp->type) {
/* User whapped ESC twice and wants a sub-shell */
case DMENU_SHELL_ESCAPE:
@@ -76,7 +74,7 @@ dispatch(DMenuItem *tmp, char *name)
/* It's a sub-menu; recurse on it */
case DMENU_SUBMENU:
- dmenuOpen((DMenu *)tmp->ptr, &choice, &scroll, &curr, &max);
+ dmenuOpenSimple((DMenu *)tmp->ptr);
break;
/* Execute it as a system command */
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c
index c1f4b94..aa63d8d 100644
--- a/release/sysinstall/devices.c
+++ b/release/sysinstall/devices.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: devices.c,v 1.13 1995/05/11 06:10:45 jkh Exp $
+ * $Id: devices.c,v 1.14 1995/05/11 06:47:42 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,324 +42,277 @@
*/
#include "sysinstall.h"
+
#include <sys/fcntl.h>
-#include <ctype.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <arpa/inet.h>
+
+#define NSIP
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#include <netdb.h>
+
+#define EON
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
+#include <sys/protosw.h>
-/* Where we start displaying chunk information on the screen */
-#define CHUNK_START_ROW 5
+#include <ctype.h>
-static char *cdrom_table[] = {
- "cd0a", "cd1a", /* SCSI */
- "mcd0a", "mcd1a", /* Mitsumi (old model) */
- "scd0a", "scd1a", /* Sony CDROM */
- "matcd0a", "matcd1a", /* Matsushita (SB) */
- NULL,
+static Device *Devices[DEV_MAX];
+static int numDevs;
+
+#define CHECK_DEVS \
+ if (numDevs == DEV_MAX) msgFatal("Too many devices found!")
+
+static struct {
+ DeviceType type;
+ char *name;
+ char *description;
+} device_names[] = {
+ { DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
+ { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
+ { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", }
+ { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ("sound blaster" type)" },
+ { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM ("sound blaster" type - 2nd unit)" },
+ { DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
+ { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
+ { DEVICE_TYPE_TAPE, "ft0", "Floppy tape drive (QIC-02)" },
+ { DEVICE_TYPE_TAPE, "wt0", "Wangtek tape drive" },
+ { DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
+ { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
+ { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
+ { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
+ { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" },
+ { DEVICE_TYPE_NETWORK, "tun", "Tunneling IP driver (not for direct use)" },
+ { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 cards" },
+ { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 interface card" },
+ { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 interface card" },
+ { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A Ethernet" },
+ { DEVICE_TYPE_NETWORK, "ie", "AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210" },
+ { DEVICE_TYPE_NETWORK, "le", "DEC EtherWorks 2 and 3" },
+ { DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL)" },
+ { DEVICE_TYPE_NETWORK, "ze", "IBM/National Semiconductor PCMCIA ethernet controller" },
+ { DEVICE_TYPE_NETWORK, "zp", "3Com PCMCIA Etherlink III" },
+ { NULL },
};
-/* Get all device information for a given device class */
static Device *
-device_get_all(DeviceType which, int *ndevs)
+new_device(char *name)
{
- 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;
- }
- free(names);
- }
- }
- if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
- char try[FILENAME_MAX];
- int i, fd;
-
- for (i = 0; cdrom_table[i]; i++) {
- snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
- fd = open(try, O_RDWR);
- if (fd > 0) {
- close(fd);
- devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
- strcpy(devs[*ndevs].name, cdrom_table[i]);
- devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
- break;
- }
- }
- }
- /* Terminate the devices array */
- devs[*ndevs].name[0] = '\0';
- return devs;
+ Device *dev;
+
+ dev = safe_malloc(sizeof(Device));
+ if (name)
+ strcpy(dev->name, name);
+ else
+ dev->name[0] = '\0';
+ return dev;
}
-static struct chunk *chunk_info[10];
-static int current_chunk;
-
-static void
-record_chunks(struct disk *d)
+static int
+deviceTry(char *name)
{
- struct chunk *c1;
- int i = 0;
- int last_free = 0;
- if (!d->chunks)
- msgFatal("No chunk list found for %s!", d->name);
- c1 = d->chunks->part;
- current_chunk = 0;
- while (c1) {
- if (c1->type == unused && c1->size > last_free) {
- last_free = c1->size;
- current_chunk = i;
- }
- chunk_info[i++] = c1;
- c1 = c1->next;
- }
- chunk_info[i] = NULL;
-}
-
-static void
-print_chunks(struct disk *d)
-{
- int row;
- int i;
-
- attrset(A_NORMAL);
- mvaddstr(0, 0, "Disk name:\t");
- attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
- attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
- mvprintw(1, 0,
- "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
- "Offset", "Size", "End", "Name", "PType", "Desc",
- "Subtype", "Flags");
- for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
- if (i == current_chunk)
- attrset(A_REVERSE);
- mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
- chunk_info[i]->offset, chunk_info[i]->size,
- chunk_info[i]->end, chunk_info[i]->name,
- chunk_info[i]->type, chunk_n[chunk_info[i]->type],
- chunk_info[i]->subtype, chunk_info[i]->flags);
- if (i == current_chunk)
- attrset(A_NORMAL);
- }
+ char try[FILENAME_MAX];
+
+ snprintf(try, FILENAME_MAX, "/dev/%s", name);
+ fd = open(try, O_RDWR);
+ if (fd > 0)
+ return fd;
+ snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
+ fd = open(try, O_RDWR);
+ return fd;
}
static void
-print_command_summary()
+deviceDiskFree(Device *dev)
{
- mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
- mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
- mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
- mvprintw(20, 0, "The currently selected partition is displayed in ");
- attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
- mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
- move(0, 0);
+ Disk_Close(dev->private);
}
-struct disk *
-device_slice_disk(struct disk *d)
+/* Get all device information for devices we have attached */
+void
+deviceGetAll(Boolean disksOnly)
{
- char *p;
- int key = 0;
- Boolean chunking;
- char *msg = NULL;
- char name[40];
+ int i, fd, s;
+ struct ifconf ifc;
+ struct ifreq *ifptr, *end;
+ int ifflags, selectflag = -1;
+ char buffer[INTERFACES_MAX * sizeof(struct ifreq)];
- dialog_clear();
- chunking = TRUE;
- strncpy(name, d->name, 40);
- keypad(stdscr, TRUE);
+ /* We do this at the very beginning */
+ if (disksOnly) {
+ char **names = Disk_names();
- record_chunks(d);
- while (chunking) {
- clear();
- print_chunks(d);
- print_command_summary();
- if (msg) {
- standout(); mvprintw(23, 0, msg); standend();
- beep();
- msg = NULL;
+ if (names) {
+ int i;
+
+ for (i = 0; names[i]; i++) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_device(names[i]);
+ Devices[numDevs]->type = DEVICE_TYPE_DISK;
+ Devices[numDevs]->ignore = TRUE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaUFSGet;
+ Devices[numDevs]->close = deviceDiskFree;
+ Devices[numDevs]->private = Open_Disk(names[i]);
+ if (!Devices[numDevs]->private)
+ msgFatal("Unable to open device for %s!", names[i]);
+ msgDebug("Found a device of type disk named: %s\n",
+ names[i]);
+ ++numDevs;
+ }
+ free(names);
}
- refresh();
-
- key = toupper(getch());
- switch (key) {
- case KEY_UP:
- case '-':
- if (current_chunk != 0)
- --current_chunk;
- break;
-
- case KEY_DOWN:
- case '+':
- case '\r':
- case '\n':
- if (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_HOME:
- current_chunk = 0;
- break;
-
- case KEY_END:
- while (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_F(1):
- case '?':
- systemDisplayFile("slice.hlp");
- break;
-
- case 'A':
- All_FreeBSD(d);
- record_chunks(d);
- break;
-
- case 'B':
- if (chunk_info[current_chunk]->type != freebsd)
- msg = "Can only scan for bad blocks in FreeBSD partition.";
- else if (strncmp(name, "sd", 2) ||
- !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
- chunk_info[current_chunk]->flags |= CHUNK_BAD144;
- break;
-
- case 'C':
- if (chunk_info[current_chunk]->type != unused)
- msg = "Partition in use, delete it first or move to an unused one.";
- else {
- char *val, tmp[20];
- int size;
+ return;
+ }
- snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
- val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
- if (val && (size = strtol(val, 0, 0)) > 0) {
- Create_Chunk(d, chunk_info[current_chunk]->offset,
- size,
- freebsd,
- 3,
- (chunk_info[current_chunk]->flags &
- CHUNK_ALIGN));
- record_chunks(d);
- }
+ /*
+ * Try to get all the types of devices it makes sense to get at the
+ * second stage of the installation.
+ */
+ for (i = 0; device_names[i].name; i++) {
+ switch(device_names[i].type) {
+ case DEVICE_TYPE_CDROM:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_CDROM;
+ Devices[numDevs]->description = devices_names[i].description;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaCDROMGet;
+ Devices[numDevs]->close = NULL;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type CDROM named: %s\n",
+ cdrom_table[i]);
+ ++numDevs;
}
break;
- case 'D':
- if (chunk_info[current_chunk]->type == unused)
- msg = "Partition is already unused!";
- else {
- Delete_Chunk(d, chunk_info[current_chunk]);
- record_chunks(d);
+ case DEVICE_TYPE_TAPE:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_TAPE;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaTapeInit;
+ Devices[numDevs]->get = mediaTapeGet;
+ Devices[numDevs]->close = mediaTapeClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type TAPE named: %s\n",
+ tape_table[i]);
+ ++numDevs;
}
break;
-
- case 'G': {
- char *val, geometry[80];
-
- snprintf(geometry, 80, "%lu/%lu/%lu",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- val = msgGetInput(geometry,
-"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
- if (val) {
- d->bios_cyl = strtol(val, &val, 0);
- d->bios_hd = strtol(val + 1, &val, 0);
- d->bios_sect = strtol(val + 1, 0, 0);
- }
}
- break;
-
- case 'S':
- /* Set Bootable */
- chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
- break;
-
- case 'U':
- Free_Disk(d);
- d = Open_Disk(name);
- if (!d)
- msgFatal("Can't reopen disk %s!", name);
- record_chunks(d);
- break;
-
- case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
- clear();
- dialog_clear();
- end_dialog();
- DialogActive = FALSE;
- slice_wizard(d);
- clear();
- dialog_clear();
- DialogActive = TRUE;
- record_chunks(d);
- }
- else
- msg = "Wise choice!";
- break;
-
- case 27: /* ESC */
- chunking = FALSE;
- break;
+ }
- default:
- beep();
- msg = "Type F1 or ? for help";
- break;
+ /*
+ * Now go for the network interfaces dynamically. Stolen shamelessly
+ * from ifconfig!
+ */
+ ifc.ifc_len = sizeof(buffer);
+ ifc.ifc_buf = buffer;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ msgConfirm("ifconfig: socket");
+ return;
+ }
+ if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
+ msgConfirm("ifconfig (SIOCGIFCONF)");
+ return;
+ }
+ ifflags = ifc.ifc_req->ifr_flags;
+ end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
+ ifptr = ifc.ifc_req;
+ while (ifptr < end) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(ifptr->ifr_name);
+ Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaNetworkInit;
+ Devices[numDevs]->get = mediaNetworkGet;
+ Devices[numDevs]->close = mediaNetworkClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type network named: %s\n",
+ ifptr->ifr_name);
+ ++numDevs;
+ close(s);
+ if ((s = socket(af, SOCK_DGRAM, 0)) < 0) {
+ msgConfirm("ifconfig: socket");
+ continue;
}
+ if (ifptr->ifr_addr.sa_len) /* Dohw! */
+ ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len
+ - sizeof(struct sockaddr));
+ ifptr++;
}
- p = CheckRules(d);
- if (p) {
- msgConfirm(p);
- free(p);
+ /* Terminate the devices array */
+ Devices[numDevs] = NULL;
+}
+
+/*
+ * Find all devices that match the criteria, allowing "wildcarding" as well
+ * by allowing NULL or ANY values to match all.
+ */
+Device **
+deviceFind(char *name, DeviceType class)
+{
+ static Device *found[DEV_MAX];
+ int i, j;
+
+ for (i = 0, j = 0; i < numDevs; i++) {
+ if ((!name || !strcmp(Devices[i]->name, name)) &&
+ (class == DEVICE_TYPE_ANY || class == Devices[i]->type))
+ found[j++] = Devices[i];
}
- clear();
- refresh();
- return d;
+ found[j] = NULL;
+ return j ? found : NULL;
}
/*
- * Create a menu listing all the devices in the system. The pass-in menu
- * is expected to be a "prototype" from which the new menu is cloned.
+ * Create a menu listing all the devices of a certain type in the system.
+ * The passed-in menu is expected to be a "prototype" from which the new
+ * menu is cloned.
*/
DMenu *
-device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
+deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)())
{
- Device *devices;
- int numdevs;
+ Device **devs;
- 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;
+ devs = deviceFind(NULL, type);
+ if (devs) {
DMenu *tmp;
- int i;
+ int i, j;
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);
+ for (i = 0; *devs; i++, devs++) {
+ tmp->items[i].title = *devs->name;
+ for (j = 0; device_names[j].name; j++) {
+ if (!strncmp(*devs->name, device_names[j].name,
+ strlen(device_names[j].name)))
+ tmp->items[i].prompt = devices_names[j].description;
+ }
+ if (!device_names[j].name)
+ tmp->items[i].prompt = "<unknown device type>";
tmp->items[i].type = DMENU_CALL;
tmp->items[i].ptr = hook;
tmp->items[i].disabled = FALSE;
diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c
index baf2137..dafaf37 100644
--- a/release/sysinstall/disks.c
+++ b/release/sysinstall/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.16 1995/05/11 06:10:48 jkh Exp $
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -45,298 +45,58 @@
#include <ctype.h>
#include <sys/disklabel.h>
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-
-#define MAX_CHUNKS 50
-
-/* Where to start printing the freebsd slices */
-#define CHUNK_SLICE_START_ROW 2
-#define CHUNK_PART_START_ROW 10
-
-/* The smallest filesystem we're willing to create */
-#define FS_MIN_SIZE 2048
-
-#define MSG_NOT_APPLICABLE "That option is not applicable here"
+/* Where we start displaying chunk information on the screen */
+#define CHUNK_START_ROW 5
-static struct {
- struct disk *d;
- struct chunk *c;
- PartType type;
-} fbsd_chunk_info[MAX_CHUNKS + 1];
+/* Where we keep track of MBR chunks */
+static struct chunk *chunk_info[10];
static int current_chunk;
-
-static Boolean
-check_conflict(char *name)
-{
- int i;
-
- for (i = 0; fbsd_chunk_info[i].d; i++)
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
- fbsd_chunk_info[i].c->private &&
- !strcmp(((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint,
- name))
- return TRUE;
- return FALSE;
-}
-
-static int
-space_free(struct chunk *c)
-{
- struct chunk *c1 = c->part;
- int sz = c->size;
-
- while (c1) {
- if (c1->type != unused)
- sz -= c1->size;
- c1 = c1->next;
- }
- if (sz < 0)
- msgFatal("Partitions are larger than actual chunk??");
- return sz;
-}
-
static void
-record_fbsd_chunks()
+record_chunks(Disk *d)
{
- int i, j, p;
- struct chunk *c1, *c2;
-
- j = p = 0;
- for (i = 0; Disks[i]; i++) {
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
-
- /* Put the freebsd chunks first */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- fbsd_chunk_info[j].type = PART_SLICE;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c1;
- ++j;
- }
- }
- }
- for (i = 0; Disks[i]; i++) {
- /* Then buzz through and pick up the partitions */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part) {
- if (c2->subtype == FS_SWAP)
- fbsd_chunk_info[j].type = PART_SWAP;
- else
- fbsd_chunk_info[j].type = PART_FILESYSTEM;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c2;
- ++j;
- }
- }
- }
- }
- }
- fbsd_chunk_info[j].d = NULL;
- fbsd_chunk_info[j].c = NULL;
- if (current_chunk >= j)
- current_chunk = j ? j - 1 : 0;
-}
-
-static PartInfo *
-new_part(char *mpoint, Boolean newfs)
-{
- PartInfo *ret;
-
- ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
- strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
- strcpy(ret->newfs_cmd, "newfs");
- ret->newfs = newfs;
- return ret;
-}
-
-PartInfo *
-get_mountpoint(struct chunk *c)
-{
- char *val;
- PartInfo *tmp;
-
- val = msgGetInput(c && c->private ?
- ((PartInfo *)c->private)->mountpoint : NULL,
- "Please specify a mount point for the partition");
- if (val) {
- if (check_conflict(val)) {
- msgConfirm("You already have a mount point for %s assigned!", val);
- return NULL;
- }
- else if (*val != '/') {
- msgConfirm("Mount point must start with a / character");
- return NULL;
- }
- else if (!strcmp(val, "/")) {
- if (c) {
- if (c->flags & CHUNK_PAST_1024) {
- msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
- return NULL;
- }
-#if 0 /* This never seems to be set */
- else if (!(c->flags & CHUNK_BSD_COMPAT)) {
- msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
- return NULL;
- }
-#endif
- else
- c->flags |= CHUNK_IS_ROOT;
- }
- }
- else if (c)
- c->flags &= ~CHUNK_IS_ROOT;
- safe_free(c ? c->private : NULL);
- tmp = new_part(val, TRUE);
- if (c) {
- c->private = tmp;
- c->private_free = safe_free;
+ struct chunk *c1;
+ int i = 0;
+ int last_free = 0;
+ if (!d->chunks)
+ msgFatal("No chunk list found for %s!", d->name);
+ c1 = d->chunks->part;
+ current_chunk = 0;
+ while (c1) {
+ if (c1->type == unused && c1->size > last_free) {
+ last_free = c1->size;
+ current_chunk = i;
}
- return tmp;
- }
- return NULL;
-}
-
-static PartType
-get_partition_type(void)
-{
- char selection[20];
- static unsigned char *fs_types[] = {
- "FS",
- "A file system",
- "Swap",
- "A swap partition.",
- };
-
- if (!dialog_menu("Please choose a partition type",
- "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
- if (!strcmp(selection, "FS"))
- return PART_FILESYSTEM;
- else if (!strcmp(selection, "Swap"))
- return PART_SWAP;
+ chunk_info[i++] = c1;
+ c1 = c1->next;
}
- return PART_NONE;
-}
-
-static void
-getNewfsCmd(PartInfo *p)
-{
- char *val;
-
- val = msgGetInput(p->newfs_cmd,
- "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
- if (val)
- strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+ chunk_info[i] = NULL;
}
-
-#define MAX_MOUNT_NAME 12
-
-#define PART_PART_COL 0
-#define PART_MOUNT_COL 8
-#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
-#define PART_NEWFS_COL (PART_SIZE_COL + 7)
-#define PART_OFF 38
-
-/* How many mounted partitions to display in column before going to next */
-#define CHUNK_COLUMN_MAX 6
-
static void
-print_fbsd_chunks(void)
+print_chunks(Disk *d)
{
- int i, j, srow, prow, pcol;
- int sz;
+ int row;
+ int i;
- attrset(A_REVERSE);
- mvaddstr(0, 25, "FreeBSD Partition Editor");
attrset(A_NORMAL);
-
- for (i = 0; i < 2; i++) {
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
- "Part");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
- "Mount");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
- "Size");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
- "Newfs");
- attrset(A_NORMAL);
- }
-
- srow = CHUNK_SLICE_START_ROW;
- prow = CHUNK_PART_START_ROW;
- pcol = 0;
-
- for (i = 0; fbsd_chunk_info[i].d; i++) {
+ mvaddstr(0, 0, "Disk name:\t");
+ attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
+ attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
+ mvprintw(1, 0,
+ "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
attrset(A_REVERSE);
- /* Is it a slice entry displayed at the top? */
- if (fbsd_chunk_info[i].type == PART_SLICE) {
- sz = space_free(fbsd_chunk_info[i].c);
- mvprintw(srow++, 0,
- "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
- fbsd_chunk_info[i].d->name,
- fbsd_chunk_info[i].c->name, sz, (sz / 2048));
- }
- /* Otherwise it's a swap or filesystem entry, at the bottom */
- else {
- char onestr[PART_OFF], num[10], *mountpoint, *newfs;
-
- memset(onestr, ' ', PART_OFF - 1);
- onestr[PART_OFF - 1] = '\0';
- /* Go for two columns */
- if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
- pcol = PART_OFF;
- prow = CHUNK_PART_START_ROW;
- }
- memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
- strlen(fbsd_chunk_info[i].c->name));
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
- if (fbsd_chunk_info[i].c->private) {
- mountpoint = ((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint;
- newfs = ((PartInfo *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N";
- }
- else {
- fbsd_chunk_info[i].c->private = new_part("", FALSE);
- fbsd_chunk_info[i].c->private_free = safe_free;
- mountpoint = " ";
- newfs = "N";
- }
- }
- else {
- mountpoint = "swap";
- newfs = " ";
- }
- for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
- onestr[PART_MOUNT_COL + j] = mountpoint[j];
- snprintf(num, 10, "%4ldMB", fbsd_chunk_info[i].c->size ?
- fbsd_chunk_info[i].c->size / 2048 : 0);
- memcpy(onestr + PART_SIZE_COL, num, strlen(num));
- memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
- onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
- mvaddstr(prow, pcol, onestr);
- ++prow;
- }
+ mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
+ chunk_info[i]->offset, chunk_info[i]->size,
+ chunk_info[i]->end, chunk_info[i]->name,
+ chunk_info[i]->type, chunk_n[chunk_info[i]->type],
+ chunk_info[i]->subtype, chunk_info[i]->flags);
if (i == current_chunk)
attrset(A_NORMAL);
}
@@ -345,46 +105,44 @@ print_fbsd_chunks(void)
static void
print_command_summary()
{
- mvprintw(17, 0,
- "The following commands are valid here (upper or lower case):");
- mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
- mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
- mvprintw(21, 0, "The default target will be displayed in ");
-
- attrset(A_REVERSE);
- addstr("reverse video.");
- attrset(A_NORMAL);
- mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
+ mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
+ mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
+ mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
+ mvprintw(20, 0, "The currently selected partition is displayed in ");
+ attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
+ mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
move(0, 0);
}
-void
-partition_disks(void)
+static Disk *
+diskPartition(Disk *d)
{
- int sz, key = 0;
- Boolean partitioning;
+ char *p;
+ int key = 0;
+ Boolean chunking;
char *msg = NULL;
- PartInfo *p;
- PartType type;
+ char name[40];
dialog_clear();
- partitioning = TRUE;
+ chunking = TRUE;
+ strncpy(name, d->name, 40);
keypad(stdscr, TRUE);
- record_fbsd_chunks();
- while (partitioning) {
+ record_chunks(d);
+ while (chunking) {
clear();
- print_fbsd_chunks();
+ print_chunks(d);
print_command_summary();
if (msg) {
- attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ standout(); mvprintw(23, 0, msg); standend();
beep();
msg = NULL;
}
refresh();
+
key = toupper(getch());
switch (key) {
-
case KEY_UP:
case '-':
if (current_chunk != 0)
@@ -395,7 +153,7 @@ partition_disks(void)
case '+':
case '\r':
case '\n':
- if (fbsd_chunk_info[current_chunk + 1].d)
+ if (chunk_info[current_chunk + 1])
++current_chunk;
break;
@@ -404,138 +162,104 @@ partition_disks(void)
break;
case KEY_END:
- while (fbsd_chunk_info[current_chunk + 1].d)
+ while (chunk_info[current_chunk + 1])
++current_chunk;
break;
case KEY_F(1):
case '?':
- systemDisplayFile("partitioning.hlp");
+ systemDisplayFile("slice.hlp");
+ break;
+
+ case 'A':
+ All_FreeBSD(d);
+ record_chunks(d);
+ break;
+
+ case 'B':
+ if (chunk_info[current_chunk]->type != freebsd)
+ msg = "Can only scan for bad blocks in FreeBSD partition.";
+ else if (strncmp(name, "sd", 2) ||
+ !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
+ chunk_info[current_chunk]->flags |= CHUNK_BAD144;
break;
case 'C':
- if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
- msg = "You can only do this in a master partition (see top of screen)";
- break;
- }
- sz = space_free(fbsd_chunk_info[current_chunk].c);
- if (sz <= FS_MIN_SIZE)
- msg = "Not enough space to create additional FreeBSD partition";
+ if (chunk_info[current_chunk]->type != unused)
+ msg = "Partition in use, delete it first or move to an unused one.";
else {
- char *val, *cp, tmp[20];
+ char *val, tmp[20];
int size;
- snprintf(tmp, 20, "%d", sz);
- val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
- if (val && (size = strtol(val, &cp, 0)) > 0) {
- struct chunk *tmp;
- u_long flags = 0;
-
- if (*cp && toupper(*cp) == 'M')
- size *= 2048;
-
- type = get_partition_type();
- if (type == PART_NONE)
- break;
- else if (type == PART_FILESYSTEM) {
- if ((p = get_mountpoint(NULL)) == NULL)
- break;
- else if (!strcmp(p->mountpoint, "/"))
- flags |= CHUNK_IS_ROOT;
- else
- flags &= ~CHUNK_IS_ROOT;
- }
- else
- p = NULL;
-
- tmp = Create_Chunk_DWIM(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c,
- size,
- part,
- (type == PART_SWAP) ?
- FS_SWAP : FS_BSDFFS,
- flags);
- if (!tmp)
- msgConfirm("Unable to create the partition. Too big?");
- else {
- tmp->private = p;
- tmp->private_free = safe_free;
- record_fbsd_chunks();
- }
+ snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
+ val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
+ if (val && (size = strtol(val, 0, 0)) > 0) {
+ Create_Chunk(d, chunk_info[current_chunk]->offset,
+ size,
+ freebsd,
+ 3,
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
+ record_chunks(d);
}
}
break;
- case 'D': /* delete */
- if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
- msg = MSG_NOT_APPLICABLE;
- break;
+ case 'D':
+ if (chunk_info[current_chunk]->type == unused)
+ msg = "Partition is already unused!";
+ else {
+ Delete_Chunk(d, chunk_info[current_chunk]);
+ record_chunks(d);
}
- Delete_Chunk(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c);
- record_fbsd_chunks();
break;
- case 'M': /* mount */
- switch(fbsd_chunk_info[current_chunk].type) {
- case PART_SLICE:
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case PART_SWAP:
- msg = "You don't need to specify a mountpoint for a swap partition.";
- break;
-
- case PART_FILESYSTEM:
- p = get_mountpoint(fbsd_chunk_info[current_chunk].c);
- if (p) {
- p->newfs = FALSE;
- record_fbsd_chunks();
- }
- break;
-
- default:
- msgFatal("Bogus partition under cursor???");
- break;
+ case 'G': {
+ char *val, geometry[80];
+
+ snprintf(geometry, 80, "%lu/%lu/%lu",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ val = msgGetInput(geometry,
+"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
+ if (val) {
+ d->bios_cyl = strtol(val, &val, 0);
+ d->bios_hd = strtol(val + 1, &val, 0);
+ d->bios_sect = strtol(val + 1, 0, 0);
}
+ }
break;
- case 'N': /* Set newfs options */
- if (fbsd_chunk_info[current_chunk].c->private &&
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
- getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'S':
+ /* Set Bootable */
+ chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
- case 'T': /* Toggle newfs state */
- if (fbsd_chunk_info[current_chunk].c->private)
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'U':
+ Free_Disk(d);
+ d = Open_Disk(name);
+ if (!d)
+ msgFatal("Can't reopen disk %s!", name);
+ record_chunks(d);
break;
case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
- int i;
-
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
clear();
dialog_clear();
end_dialog();
DialogActive = FALSE;
- for (i = 0; Disks[i]; i++)
- slice_wizard(Disks[i]);
+ slice_wizard(d);
clear();
dialog_clear();
DialogActive = TRUE;
- record_fbsd_chunks();
+ record_chunks(d);
}
else
- msg = "A most prudent choice!";
+ msg = "Wise choice!";
break;
case 27: /* ESC */
- partitioning = FALSE;
+ chunking = FALSE;
break;
default:
@@ -544,31 +268,65 @@ partition_disks(void)
break;
}
}
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ clear();
+ refresh();
+ variable_set2(DISK_PARTITIONED, "yes");
+ return d;
}
-int
-write_disks(void)
+static int
+partitionHook(char *str)
{
- int i;
- extern u_char boot1[], boot2[];
- extern u_char mbr[], bteasy17[];
-
- dialog_clear();
- for (i = 0; Disks[i]; i++) {
- Set_Boot_Blocks(Disks[i], boot1, boot2);
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
- Set_Boot_Mgr(Disks[i], bteasy17);
- else {
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to remove an existing boot manager?"))
- Set_Boot_Mgr(Disks[i], mbr);
+ Device *devs;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ /* Try and open all the disks */
+ while (str) {
+ char *cp;
+
+ cp = index(str, '\n');
+ if (cp)
+ *cp++ = 0;
+ if (!*str) {
+ beep();
+ return 0;
}
- dialog_clear();
- if (!msgYesNo("Last Chance! Are you sure you want to write out\nall these changes to disk?")) {
- Write_Disk(Disks[i]);
+ devs = deviceFind(str, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Unable to find disk %s!", str);
return 0;
}
+ else if (devs[1])
+ msgConfirm("Bizarre multiple match for %s!", str);
+ devs[0]->private = diskPartition((Disk *)devs[0]->private);
+ str = cp;
+ }
+ return devs ? 1 : 0;
+}
+
+extern DMenu MenuInstall;
+
+int
+diskPartitionEditor(char *str)
+{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+
+ menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
+ if (!menu) {
+ 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 0;
}
- return 1;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ return 0;
}
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c
index 1453cfd..a2eee9a 100644
--- a/release/sysinstall/dist.c
+++ b/release/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.2 1995/05/08 21:39:34 jkh Exp $
+ * $Id: dist.c,v 1.3 1995/05/10 07:44:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -103,10 +103,8 @@ int
distSetSrc(char *str)
{
extern DMenu MenuSrcDistributions;
- int choice, scroll, curr, max;
- choice = scroll = curr = max;
- dmenuOpen(&MenuSrcDistributions, &choice, &scroll, &curr, &max);
+ dmenuOpenSimple(&MenuSrcDistributions);
if (SrcDists)
Dists |= DIST_SRC;
return 0;
@@ -116,109 +114,138 @@ static int
distSetXF86(char *str)
{
extern DMenu MenuXF86;
- int choice, scroll, curr, max;
- choice = scroll = curr = max;
- dmenuOpen(&MenuXF86, &choice, &scroll, &curr, &max);
+ dmenuOpenSimple(&MenuXF86);
return 0;
}
-static struct _dist {
+typedef struct _dist {
char *my_name;
+ unsigned int *my_mask;
unsigned int my_bit;
-} DistTable[] = {
-{ "bin", DIST_BIN },
-{ "games", DIST_GAMES },
-{ "manpages", DIST_MANPAGES },
-{ "proflibs", DIST_PROFLIBS },
-{ "dict", DIST_DICT },
-{ "src", DIST_SRC },
-{ "des", DIST_DES },
-{ "compat1x", DIST_COMPAT1X },
-{ "xf86311", DIST_XF86 },
-{ NULL, 0 },
+ struct _dist *my_dist;
+} Distribution;
+
+extern Distribution SrcDistTable[];
+extern Distribution XF86DistTable[];
+extern Distribution XF86FontDistTable[];
+extern Distribution XF86ServerDistTable[];
+
+
+/* The top-level distribution categories */
+static Distribution DistTable[] = {
+{ "bin", &Dist, DIST_BIN, NULL },
+{ "games", &Dist, DIST_GAMES, NULL },
+{ "manpages", &Dist, DIST_MANPAGES, NULL },
+{ "proflibs", &Dist, DIST_PROFLIBS, NULL },
+{ "dict", &Dist, DIST_DICT, NULL },
+{ "src/", &Dist, DIST_SRC, &SrcDistTable },
+{ "des", &Dist, DIST_DES, NULL },
+{ "compat1x", &Dist, DIST_COMPAT1X, NULL },
+{ "xf86311/", &Dist, DIST_XF86, &XF86DistTable },
+{ NULL },
};
-static struct _dist SrcDistTable[] = {
-{ "base", DIST_SRC_BASE },
-{ "gnu", DIST_SRC_GNU },
-{ "etc", DIST_SRC_ETC },
-{ "games", DIST_SRC_GAMES },
-{ "include", DIST_SRC_INCLUDE},
-{ "lib", DIST_SRC_LIB },
-{ "libexec", DIST_SRC_LIBEXEC},
-{ "lkm", DIST_SRC_LKM },
-{ "release", DIST_SRC_RELEASE},
-{ "sbin", DIST_SRC_SBIN },
-{ "share", DIST_SRC_SHARE },
-{ "sys", DIST_SRC_SYS },
-{ "ubin", DIST_SRC_UBIN },
-{ "usbin", DIST_SRC_USBIN },
+/* The /usr/src distribution */
+static Distribution SrcDistTable[] = {
+{ "base", &SrcDist, DIST_SRC_BASE, NULL },
+{ "gnu", &SrcDist, DIST_SRC_GNU, NULL },
+{ "etc", &SrcDist, DIST_SRC_ETC, NULL },
+{ "games", &SrcDist, DIST_SRC_GAMES, NULL },
+{ "include", &SrcDist, DIST_SRC_INCLUDE, NULL },
+{ "lib", &SrcDist, DIST_SRC_LIB, NULL },
+{ "libexec", &SrcDist, DIST_SRC_LIBEXEC, NULL },
+{ "lkm", &SrcDist, DIST_SRC_LKM, NULL },
+{ "release", &SrcDist, DIST_SRC_RELEASE, NULL },
+{ "sbin", &SrcDist, DIST_SRC_SBIN, NULL },
+{ "share", &SrcDist, DIST_SRC_SHARE, NULL },
+{ "sys", &SrcDist, DIST_SRC_SYS, NULL },
+{ "ubin", &SrcDist, DIST_SRC_UBIN, NULL },
+{ "usbin", &SrcDist, DIST_SRC_USBIN, NULL },
{ NULL, 0 },
};
-static struct _dist XFree86DistTable[] = {
-{ "bin", DIST_XF86_BIN },
-{ "lib", DIST_XF86_LIB },
-{ "doc", DIST_XF86_DOC },
-{ "man", DIST_XF86_MAN },
-{ "prog", DIST_XF86_PROG },
-{ "link", DIST_XF86_LINK },
-{ "pex", DIST_XF86_PEX },
-{ "lbx", DIST_XF86_LBX },
-{ "xicf", DIST_XF86_XINIT },
-{ "xdmcf", DIST_XF86_XDMCF },
-{ NULL, 0 },
+/* The XFree86 distribution */
+static Distribution XF86DistTable[] = {
+{ "bin", &XF86Dist, DIST_XF86_BIN, NULL },
+{ "lib", &XF86Dist, DIST_XF86_LIB, NULL },
+{ "doc", &XF86Dist, DIST_XF86_DOC, NULL },
+{ "xf86311/", &XF86Dist, DIST_XF86_FONTS, &XF86FontDistTable },
+{ "man", &XF86Dist, DIST_XF86_MAN, NULL },
+{ "prog", &XF86Dist, DIST_XF86_PROG, NULL },
+{ "link", &XF86Dist, DIST_XF86_LINK, NULL },
+{ "pex", &XF86Dist, DIST_XF86_PEX, NULL },
+{ "lbx", &XF86Dist, DIST_XF86_LBX, NULL },
+{ "xicf", &XF86Dist, DIST_XF86_XINIT, NULL },
+{ "xdmcf", &XF86Dist, DIST_XF86_XDMCF, NULL },
+{ "xf86311/", &XF86Dist, DIST_XF86_SERVER, &XF86ServerDistTable },
+{ NULL },
};
-static struct _dist XFree86ServerDistTable[] = {
-{ "8514", DIST_XF86_SERVER_8514 },
-{ "AGX", DIST_XF86_SERVER_AGX },
-{ "Mch3", DIST_XF86_SERVER_MACH32 },
-{ "Mch8", DIST_XF86_SERVER_MACH8 },
-{ "Mono", DIST_XF86_SERVER_MONO },
-{ "P9K", DIST_XF86_SERVER_P9000 },
-{ "S3", DIST_XF86_SERVER_S3 },
-{ "SVGA", DIST_XF86_SERVER_SVGA },
-{ "VGA16", DIST_XF86_SERVER_VGA16 },
-{ "W32", DIST_XF86_SERVER_W32 },
-{ "nest", DIST_XF86_SERVER_NEST },
-{ NULL, 0 },
+/* The XFree86 server distribution */
+static Distribution XF86ServerDistTable[] = {
+{ "X3118514", &XF86ServerDist,DIST_XF86_SERVER_8514, NULL },
+{ "X311AGX", &XF86ServerDist,DIST_XF86_SERVER_AGX, NULL },
+{ "X311Mch3", &XF86ServerDist,DIST_XF86_SERVER_MACH32,NULL },
+{ "X311Mch8", &XF86ServerDist,DIST_XF86_SERVER_MACH8, NULL },
+{ "X311Mono", &XF86ServerDist,DIST_XF86_SERVER_MONO, NULL },
+{ "X311P9K", &XF86ServerDist,DIST_XF86_SERVER_P9000, NULL },
+{ "X311S3", &XF86ServerDist,DIST_XF86_SERVER_S3, NULL },
+{ "X311SVGA", &XF86ServerDist,DIST_XF86_SERVER_SVGA, NULL },
+{ "X311VGA16", &XF86ServerDist,DIST_XF86_SERVER_VGA16, NULL },
+{ "X311W32", &XF86ServerDist,DIST_XF86_SERVER_W32, NULL },
+{ "X311nest", &XF86ServerDist,DIST_XF86_SERVER_NEST, NULL },
+{ NULL },
};
-static struct _dist XFree86FontDistTable[] = {
-{ "fnts", DIST_XF86_FONTS_MISC },
-{ "f100", DIST_XF86_FONTS_100 },
-{ "fscl", DIST_XF86_FONTS_SCALE },
-{ "fnon", DIST_XF86_FONTS_NON },
-{ "fsrv", DIST_XF86_FONTS_SERVER },
+/* The XFree86 font distribution */
+static Distribution XF86FontDistTable[] = {
+{ "X311fnts", &XF86FontDist, DIST_XF86_FONTS_MISC, NULL },
+{ "X311f100", &XF86FontDist, DIST_XF86_FONTS_100, NULL },
+{ "X311fscl", &XF86FontDist, DIST_XF86_FONTS_SCALE, NULL },
+{ "X311fnon", &XF86FontDist, DIST_XF86_FONTS_NON, NULL },
+{ "X311fsrv", &XF86FontDist, DIST_XF86_FONTS_SERVER, NULL },
+{ NULL },
};
-static Boolean
-dist_extract(char *name)
+static int
+distExtract(char *parent, Distribution *me)
{
- if (!strcmp(name, "src")) {
- }
- else if (!strcmp(name, "xf86311l")) {
- }
- else {
+ int i, status;
+ FILE *fp;
+
+ status = 0;
+ for (i = 0; me[i].my_name; i++) {
+ if (me[i].my_bit & *(me[i].my_mask)) {
+ if (me[i].my_dist)
+ status = distExtract(me[i].my_name, me[i].my_dist);
+ else {
+ fp = mediaOpen(parent, me[i].my_name);
+ if (fp) {
+ status = extract_dist(fp);
+ close(fp);
+ }
+ else {
+ if (getenv(NO_CONFIRMATION))
+ status = 0;
+ else
+ status = msgYesNo("Unable to retreive the %s distribution from %s.\nDo you want to retry that distribution later?");
+ }
+ }
+ if (!status) {
+ /*
+ * Extract was successful, remove ourselves from further
+ * consideration
+ */
+ *(me[i].my_mask) &= ~(me[i].my_bit);
+ }
+ }
}
- return FALSE;
+ return status;
}
-
+
void
distExtractAll(void)
{
- int i;
-
- while (Dists) {
- for (i = 0; DistTable[i].my_name; i++) {
- if (Dists & DistTable[i].my_bit) {
- if (dist_extract(DistTable[i].my_name))
- Dists &= ~DistTable[i].my_bit;
- else
- continue;
- }
- }
- }
+ distExtract(NULL, DistTable);
}
diff --git a/release/sysinstall/dmenu.c b/release/sysinstall/dmenu.c
index 7c43ed2..d10167c 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.6 1995/05/10 08:00:47 jkh Exp $
+ * $Id: dmenu.c,v 1.7 1995/05/11 06:10:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,6 +47,16 @@
static DMenuItem shellAction = { NULL, NULL, DMENU_SHELL_ESCAPE, NULL, 0 };
+/* Traverse menu but give user no control over positioning */
+void
+dmenuOpenSimple(DMenu *menu)
+{
+ int choice, scroll, curr, max;
+
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+}
+
/* Traverse over an internal menu */
void
dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
@@ -139,7 +149,8 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
}
- if (dispatch(tmp, result) || menu->options & DMENU_SELECTION_RETURNS) {
+ if (dispatch(tmp, result) ||
+ menu->options & DMENU_SELECTION_RETURNS) {
items_free(nitems, curr, max);
return;
}
diff --git a/release/sysinstall/globals.c b/release/sysinstall/globals.c
index 7fc4436..81c75b0 100644
--- a/release/sysinstall/globals.c
+++ b/release/sysinstall/globals.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
+ * $Id: globals.c,v 1.3 1995/05/08 21:39:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,8 +56,6 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
-DeviceType MediaType; /* Where we're installing from */
-char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index 8599c01..7f531f7 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.15 1995/05/11 06:47:44 jkh Exp $
+ * $Id: install.c,v 1.16 1995/05/11 09:01:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -48,136 +48,88 @@
#include <unistd.h>
Boolean SystemWasInstalled;
-struct disk *Disks[100]; /* some ridiculously large number */
-static int
-installHook(char *str)
+static void make_filesystems(void);
+static void cpio_extract(void);
+static void install_configuration_files(void);
+static void do_final_setup(void);
+
+int
+installCommit(char *str)
{
+ extern u_char boot1[], boot2[];
+ extern u_char mbr[], bteasy17[];
+ u_char *mbrContents;
+ Device **devs;
int i;
- extern DMenu MenuInstall;
- i = 0;
- /* Clip garbage off the ends */
- string_prune(str);
- str = string_skipwhite(str);
- /* Try and open all the disks */
- while (str) {
- char *cp;
+ if (!getenv(DISK_PARTITIONED)) {
+ msgConfirm("You need to partition your disk before you can proceed with\nthe installation.");
- cp = index(str, '\n');
- if (cp)
- *cp++ = 0;
- if (!*str) {
- beep();
- return 0;
- }
- Disks[i] = Open_Disk(str);
- if (!Disks[i])
- msgFatal("Unable to open disk %s!", str);
- ++i;
- str = cp;
+ return 0;
}
- Disks[i] = NULL;
- if (!i)
+ if (!getenv(DISK_LABELLED)) {
+ msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
return 0;
-
- while (1) {
- /* Now go set up all the MBR partition information */
- for (i = 0; Disks[i]; i++)
- Disks[i] = device_slice_disk(Disks[i]);
-
- /* Whap partitions on all the FreeBSD slices created */
- partition_disks();
-
- /* Try and write it out */
- if (!write_disks()) {
- int scroll, choice, curr, max;
-
- make_filesystems();
- scroll = choice = curr = max = 0;
- dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
- chdir("/mnt");
- cpio_extract();
- chroot("/mnt");
- distExtractAll();
- install_configuration_files();
- do_final_setup();
- SystemWasInstalled = TRUE;
- break;
- }
- else {
- dialog_clear();
- if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
- for (i = 0; Disks[i]; i++)
- Free_Disk(Disks[i]);
- break;
- }
- }
}
- return SystemWasInstalled;
-}
-
-int
-installCustom(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "custom");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ if (!Dists) {
+ msgConfirm("You haven't told me what distributions to load yet!\nPlease select a distribution from the Distributions menu.");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installExpress(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "express");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ }
+ if (mediaVerifyStatus()) {
+ msgConfirm("Please correct installation media problems and try again!");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installMaint(char *str)
-{
- msgConfirm("Sorry, maintainance mode is not implemented in this version.");
- return 0;
+ }
+ if (msgYesNo("Last Chance! Are you SURE you want continue the\ninstallation? If you're running this on an existing system, we STRONGLY\nencourage you to make proper backups before doing this.\nWe take no responsibility for lost disk contents!"))
+ return 0;
+ dialog_clear();
+ mbrContents = NULL;
+ if (!msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
+ mbrContents = bteasy17;
+ else {
+ dialog_clear();
+ if (!msgYesNo("Would you like to remove an existing boot manager?"))
+ mbrContents = mbr;
+ }
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+ if (mbrContents) {
+ Set_Boot_Mgr((Disk *)Devices[i]->private, mbrContents);
+ mbrContents = NULL;
+ }
+ Set_Boot_Blocks((Disk *)Devices[i]->private, boot1, boot2);
+ msgNotify("Writing partition information to drive %s",
+ Devices[i]->name);
+ Write_Disk((Disk *)Devices[i]->private);
+ }
+ make_filesystems();
+ cpio_extract();
+ install_configuration_files();
+ do_final_setup();
+ return 1;
}
/* Go newfs and/or mount all the filesystems we've been asked to */
-void
+static void
make_filesystems(void)
{
int i;
+ Disk *disk;
+ Chunk *c1;
command_clear();
- for (i = 0; Disks[i]; i++) {
- struct chunk *c1;
-
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
- c1 = Disks[i]->chunks->part;
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+
+ disk = (Disk *)Devices[i]->private;
+ if (!disk->chunks)
+ msgFatal("No chunk list found for %s!", disk->name);
+ c1 = disk->chunks->part;
while (c1) {
if (c1->type == freebsd) {
- struct chunk *c2 = c1->part;
+ Chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP &&
@@ -185,19 +137,12 @@ make_filesystems(void)
PartInfo *tmp = (PartInfo *)c2->private;
if (tmp->newfs)
- command_add(tmp->mountpoint,
- "%s %s", tmp->newfs_cmd, c2->name);
- if (strcmp(tmp->mountpoint, "/")) {
- command_add(tmp->mountpoint,
- "mkdir -p /mnt%s", tmp->mountpoint);
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt%s", c2->name,
- tmp->mountpoint);
- }
- else
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt", c2->name);
-
+ command_shell_add(tmp->mountpoint,
+ "%s %s", tmp->newfs_cmd,
+ c2->name);
+ if (strcmp(tmp->mountpoint, "/"))
+ command_func_add(tmp->mountpoint, Mkdir, NULL);
+ command_func_add(tmp->mountpoint, Mount, c2->name);
}
c2 = c2->next;
}
@@ -209,7 +154,7 @@ make_filesystems(void)
command_execute();
}
-void
+static void
cpio_extract(void)
{
int i, j, zpid, cpid, pfd[2];
@@ -253,13 +198,12 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
-void
+static void
install_configuration_files(void)
{
}
-void
+static void
do_final_setup(void)
{
}
-
diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c
new file mode 100644
index 0000000..9d769a0
--- /dev/null
+++ b/release/sysinstall/label.c
@@ -0,0 +1,602 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 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 <ctype.h>
+#include <sys/disklabel.h>
+
+/*
+ * Everything to do with editing the contents of disk labels.
+ */
+
+/* A nice message we use a lot in the disklabel editor */
+#define MSG_NOT_APPLICABLE "That option is not applicable here"
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+#define MAX_CHUNKS 50
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* The smallest filesystem we're willing to create */
+#define FS_MIN_SIZE 2048
+
+
+/* All the chunks currently displayed on the screen */
+static struct {
+ struct disk *d;
+ struct chunk *c;
+ PartType type;
+} label_chunk_info[MAX_CHUNKS + 1];
+static int here;
+
+/* See if we're already using a desired partition name */
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; label_chunk_info[i].d; i++)
+ if (label_chunk_info[i].type == PART_FILESYSTEM
+ && label_chunk_info[i].c->private
+ && !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
+ return TRUE;
+ return FALSE;
+}
+
+/* How much space is in this FreeBSD slice? */
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+/* Snapshot the current situation into the displayed chunks structure */
+static void
+record_label_chunks()
+{
+ int i, j, p;
+ struct chunk *c1, *c2;
+ Device **devs;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("No disks found!");
+ return;
+ }
+
+ j = p = 0;
+ for (i = 0; devs[i]; i++) {
+ if (!((Disk *)devs[i]->private)->chunks)
+ msgFatal("No chunk list found for %s!", ((Disk *)devs[i]->private)->name);
+
+ /* Put the freebsd chunks first */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ label_chunk_info[j].type = PART_SLICE;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ ++j;
+ }
+ }
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++) {
+ /* Then buzz through and pick up the partitions */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ for (c2 = c1->part; c2; c2 = c2->next) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ label_chunk_info[j].type = PART_SWAP;
+ else
+ label_chunk_info[j].type = PART_FILESYSTEM;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c2;
+ ++j;
+ }
+ }
+ }
+ else if (c1->type == fat) {
+ label_chunk_info[j].type = PART_FAT;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ }
+ }
+ }
+ label_chunk_info[j].d = NULL;
+ label_chunk_info[j].c = NULL;
+ if (here >= j)
+ here = j ? j - 1 : 0;
+}
+
+/* A new partition entry */
+static PartInfo *
+new_part(char *mpoint, Boolean newfs)
+{
+ PartInfo *ret;
+
+ ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
+ strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
+ strcpy(ret->newfs_cmd, "newfs");
+ ret->newfs = newfs;
+ return ret;
+}
+
+/* Get the mountpoint for a partition and save it away */
+PartInfo *
+get_mountpoint(struct chunk *parent, struct chunk *me)
+{
+ char *val;
+ PartInfo *tmp;
+
+ val = msgGetInput(me && me->private ? ((PartInfo *)me->private)->mountpoint : NULL,
+ "Please specify a mount point for the partition");
+ if (val) {
+ /* Is it just the same value? */
+ if (me && me->private && !strcmp(((PartInfo *)me->private)->mountpoint, val))
+ return NULL;
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mount point for %s assigned!", val);
+ return NULL;
+ }
+ else if (*val != '/') {
+ msgConfirm("Mount point must start with a / character");
+ return NULL;
+ }
+ else if (!strcmp(val, "/")) {
+ if (parent) {
+ if (parent->flags & CHUNK_PAST_1024) {
+ msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return NULL;
+ }
+ else if (!(parent->flags & CHUNK_BSD_COMPAT)) {
+ msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
+ return NULL;
+ }
+ }
+ if (me)
+ me->flags |= CHUNK_IS_ROOT;
+ }
+ else if (me)
+ me->flags &= ~CHUNK_IS_ROOT;
+ safe_free(me ? me->private : NULL);
+ tmp = new_part(val, TRUE);
+ if (me) {
+ me->private = tmp;
+ me->private_free = safe_free;
+ }
+ return tmp;
+ }
+ return NULL;
+}
+
+/* Get the type of the new partiton */
+static PartType
+get_partition_type(void)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "FS",
+ "A file system",
+ "Swap",
+ "A swap partition.",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+/* If the user wants a special newfs command for this, set it */
+static void
+getNewfsCmd(PartInfo *p)
+{
+ char *val;
+
+ val = msgGetInput(p->newfs_cmd,
+ "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
+ if (val)
+ strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+}
+
+
+#define MAX_MOUNT_NAME 12
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
+#define PART_NEWFS_COL (PART_SIZE_COL + 7)
+#define PART_OFF 38
+
+/* How many mounted partitions to display in column before going to next */
+#define CHUNK_COLUMN_MAX 6
+
+/* stick this all up on the screen */
+static void
+print_label_chunks(void)
+{
+ int i, j, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Disklabel Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
+ "Size");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+ pcol = 0;
+
+ for (i = 0; label_chunk_info[i].d; i++) {
+ if (i == here)
+ attrset(A_REVERSE);
+ /* Is it a slice entry displayed at the top? */
+ if (label_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(label_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ label_chunk_info[i].d->name,
+ label_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */
+ else {
+ char onestr[PART_OFF], num[10], *mountpoint, *newfs;
+
+ /*
+ * We copy this into a blank-padded string so that it looks like
+ * a solid bar in reverse-video
+ */
+ memset(onestr, ' ', PART_OFF - 1);
+ onestr[PART_OFF - 1] = '\0';
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
+ pcol = PART_OFF;
+ prow = CHUNK_PART_START_ROW;
+ }
+ memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name,
+ strlen(label_chunk_info[i].c->name));
+ /* If it's a filesystem, display the mountpoint */
+ if (label_chunk_info[i].type == PART_FILESYSTEM) {
+ if (label_chunk_info[i].c->private == NULL) {
+ static int mnt = 0;
+ char foo[10];
+
+ /*
+ * Hmm! A partition that must have already been here.
+ * Fill in a fake mountpoint and register it
+ */
+ sprintf(foo, "/mnt%d", mnt++);
+ label_chunk_info[i].c->private = new_part(foo, FALSE);
+ label_chunk_info[i].c->private_free = safe_free;
+ }
+ mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
+ newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
+ }
+ else if (label_chunk_info[i].type == PART_SWAP) {
+ mountpoint = "swap";
+ newfs = " ";
+ }
+ else if (label_chunk_info[i].type == PART_FAT) {
+ mountpoint = "DOS FAT";
+ newfs = "*";
+ }
+ else {
+ mountpoint = "<unknown>";
+ newfs = "*";
+ }
+ for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
+ onestr[PART_MOUNT_COL + j] = mountpoint[j];
+ snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ?
+ label_chunk_info[i].c->size / 2048 : 0);
+ memcpy(onestr + PART_SIZE_COL, num, strlen(num));
+ memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
+ onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
+ mvaddstr(prow, pcol, onestr);
+ ++prow;
+ }
+ if (i == here)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ mvprintw(17, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
+ mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
+ mvprintw(21, 0, "The default target will be displayed in ");
+
+ attrset(A_REVERSE);
+ addstr("reverse video.");
+ attrset(A_NORMAL);
+ mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ move(0, 0);
+}
+
+void
+diskLabelEditor(char *str)
+{
+ int sz, key = 0;
+ Boolean labeling;
+ char *msg = NULL;
+ PartInfo *p;
+ PartType type;
+
+ dialog_clear();
+ labeling = TRUE;
+ keypad(stdscr, TRUE);
+ record_label_chunks();
+
+ while (labeling) {
+ clear();
+ print_label_chunks();
+ print_command_summary();
+ if (msg) {
+ attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+
+ case KEY_UP:
+ case '-':
+ if (here != 0)
+ --here;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_HOME:
+ here = 0;
+ break;
+
+ case KEY_END:
+ while (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("disklabel.hlp");
+ break;
+
+ case 'C':
+ if (label_chunk_info[here].type != PART_SLICE) {
+ msg = "You can only do this in a master partition (see top of screen)";
+ break;
+ }
+ sz = space_free(label_chunk_info[here].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, *cp, tmp[20];
+ int size;
+
+ snprintf(tmp, 20, "%d", sz);
+ val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
+ if (val && (size = strtol(val, &cp, 0)) > 0) {
+ struct chunk *tmp;
+ u_long flags = 0;
+
+ if (*cp && toupper(*cp) == 'M')
+ size *= 2048;
+
+ type = get_partition_type();
+ if (type == PART_NONE)
+ break;
+ else if (type == PART_FILESYSTEM) {
+ if ((p = get_mountpoint(label_chunk_info[here].c, NULL)) == NULL)
+ break;
+ else if (!strcmp(p->mountpoint, "/"))
+ flags |= CHUNK_IS_ROOT;
+ else
+ flags &= ~CHUNK_IS_ROOT;
+ }
+ else
+ p = NULL;
+
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
+ label_chunk_info[here].c,
+ size, part,
+ (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
+ flags);
+ if (!tmp)
+ msgConfirm("Unable to create the partition. Too big?");
+ else {
+ tmp->private = p;
+ tmp->private_free = safe_free;
+ record_label_chunks();
+ }
+ }
+ }
+ break;
+
+ case 'D': /* delete */
+ if (label_chunk_info[here].type == PART_SLICE) {
+ msg = MSG_NOT_APPLICABLE;
+ break;
+ }
+ else if (label_chunk_info[here].type == PART_FAT) {
+ msg = "Use the Disk Partition Editor to delete this";
+ break;
+ }
+ Delete_Chunk(label_chunk_info[here].d, label_chunk_info[here].c);
+ record_label_chunks();
+ break;
+
+ case 'M': /* mount */
+ switch(label_chunk_info[here].type) {
+ case PART_SLICE:
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case PART_SWAP:
+ msg = "You don't need to specify a mountpoint for a swap partition.";
+ break;
+
+ case PART_DOS:
+ case PART_FILESYSTEM:
+ p = get_mountpoint(NULL, label_chunk_info[here].c);
+ if (p) {
+ p->newfs = FALSE;
+ record_label_chunks();
+ }
+ break;
+
+ default:
+ msgFatal("Bogus partition under cursor???");
+ break;
+ }
+ break;
+
+ case 'N': /* Set newfs options */
+ if (label_chunk_info[here].c->private &&
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs)
+ getNewfsCmd(label_chunk_info[here].c->private);
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'T': /* Toggle newfs state */
+ if (label_chunk_info[here].type == PART_FILESYSTEM &&
+ label_chunk_info[here].c->private)
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs =
+ !((PartInfo *)label_chunk_info[here].c->private)->newfs;
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'W':
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
+ int i;
+ Device **devs;
+
+ clear();
+ dialog_clear();
+ end_dialog();
+ DialogActive = FALSE;
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Can't find any disk devicse!");
+ break;
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++)
+ slice_wizard(((Disk *)devs[i]->private));
+ clear();
+ dialog_clear();
+ DialogActive = TRUE;
+ record_label_chunks();
+ }
+ else
+ msg = "A most prudent choice!";
+ break;
+
+ case 27: /* ESC */
+ labeling = FALSE;
+ break;
+
+ default:
+ beep();
+ msg = "Type F1 or ? for help";
+ break;
+ }
+ }
+ variable_set2(DISK_LABELLED, "yes");
+}
+
+
+
diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c
index c5b85cd..ce9ce46 100644
--- a/release/sysinstall/main.c
+++ b/release/sysinstall/main.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: main.c,v 1.4 1995/05/05 23:47:42 jkh Exp $
+ * $Id: main.c,v 1.5 1995/05/07 03:38:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,10 +63,12 @@ main(int argc, char **argv)
/* Default to English */
/* lang_set_English(NULL); */
+ /*
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
+ dialog_clear();
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? System will reboot."))
break;
}
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index 4e9b72a..1b360f5 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.2 1995/04/29 19:33:02 jkh Exp $
+ * $Id: media.c,v 1.3 1995/05/01 21:56:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,37 +42,56 @@
*/
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a CD.
*/
int
mediaSetCDROM(char *str)
{
+ if (OnCDROM == TRUE)
+ return 1;
+ else {
+ dmenuOpenSimple(&MenuMediaCDROM);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set(MEDIA_TYPE, "cdrom");
+ return 1;
+ }
+ }
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a floppy
*/
int
mediaSetFloppy(char *str)
{
+ dmenuOpenSimple(&MenuMediaFloppy);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set2(MEDIA_TYPE, "floppy");
+ return 1;
+ }
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a DOS partition.
*/
int
mediaSetDOS(char *str)
{
+ Device **devs;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs)
+ msgConfirm("No disk devices found!");
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a tape drive.
*/
int
@@ -88,6 +107,11 @@ mediaSetTape(char *str)
int
mediaSetFTP(char *str)
{
+ dmenuOpenSimple(&MenuMediaFtp);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set2(MEDIA_TYPE, "ftp");
+ return 1;
+ }
return 0;
}
@@ -100,3 +124,85 @@ mediaSetFS(char *str)
{
return 0;
}
+
+Boolean
+mediaGetType(void)
+{
+ extern DMenu MenuMedia;
+ char *cp;
+
+ dmenuOpenSimple(&MenuMedia);
+ cp = getenv(MEDIA_TYPE);
+ if (!cp)
+ return FALSE;
+ return TRUE;
+}
+
+FILE *
+mediaOpen(char *parent, *char *me)
+{
+ char fname[FILENAME_MAX];
+ FILE *fp;
+
+ if (!getenv(MEDIA_TYPE)) {
+ if (!mediaGetType())
+ return NULL;
+ }
+ if (!getenv(MEDIA_DEVICE)) {
+ msgConfirm("No media device has been set up!?\nPlease configure a device from the media type menu.");
+ return NULL;
+ }
+ if (parent)
+ snprintf(fname, FILENAME_MAX, "%s%s", parent, me);
+ else
+ strncpy(fname, me, FILENAME_MAX);
+ /* XXX find a Device here XXX */
+}
+
+/* Various media "get" routines */
+Boolean
+mediaUFSGet(char *dist)
+{
+ return TRUE;
+}
+
+Boolean
+mediaCDROMGet(char *dist)
+{
+ return TRUE;
+}
+
+Boolean
+mediaTapeInit(void)
+{
+ return TRUE;
+}
+
+Boolean
+mediaTapeGet(char *dist)
+{
+ return TRUE;
+}
+
+void
+mediaTapeClose(void)
+{
+}
+
+Boolean
+mediaNetworkInit(void)
+{
+ return TRUE;
+}
+
+Boolean
+mediaNetworkGet(char *dist)
+{
+ return TRUE;
+}
+
+void
+mediaNetworkClose(void)
+{
+}
+
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index 40093ee..f2da40b 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.11 1995/05/11 06:10:54 jkh Exp $
+ * $Id: menus.c,v 1.12 1995/05/11 06:47:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,7 +52,9 @@
/* Forward decls for submenus */
extern DMenu MenuDocumentation;
-extern DMenu MenuLanguage;
+extern DMenu MenuOptions;
+extern DMenu MenuOptionsLanguage;
+extern DMenu MenuOptionsFtp;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
@@ -62,7 +64,6 @@ extern DMenu MenuXF86SelectCore;
extern DMenu MenuXF86SelectServer;
extern DMenu MenuXF86SelectFonts;
extern DMenu MenuXF86;
-extern DMenu MenuInstallFtpOptions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -74,42 +75,42 @@ first character of the option name you're interested in. Invoke an\n\
option by pressing enter. If you'd like a shell, press ESC", /* prompt */
"Press F1 for usage instructions", /* help line */
"usage.hlp", /* help file */
-{ { "Usage", "Quick start - How to use this menu system.", /* U */
+ { { "Usage", "Quick start - How to use this menu system.", /* U */
DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0, 0 },
- { "Doc", "More detailed documentation on FreeBSD.", /* D */
+ { "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0, 0 },
- { "Lang", "Select natural language options.", /* L */
- DMENU_SUBMENU, (void *)&MenuLanguage, 0, 0 },
- { "Install", "Begin installation", /* I */
+ { "Options", "Select options for this utility.", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0 },
+ { "Install", "Begin installation", /* I */
DMENU_CALL, (void *)installCustom, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main documentation menu */
DMenu MenuDocumentation = {
-DMENU_NORMAL_TYPE,
-"Documentation for FreeBSD 2.0.5", /* Title */
-"If you are at all unsure about the configuration of your hardware\n\
+ DMENU_NORMAL_TYPE,
+ "Documentation for FreeBSD 2.0.5", /* Title */
+ "If you are at all unsure about the configuration of your hardware\n\
or are looking to build a system specifically for FreeBSD, read the\n\
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.",
-"Confused? Press F1 for help.",
-"usage.hlp", /* help file */
-{ { "README", "Read this for a general description of FreeBSD", /* R */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
+ { { "README", "Read this for a general description of FreeBSD", /* R */
DMENU_DISPLAY_FILE, (void *)"README", 0, 0 },
- { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
+ { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0, 0 },
- { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
+ { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
DMENU_DISPLAY_FILE, (void *)"install.hlp", 0, 0 },
- { "Copyright", "The FreeBSD Copyright notices.", /* C */
+ { "Copyright", "The FreeBSD Copyright notices.", /* C */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "Release", "The release notes for this version of FreeBSD.", /* R */
+ { "Release", "The release notes for this version of FreeBSD.", /* R */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
+ { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0, 0 },
- { NULL } },
+ { NULL } },
};
/*
@@ -119,451 +120,457 @@ answers in the FAQ.",
* name starts with `*', it's considered to be "ON" by default,
* otherwise off.
*/
-DMenu MenuLanguage = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Natural language selection", /* title */
-"Please specify the language you'd like to use by default.\n\n\
+DMenu MenuOptionsLanguage = {
+ DMENU_NORMAL_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 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. This feature is nonetheless considered\n\
to be in experimental status at this time.", /* prompt */
-"Press F1 for more information", /* help line */
-"language.hlp", /* help file */
-{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
+ "Press F1 for more information", /* help line */
+ "language.hlp", /* help file */
+ { { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Danish, 0, 0 },
- { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Dutch, 0, 0 },
- { "English", "English language (system default)", /* E */
+ { "English", "English language (system default)", /* E */
DMENU_CALL, (void *)lang_set_English, 0, 0 },
- { "French", "French language and character set (ISO-8859-1)", /* F */
+ { "French", "French language and character set (ISO-8859-1)", /* F */
DMENU_CALL, (void *)lang_set_French, 0, 0 },
- { "German", "German language and character set (ISO-8859-1)", /* G */
+ { "German", "German language and character set (ISO-8859-1)", /* G */
DMENU_CALL, (void *)lang_set_German, 0, 0 },
- { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
DMENU_CALL, (void *)lang_set_Italian, 0, 0 },
- { "Japanese", "Japanese language and default character set (romaji)",/* J */
+ { "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0, 0 },
- { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
DMENU_CALL, (void *)lang_set_Norwegian, 0, 0 },
- { "Russian", "Russian language and character set (cp866-8x14)", /* R */
+ { "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0, 0 },
- { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Spanish, 0, 0 },
- { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
+ { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Swedish, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaCDROM = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose a CDROM type",
-"FreeBSD can be installed directly from a CDROM containing a valid\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose a CDROM type",
+ "FreeBSD can be installed directly from a CDROM containing a valid\n\
FreeBSD 2.0.5 distribution. If you're seeing this menu, it's because\n\
your CDROM drive was not properly auto-detected, or you did not launch\n\
this installation from the CD under DOS or Windows. If you think you are\n
seeing this dialog in error, you may wish to reboot FreeBSD with the\n\
-c boot flag (.. boot: /kernel -c) and check that your hardware and\n\
the kernel agree on reasonable values.",
-"Press F1 for more information on CDROM support",
-"media_cdrom.hlp",
-{ { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
+ "Press F1 for more information on CDROM support",
+ "media_cdrom.hlp",
+ { { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/matcd0a", 0, 0 },
- { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
+ { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/mcd0a", 0, 0 },
- { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
+ { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/cd0a", 0, 0 },
- { "Sony", "Sony CDU31/33A or compatible CDROM drive",
+ { "Sony", "Sony CDU31/33A or compatible CDROM drive",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/scd0a", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaFTP = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Please specify an FTP site",
-"FreeBSD is distributed from a number of sites on the Internet.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Please specify an FTP site",
+ "FreeBSD is distributed from a number of sites on the Internet.\n\
Please select the site closest to you or \"other\" if you'd like\n\
to specify another choice. Also note that not all sites carry\n\
every possible distribution! Distributions other than the basic\n\
binary set are only guaranteed to be available from the Primary site.\n\
If the first site selected doesn't respond, try one of the alternates.",
-"Select a site that's close!",
-"media_ftp.hlp",
-{ { "Primary", "ftp.freebsd.org",
+ "Select a site that's close!",
+ "media_ftp.hlp",
+ { { "Primary", "ftp.freebsd.org",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.freebsd.org/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Secondary", "freefall.cdrom.com",
+ { "Secondary", "freefall.cdrom.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://freefall.cdrom.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Australia", "ftp.physics.usyd.edu.au",
+ { "Australia", "ftp.physics.usyd.edu.au",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.physics.usyd.edu.au/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Finland", "nic.funet.fi",
+ { "Finland", "nic.funet.fi",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://nic.funet.fi/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "France", "ftp.ibp.fr",
+ { "France", "ftp.ibp.fr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ibp.fr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Germany", "ftp.uni-duisburg.de",
+ { "Germany", "ftp.uni-duisburg.de",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.uni-duisburg.de/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Israel", "orgchem.weizmann.ac.il",
+ { "Israel", "orgchem.weizmann.ac.il",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://orgchem.weizmann.ac.il/pub/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan", "ftp.sra.co.jp",
+ { "Japan", "ftp.sra.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.sra.co.jp/pub/os/FreeBSD/distribution/2.0.5-ALPHA", 0, 0 },
- { "Japan-2", "ftp.mei.co.jp",
+ { "Japan-2", "ftp.mei.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-3", "ftp.waseda.ac.jp",
+ { "Japan-3", "ftp.waseda.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.waseda.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-4", "ftp.pu-toyama.ac.jp",
+ { "Japan-4", "ftp.pu-toyama.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-5", "ftpsv1.u-aizu.ac.jp",
+ { "Japan-5", "ftpsv1.u-aizu.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-6", "tutserver.tutcc.tut.ac.jp",
+ { "Japan-6", "tutserver.tutcc.tut.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://tutserver.tutcc.tut.ac.jp/FreeBSD/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan-7", "ftp.ee.uec.ac.jp",
+ { "Japan-7", "ftp.ee.uec.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Korea", "ftp.cau.ac.kr",
+ { "Korea", "ftp.cau.ac.kr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.cau.ac.kr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Netherlands", "ftp.nl.net",
+ { "Netherlands", "ftp.nl.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nl.net/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Russia", "ftp.kiae.su",
+ { "Russia", "ftp.kiae.su",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.kiae.su/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Sweden", "ftp.luth.se",
+ { "Sweden", "ftp.luth.se",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.luth.se/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Taiwan", "netbsd.csie.nctu.edu.tw",
+ { "Taiwan", "netbsd.csie.nctu.edu.tw",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Thailand", "ftp.nectec.or.th",
+ { "Thailand", "ftp.nectec.or.th",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nectec.or.th/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK", "ftp.demon.co.uk",
+ { "UK", "ftp.demon.co.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-2", "src.doc.ic.ac.uk",
+ { "UK-2", "src.doc.ic.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-3", "unix.hensa.ac.uk",
+ { "UK-3", "unix.hensa.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA", "ref.tfs.com",
+ { "USA", "ref.tfs.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ref.tfs.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-2", "ftp.dataplex.net",
+ { "USA-2", "ftp.dataplex.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.dataplex.net/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-3", "kryten.atinc.com",
+ { "USA-3", "kryten.atinc.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://kryten.atinc.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-4", "ftp.neosoft.com",
+ { "USA-4", "ftp.neosoft.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.neosoft.com/systems/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { NULL } }
+ { NULL } }
};
/* The media selection menu */
DMenu MenuMedia = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Media",
-"FreeBSD can be installed from a variety of different installation\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Media",
+ "FreeBSD can be installed from a variety of different installation\n\
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.",
-"Press F1 for more information on the various media types",
-"media.hlp",
-{ { "CDROM", "Install from a FreeBSD CDROM",
+ "Press F1 for more information on the various media types",
+ "media.hlp",
+ { { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0, 0 },
- { "Floppy", "Install from a floppy disk set",
+ { "Floppy", "Install from a floppy disk set",
DMENU_CALL, (void *)mediaSetFloppy, 0, 0 },
- { "DOS", "Install from a DOS partition",
+ { "DOS", "Install from a DOS partition",
DMENU_CALL, (void *)mediaSetDOS, 0, 0 },
- { "Tape", "Install from SCSI or QIC tape",
+ { "Tape", "Install from SCSI or QIC tape",
DMENU_CALL, (void *)mediaSetTape, 0, 0 },
- { "FTP", "Install from an Internet FTP server",
+ { "FTP", "Install from an Internet FTP server",
DMENU_CALL, (void *)mediaSetFTP, 0, 0 },
- { "File System", "Install from a UFS or NFS mounted distribution",
+ { "File System", "Install from a UFS or NFS mounted distribution",
DMENU_CALL, (void *)mediaSetFS, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The installation type menu */
DMenu MenuInstallType = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Type",
-"As a convenience, we provide several `canned' installation types.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Type",
+ "As a convenience, we provide several `canned' installation types.\n\
These pick what we consider to be the most reasonable defaults for the\n\
type of system in question. If you would prefer to pick and choose\n\
the list of distributions yourself, simply select `custom'.",
-"Press F1 for more information on the various distributions",
-"dist_types.hlp",
-{ { "Developer", "Includes full sources, binaries and doc but no games.",
+ "Press F1 for more information on the various distributions",
+ "dist_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
DMENU_CALL, (void *)distSetDeveloper, 0, 0 },
- { "X-Developer", "Same as above, but includes XFree86.",
+ { "X-Developer", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXDeveloper, 0, 0 },
- { "User", "General user. Binaries and doc but no sources.",
+ { "User", "General user. Binaries and doc but no sources.",
DMENU_CALL, (void *)distSetUser, 0, 0 },
- { "X-User", "Same as above, but includes XFree86.",
+ { "X-User", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXUser, 0, 0 },
- { "Minimal", "The smallest configuration possible.",
+ { "Minimal", "The smallest configuration possible.",
DMENU_CALL, (void *)distSetMinimum, 0, 0 },
- { "Everything", "The entire source and binary distribution.",
+ { "Everything", "The entire source and binary distribution.",
DMENU_CALL, (void *)distSetEverything, 0, 0 },
- { "Custom", "Specify your own distribution set",
+ { "Custom", "Specify your own distribution set",
DMENU_SUBMENU, (void *)&MenuDistributions, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"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_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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_SET_FLAG, (void *)&Dists, DIST_BIN, 0 },
- { "commercial", "Commercial demos and shareware",
+ { "commercial", "Commercial demos and shareware",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMMERCIAL, 0 },
- { "compat1x", "FreeBSD 1.x binary compatability package",
+ { "compat1x", "FreeBSD 1.x binary compatability package",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMPAT1X, 0 },
- { "DES", "DES encryption code and sources",
+ { "DES", "DES encryption code and sources",
DMENU_SET_FLAG, (void *)&Dists, DIST_DES, 0 },
- { "dict", "Spelling checker disctionary files",
+ { "dict", "Spelling checker disctionary files",
DMENU_SET_FLAG, (void *)&Dists, DIST_DICT, 0 },
- { "games", "Games and other amusements (non-commercial)",
+ { "games", "Games and other amusements (non-commercial)",
DMENU_SET_FLAG, (void *)&Dists, DIST_GAMES, 0 },
- { "info", "GNU info files",
+ { "info", "GNU info files",
DMENU_SET_FLAG, (void *)&Dists, DIST_INFO, 0 },
- { "*man", "System manual pages - strongly recommended",
+ { "*man", "System manual pages - strongly recommended",
DMENU_SET_FLAG, (void *)&Dists, DIST_MANPAGES, 0 },
- { "proflibs", "Profiled versions of the libraries",
+ { "proflibs", "Profiled versions of the libraries",
DMENU_SET_FLAG, (void *)&Dists, DIST_PROFLIBS, 0 },
- { "src", "Sources for everything but DES",
+ { "src", "Sources for everything but DES",
DMENU_CALL, (void *)distSetSrc, 0 },
- { "XFree86", "The XFree86 3.1.1L distribution",
+ { "XFree86", "The XFree86 3.1.1L distribution",
DMENU_SUBMENU, (void *)&MenuXF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuSrcDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select the sub-components of src you wish to install.",
-"Please check off those portions of the FreeBSD source tree\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Select the sub-components of src you wish to install.",
+ "Please check off those portions of the FreeBSD source tree\n\
you wish to install. A brief description of each source\n\
hierarchy is contained in parenthesis below.",
-"Press F1 for a more complete description of distributions.",
-"distribution_types.hlp",
-{ { "base", "Base src directory (top-level files in /usr/src)",
+ "Press F1 for a more complete description of distributions.",
+ "distribution_types.hlp",
+ { { "base", "Base src directory (top-level files in /usr/src)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_BASE, 0 },
- { "gnu", "/usr/src/gnu (user software from the GNU Project)",
+ { "gnu", "/usr/src/gnu (user software from the GNU Project)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GNU, 0 },
- { "etc", "/usr/src/etc (miscellaneous system files)",
+ { "etc", "/usr/src/etc (miscellaneous system files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_ETC, 0 },
- { "games", "/usr/src/games (games)",
+ { "games", "/usr/src/games (games)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GAMES, 0 },
- { "include", "/usr/src/include (header files)",
+ { "include", "/usr/src/include (header files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_INCLUDE, 0 },
- { "lib", "/usr/src/lib (system libraries)",
+ { "lib", "/usr/src/lib (system libraries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIB, 0 },
- { "libexec", "/usr/src/libexec (various system programs)",
+ { "libexec", "/usr/src/libexec (various system programs)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIBEXEC, 0 },
- { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
+ { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LKM, 0 },
- { "release", "/usr/src/release (release-generation tools)",
+ { "release", "/usr/src/release (release-generation tools)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_RELEASE, 0 },
- { "sbin", "/usr/src/sbin (system binaries)",
+ { "sbin", "/usr/src/sbin (system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SBIN, 0 },
- { "share", "/usr/src/share (documents and shared files)",
+ { "share", "/usr/src/share (documents and shared files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SHARE, 0 },
- { "sys", "/usr/src/sys (FreeBSD kernel)",
+ { "sys", "/usr/src/sys (FreeBSD kernel)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SYS, 0 },
- { "ubin", "/usr/src/usr.bin (user binaries)",
+ { "ubin", "/usr/src/usr.bin (user binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_UBIN, 0 },
- { "usbin", "/usr/src/usr.sbin (aux system binaries)",
+ { "usbin", "/usr/src/usr.sbin (aux system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_USBIN, 0 },
- { "XFree86", "XFree86 3.1.1L source + contrib distribution",
+ { "XFree86", "XFree86 3.1.1L source + contrib distribution",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_XF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86 = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
Project, Inc. Our recommended sequence is to Select the desired\n\
release components, Configure XFree86 and then (optionally)\n\
Start it up!",
-"Press F1 to read the XFree86 release notes for FreeBSD",
-"XFree86.hlp",
-{ { "Select", "Select and load components of the XFree86 distribution",
+ "Press F1 to read the XFree86 release notes for FreeBSD",
+ "XFree86.hlp",
+ { { "Select", "Select and load components of the XFree86 distribution",
DMENU_SUBMENU, &MenuXF86Select, 0, 0 },
- { "Configure", "Configure an installed XFree86 distribution",
+ { "Configure", "Configure an installed XFree86 distribution",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config",
0, 0 },
- { "Start", "Try to start the server up",
+ { "Start", "Try to start the server up",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin startx",
0, 0 },
- { NULL } }
+ { NULL } }
};
DMenu MenuXF86Select = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Please select the components you need from the XFree86 3.1.1u1\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Please select the components you need from the XFree86 3.1.1u1\n\
distribution. Select what you need from the basic components set\n\
and at least one entry from the Server menu and the Font set menu\n",
-"Press F1 for a sample sequence",
-"XF86Select.hlp",
-{ { "Core", "Basic component menu (required)",
+ "Press F1 for a sample sequence",
+ "XF86Select.hlp",
+ { { "Core", "Basic component menu (required)",
DMENU_SUBMENU, &MenuXF86SelectCore, 0, 0 },
- { "Server", "X server menu",
+ { "Server", "X server menu",
DMENU_SUBMENU, &MenuXF86SelectServer, 0, 0 },
- { "Fonts", "Font set menu",
+ { "Fonts", "Font set menu",
DMENU_SUBMENU, &MenuXF86SelectFonts, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectCore = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"XFree86 3.1.1 base distribution types",
-"Please check off the basic XFree86 components you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "XFree86 3.1.1 base distribution types",
+ "Please check off the basic XFree86 components you wish to install.\n\
Those deemed most generally useful are already checked off for you.",
-NULL,
-NULL,
-{ { "*bin", "X client applications and shared libs [4MB].",
+ NULL,
+ NULL,
+ { { "*bin", "X client applications and shared libs [4MB].",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_BIN, 0 },
- { "*lib", "Data files needed at runtime [0.6MB]",
+ { "*lib", "Data files needed at runtime [0.6MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LIB, 0 },
- { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
+ { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XINIT, 0 },
- { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
+ { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XDMCF, 0 },
- { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
+ { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_DOC, 0 },
- { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
+ { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_MAN, 0 },
- { "prog", "Programmer's header and library files [4MB]",
+ { "prog", "Programmer's header and library files [4MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PROG, 0 },
- { "link", "X Server reconfiguration kit [7.8MB]",
+ { "link", "X Server reconfiguration kit [7.8MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LINK, 0 },
- { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
+ { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PEX, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectFonts = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Font distribution selection.",
-"Please check off the individual font distributions you wish to\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Font distribution selection.",
+ "Please check off the individual font distributions you wish to\n\
install. At the minimum, you should certainly install the standard\n\
75 DPI and misc fonts if you're also installing a server.",
-NULL,
-NULL,
-{ { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
+ NULL,
+ NULL,
+ { { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_MISC, 0 },
- { "f100", "100 DPI fonts [1.8MB]",
+ { "f100", "100 DPI fonts [1.8MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_100, 0 },
- { "fscl", "Speedo and Type scalable fonts [1.6MB]",
+ { "fscl", "Speedo and Type scalable fonts [1.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SCALE, 0 },
- { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
+ { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_NON, 0 },
- { "server", "Font server [0.3MB]",
+ { "server", "Font server [0.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SERVER, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectServer = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"X Server selection.",
-"Please check off the types of X servers you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "X Server selection.",
+ "Please check off the types of X servers you wish to install.\n\
If you are unsure as which server will work for your graphics card,\n\
it is recommended that try the SVGA or VGA16 servers (the VGA16 and\n\
Mono servers are also particularly well-suited to most LCD displays).",
-"xservers.hlp",
-"Press F1 for more information on the various X server types",
-{ { "*SVGA", "Standard VGA or Super VGA display",
+ "xservers.hlp",
+ "Press F1 for more information on the various X server types",
+ { { "*SVGA", "Standard VGA or Super VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_SVGA, 0 },
- { "VGA16", "Standard 16 color VGA display",
+ { "VGA16", "Standard 16 color VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_VGA16, 0 },
- { "Mono", "Standard Monochrome display",
+ { "Mono", "Standard Monochrome display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MONO, 0 },
- { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
+ { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_8514, 0 },
- { "AGX", "8-bit AGX card",
+ { "AGX", "8-bit AGX card",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_AGX, 0 },
- { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
+ { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH32, 0 },
- { "Mch8", "8-bit ATI Mach8 card.",
+ { "Mch8", "8-bit ATI Mach8 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH8, 0 },
- { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
+ { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_P9000, 0 },
- { "S3", "8, 16 and 24-bit color for S3 based boards",
+ { "S3", "8, 16 and 24-bit color for S3 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_S3, 0 },
- { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
+ { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_W32, 0 },
- { "nest", "A nested server for testing purposes",
+ { "nest", "A nested server for testing purposes",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_NEST, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDiskDevices = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select Drive(s)",
-"Please select the drive, or drives, on which you wish to install\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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', or have multiple operating\n\
systems on your machine, you will have the option to install a boot\n\
manager later.",
-"Press F1 for more information on what you see here.",
-"drives.hlp",
-{ { NULL } },
+ "Press F1 for more information on what you see here.",
+ "drives.hlp",
+ { { NULL } },
};
/* The installation options menu */
-DMenu MenuInstallOptions = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options",
-"This menu controls how the FreeBSD installation will deal with various\n\
+DMenu MenuOptions = {
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options",
+ "This menu controls how the FreeBSD installation will deal with various\n\
error conditions, should they arise, and the degree to which you, the\n\
user, will be prompted for options.",
-NULL,
-NULL,
-{ { "Ftp Options", "Ftp options menu",
- DMENU_SUBMENU, (void *)&MenuInstallFtpOptions, 0, 0 },
- { "NFS Secure", "NFS server talks only on a secure port",
+ NULL,
+ NULL,
+ { { "Ftp Options", "Ftp options menu",
+ DMENU_SUBMENU, (void *)&MenuOptionsFtp, 0, 0 },
+ { "Language", "Select your preferred language",
+ DMENU_SUBMENU, (void *)&MenuOptionsLanguage, 0, 0 }
+ { "NFS Secure", "NFS server talks only on a secure port",
DMENU_SET_VARIABLE, (void *)"nfsServerSecure=yes", 0, 0 },
- { "NFS Slow", "User is using a slow PC or ethernet card",
+ { "NFS Slow", "User is using a slow PC or ethernet card",
DMENU_SET_VARIABLE, (void *)"nfsSlowPC=yes", 0, 0 },
- { "Extra Debugging", "Toggle the extra debugging flag",
+ { "Extra Debugging", "Toggle the extra debugging flag",
DMENU_SET_VARIABLE, (void *)"debug=yes", 0, 0 },
- { "No Debugging", "Turn the extra debugging flag off",
+ { "No Debugging", "Turn the extra debugging flag off",
DMENU_SET_VARIABLE, (void *)"debug=no", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuInstallFtpOptions = {
-DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Ftp Options",
-"In case of ftp failure, how would you like this installation\n\
+ DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Ftp Options",
+ "In case of ftp failure, how would you like this installation\n\
to deal with it? You have one of several choices:",
-NULL,
-NULL,
-{ { "*Ftp Retry", "On transfer failure, retry same host",
+ NULL,
+ NULL,
+ { { "*Ftp Retry", "On transfer failure, retry same host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=loop", 0, 0 },
- { "Ftp Reselect", "On transfer failure, ask for another host",
+ { "Ftp Reselect", "On transfer failure, ask for another host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=reselect", 0, 0 },
- { "Ftp Abort", "On transfer failure, abort installation",
+ { "Ftp Abort", "On transfer failure, abort installation",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=abort", 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main installation menu */
DMenu MenuInstall = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options", /* title */
-"Before installation can continue, you need to specify a few items\n\
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options", /* title */
+ "Before installation can continue, you need to specify a few items\n\
of information regarding the type of distribution you wish to have\n\
and from where you wish to install it. There are also a number\n\
of options you can specify in the Options menu which will determine\n\
-how . If you do not wish to install FreeBSD at this time, you may\n\
+how. You may choose install FreeBSD at this time, you may\n\
select Cancel to leave this menu.",
-"You may also wish to read the install guide - press F1 to do so",
-"install.hlp",
-{ { "Media", "Choose Installation media type", /* M */
- DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
- { "Type", "Choose the type of installation you want", /* T */
+ "You may also wish to read the install guide - press F1 to do so",
+ "install.hlp",
+ { { "Distributions", "Choose the type of installation you want", /* T */
DMENU_SUBMENU, (void *)&MenuInstallType, 0, 0 },
- { "Options", "Specify installation options", /* O */
- DMENU_SUBMENU, (void *)&MenuInstallOptions, 0, 0},
- { "Proceed", "Proceed with installation", /* P */
+ { "Media", "Choose the installation media type", /* M */
+ DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
+ { "Partition", "Go to the Disk Partition Editor", /* P */
+ DMENU_CALL, (void *)diskPartitionEditor, 0, 0 },
+ { "Label", "Label the contents of disk partitions", /* L */
+ DMENU_CALL, (void *)diskLabelEditor, 0, 0 },
+ { "GO!", "Start the whole show and go out for coffee!", /* P */
DMENU_CANCEL, (void *)NULL, 0, 0 },
- { NULL } },
+ { "Options", "Set special installation options", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0},
+ { NULL } },
};
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index f71ea32..73579e3 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.14 1995/05/08 21:39:40 jkh Exp $
+ * $Id: sysinstall.h,v 1.15 1995/05/10 07:45:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,11 +66,33 @@
#define VAR_VALUE_MAX 1024
/* device limits */
-#define DEV_NAME_MAX 128
+#define DEV_NAME_MAX 128 /* The maximum length of a device name */
+#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
+#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
+
+
+/* Internal flag variables */
+#define DISK_PARTITIONED "_diskPartitioned"
+#define DISK_LABELLED "_diskLabelled"
+#define TCP_CONFIGURED "_tcpConfigured"
+#define NO_CONFIRMATION "_noConfirmation"
+#define MEDIA_DEVICE "mediaDevice"
+#define MEDIA_TYPE "mediaType"
+
+#define VAR_HOSTNAME "hostname"
+#define VAR_DOMAINNAME "domainname"
+#define VAR_IPADDR "ip_addr"
+#define VAR_NAMESERVER "nameserver"
+
+#define VAR_IFCONFIG_ARGS "if_flags"
+#define VAR_NETMASK "netmask"
+#define VAR_GATEWAY "gateway"
/*** Types ***/
typedef unsigned int Boolean;
+typedef struct disk Disk;
+typedef struct chunk Chunk;
typedef enum {
DMENU_SHELL_ESCAPE, /* Fork a shell */
@@ -117,8 +139,6 @@ typedef enum {
DEVICE_TYPE_NETWORK,
DEVICE_TYPE_CDROM,
DEVICE_TYPE_TAPE,
- DEVICE_TYPE_SERIAL,
- DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
@@ -126,6 +146,11 @@ typedef enum {
typedef struct _device {
char name[DEV_NAME_MAX];
DeviceType type;
+ Boolean enabled;
+ int (*deviceInit)(void);
+ int (*deviceGet)(char *fname);
+ int (*deviceClose)(void);
+ void *devicePrivate;
} Device;
/* Some internal representations of partitions */
@@ -133,7 +158,8 @@ typedef enum {
PART_NONE,
PART_SLICE,
PART_SWAP,
- PART_FILESYSTEM
+ PART_FILESYSTEM,
+ PART_FAT,
} PartType;
/* The longest newfs command we'll hand to system() */
@@ -145,6 +171,8 @@ typedef struct _part_info {
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;
+typedef int (*commandFunc)(char *key, void *data);
+
/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
@@ -161,7 +189,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists;/* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
-extern struct disk *Disks[]; /* The disks we're working on */
+extern Device *Devices[]; /* The devices we have to work with */
/*** Prototypes ***/
@@ -169,7 +197,8 @@ extern struct disk *Disks[]; /* The disks we're working on */
extern void command_clear(void);
extern void command_sort(void);
extern void command_execute(void);
-extern void command_add(char *key, char *fmt, ...);
+extern void command_shell_add(char *key, char *fmt, ...);
+extern void command_func_add(char *key, commandFunc func, void *data);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
@@ -177,17 +206,11 @@ extern Boolean dispatch(DMenuItem *tmp, char *name);
extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
/* devices.c */
-extern struct disk *device_slice_disk(struct disk *d);
-extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)());
+extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
+extern Device *deviceGetInfo(DeviceType which);
/* disks.c */
-extern void partition_disks(void);
-extern int write_disks(void);
-extern void make_filesystems(void);
-extern void cpio_extract(void);
-extern void extract_dists(void);
-extern void install_configuration_files(void);
-extern void do_final_setup(void);
+extern int diskPartitionEditor(Disk *disk);
/* dist.c */
extern int distSetDeveloper(char *str);
@@ -202,6 +225,7 @@ extern void distExtractAll(void);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
int *curr, int *max);
+extern void dmenuOpenSimple(DMenu *menu);
/* globals.c */
extern void globalsInit(void);
@@ -224,6 +248,9 @@ extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* label.c */
+extern void diskLabelEditor(char *str);
+
/* makedevs.c (auto-generated) */
extern const char termcap_vt100[];
extern const char termcap_cons25[];
@@ -294,7 +321,7 @@ extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
/* wizard.c */
-extern void slice_wizard(struct disk *d);
+extern void slice_wizard(Disk *d);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c
new file mode 100644
index 0000000..0c8ab34
--- /dev/null
+++ b/release/sysinstall/tcpip.c
@@ -0,0 +1,326 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 1995
+ * Gary J Palmer. 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 Gary J Palmer
+ * for the FreeBSD Project.
+ * 4. The name of Gary J Palmer 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 GARY J PALMER ``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 GARY J PALMER 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <string.h>
+#include <dialog.h>
+#include "ui_objects.h"
+#include "dir.h"
+#include "dialog.priv.h"
+#include "colors.h"
+#include "rc.h"
+
+static char hostname[256], domainname[256],
+ ipaddr[32], netmask[32], gateway[32],
+ dns[32], extras[256];
+static int okbutton, cancelbutton;
+
+#define TCP_DIALOG_Y 0
+#define TCP_DIALOG_X 8
+#define TCP_DIALOG_WIDTH COLS - 16
+#define TCP_DIALOG_HEIGHT LINES - 2
+
+/* The names of the available interfaces, for the list */
+char *iface_names[MAX_INTERFACE];
+
+typedef struct _interface {
+ char *name;
+ Device *dev;
+} Interface;
+
+typedef struct _layout {
+ int y;
+ int x;
+ int len;
+ int maxlen;
+ char *prompt;
+ char *help;
+ void *var;
+ int type;
+ void *obj;
+} Layout;
+
+static Layout layout[] = {
+{ 2, 2, 25, 255,
+ "Host name:", "The name of your machine on a network, e.g. foo.bar.com",
+ hostname, STRINGOBJ, NULL },
+{ 2, 35, 20, 255,
+ "Domain name:",
+ "The name of the domain that your machine is in, e.g. bar.com",
+ domainname, STRINGOBJ, NULL },
+{ 5, 2, 18, 15,
+ "Gateway:",
+ "IP address of host forwarding packets to non-local hosts or nets",
+ gateway, STRINGOBJ, NULL },
+{ 5, 35, 18, 15,
+ "Name server:", "IP address of your local DNS server",
+ dns, STRINGOBJ, NULL },
+{ 8, 2, 10, 6,
+ "Interface:", "One of potentially several network interfaces",
+ ifaces, LISTOBJ, NULL },
+{ 14, 2, 18, 15,
+ "IP Address:",
+ "The IP address to be used for your host - use 127.0.0.1 for loopback",
+ ipaddr, STRINGOBJ, NULL },
+{ 14, 35, 18, 15,
+ "Netmask:",
+ "The netmask for your network, e.g. 0xffffff00 for a class C network",
+ netmask, STRINGOBJ, NULL },
+{ 16, 2, 50, 255,
+ "Extra options:",
+ "Any options to ifconfig you'd like to specify manually",
+ extras, STRINGOBJ, NULL },
+{ 18, 2, 0, 0,
+ "OK", "Select this if you are happy with these settings",
+ &okbutton, BUTTONOBJ, NULL },
+{ 18, 15, 0, 0,
+ "CANCEL", "Select this if you wish to cancel this screen",
+ &cancelbutton, BUTTONOBJ, NULL },
+{ NULL },
+};
+
+#define _validByte(b) ((b) > 0 && (b) < 255)
+
+static void
+feepout(char *msg)
+{
+ beep();
+ msgConfirm(msg);
+ dialog_clear();
+ refresh();
+}
+
+static int
+verifyIP(char *ip)
+{
+ int a, b, c, d;
+
+ if (ip && sscanf(ip, "%d.%d.%d.%d", &a, &b, &c, &d) == 4 &&
+ _validByte(a) && _validByte(b) && _validByte(c) &&
+ _validByte(d))
+ return 1;
+ else
+ return 0;
+}
+
+static int
+verifySettings(void)
+{
+ if (!hostname[0])
+ feepout("Must specify a host name of some sort!");
+ else if (!verifyIP(ipaddr))
+ feepout("Invalid or missing value for IP address");
+ else if (gateway[0] && !verifyIP(gateway))
+ feepout("Invalid gateway IP address specified");
+ else if (dns[0] && !verifyIP(dns))
+ feepout("Invalid name server IP address specified");
+ else if (netmask[0] < '0' || netmask[0] > '9')
+ feepout("Invalid or missing netmask");
+ else
+ return 1;
+ return 0;
+}
+
+/* Call this to initialize the TCP dialog */
+void
+/* This is it - how to get TCP setup values */
+void
+tcpOpenDialog(void)
+{
+ WINDOW *ds_win;
+ ComposeObj *obj = NULL;
+ ComposeObj *first, *last;
+ int n=0, quit=FALSE, cancel=FALSE, ret,
+ max;
+ char *tmp;
+
+ ds_win = newwin(LINES, COLS, 0, 0);
+ if (ds_win == 0) {
+ msgFatal("Cannot open TCP/IP dialog window!!");
+ exit(1);
+ }
+ draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X,
+ TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH,
+ dialog_attr, border_attr);
+ wattrset(ds_win, dialog_attr);
+ mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20,
+ " Network Configuration ");
+
+ bzero(ipaddr, sizeof(ipaddr));
+ bzero(netmask, sizeof(netmask));
+ bzero(extras, sizeof(extras));
+
+ tmp = getenv(VAR_HOSTNAME);
+ if (tmp)
+ strcpy(hostname, tmp);
+ else
+ bzero(hostname, sizeof(hostname));
+ tmp = getenv(VAR_DOMAINNAME);
+ if (tmp)
+ strcpy(domainname, tmp);
+ else
+ bzero(domainname, sizeof(domainname));
+ tmp = getenv(VAR_GATEWAY);
+ if (tmp)
+ strcpy(gateway, tmp);
+ else
+ bzero(gateway, sizeof(gateway));
+ tmp = getenv(VAR_NAMESERVER);
+ if (tmp)
+ strcpy(dns, tmp);
+ else
+ bzero(dns, sizeof(dns));
+
+#define lt layout[n]
+ while (lt.help != NULL) {
+ switch (lt.type) {
+ case STRINGOBJ:
+ lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
+ lt.len, lt.maxlen);
+ break;
+
+ case BUTTONOBJ:
+ lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
+ break;
+
+ case LISTOBJ:
+ lt.obj = NewListObj(ds_win, lt.prompt, lt.var, "lo0",
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
+ 4, 12, 1);
+ default:
+ printf("Don't support this object yet!\n");
+ end_dialog();
+ exit(1);
+ }
+ AddObj(&obj, lt.type, (void *) lt.obj);
+ n++;
+ }
+ max = n-1;
+
+ last = obj;
+ while (last->next)
+ last = last->next;
+
+ /* find the first object in the list */
+ first = obj;
+ while (first->prev)
+ first = first->prev;
+
+ n = 0;
+ while (quit != TRUE) {
+ char help_line[80];
+ int i, len = strlen(lt.help);
+
+ for (i = 0; i < 79; i++)
+ help_line[i] = (i < len) ? lt.help[i] : ' ';
+ help_line[i] = '\0';
+ use_helpline(help_line);
+ display_helpline(ds_win, LINES - 1, COLS - 1);
+
+ ret = PollObj(&obj);
+
+ switch (ret) {
+ case SEL_ESC:
+ quit=TRUE;
+ cancel=TRUE;
+ break;
+
+ case KEY_UP:
+ if (obj->prev !=NULL ) {
+ obj = obj->prev;
+ --n;
+ }
+ else {
+ obj = last;
+ n = max;
+ }
+ break;
+
+ case KEY_DOWN:
+ if (obj->next != NULL) {
+ obj = obj->next;
+ ++n;
+ }
+ else {
+ obj = first;
+ n=0;
+ }
+ break;
+
+ case SEL_BUTTON:
+ if (verifySettings())
+ quit=TRUE;
+ break;
+
+ case SEL_CR:
+ case SEL_TAB:
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
+
+ case SEL_BACKTAB:
+ if (n)
+ --n;
+ else
+ n = max;
+ break;
+
+ default:
+ beep();
+ }
+
+ if (n == 1) {
+ if ((tmp = index(hostname, '.')) != NULL) {
+ strncpy(domainname, tmp + 1, strlen(tmp + 1));
+ RefreshStringObj(layout[1].obj);
+ }
+ }
+ }
+ if (!cancel) {
+ variable_set2("hostname", hostname);
+ variable_set2("domainname", domainname);
+ variable_set2("ip_addr", ipaddr);
+ variable_set2("ip_gateway", gateway);
+}
diff --git a/release/sysinstall/wizard.c b/release/sysinstall/wizard.c
index 88fd33b..dda8b57 100644
--- a/release/sysinstall/wizard.c
+++ b/release/sysinstall/wizard.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: tst01.c,v 1.8 1995/05/01 04:05:26 phk Exp $
+ * $Id: wizard.c,v 1.1 1995/05/04 23:36:23 jkh Exp $
*
*/
@@ -20,246 +20,246 @@
#include "libdisk.h"
u_char mbr[] = {
-250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
-242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
-131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
-203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
-205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
-51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
-85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
-114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
-108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
-121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
-116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
-1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
-208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,85,170
+ 250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
+ 242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
+ 131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
+ 203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
+ 205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
+ 51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
+ 85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
+ 114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
+ 108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
+ 121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
+ 116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
+ 1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
+ 208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,85,170
};
u_char bteasy17[] = {
-51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
-165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
-4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
-232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
-85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
-179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
-60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
-10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
-7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
-42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
-0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
-243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
-36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
-50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
-160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
-160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
-36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
-211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
-76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
-216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,85,170
+ 51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
+ 165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
+ 4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
+ 232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
+ 85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
+ 179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
+ 60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
+ 10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
+ 7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
+ 42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
+ 0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
+ 243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
+ 36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
+ 50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
+ 160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
+ 160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
+ 36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
+ 211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
+ 76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
+ 216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,85,170
};
int
scan_block(int fd, daddr_t block)
{
- u_char foo[512];
+ u_char foo[512];
- if (-1 == lseek(fd,block * 512,SEEK_SET))
- err(1,"lseek");
- if (512 != read(fd,foo, 512))
- return 1;
- return 0;
+ if (-1 == lseek(fd,block * 512,SEEK_SET))
+ err(1,"lseek");
+ if (512 != read(fd,foo, 512))
+ return 1;
+ return 0;
}
void
Scan_Disk(struct disk *d)
{
- char device[64];
- u_long l;
- int i,j,fd;
-
- strcpy(device,"/dev/r");
- strcat(device,d->name);
-
- fd = open(device,O_RDWR);
- if (fd < 0) {
- warn("open(%s) failed",device);
- return;
- }
- for(i=-1,l=0;;l++) {
- j = scan_block(fd,l);
- if (j != i) {
- if (i == -1) {
- printf("%c: %lu.",j ? 'B' : 'G', l);
- fflush(stdout);
- } else if (i == 0) {
- printf(".%lu\nB: %lu.",l-1,l);
- fflush(stdout);
- } else {
- printf(".%lu\nG: %lu.",l-1,l);
- fflush(stdout);
- }
- i = j;
- }
- }
- close(fd);
+ char device[64];
+ u_long l;
+ int i,j,fd;
+
+ strcpy(device,"/dev/r");
+ strcat(device,d->name);
+
+ fd = open(device,O_RDWR);
+ if (fd < 0) {
+ msgWarn("open(%s) failed", device);
+ return;
+ }
+ for(i=-1,l=0;;l++) {
+ j = scan_block(fd,l);
+ if (j != i) {
+ if (i == -1) {
+ printf("%c: %lu.",j ? 'B' : 'G', l);
+ fflush(stdout);
+ } else if (i == 0) {
+ printf(".%lu\nB: %lu.",l-1,l);
+ fflush(stdout);
+ } else {
+ printf(".%lu\nG: %lu.",l-1,l);
+ fflush(stdout);
+ }
+ i = j;
+ }
+ }
+ close(fd);
}
void
slice_wizard(struct disk *d)
{
- struct disk *db;
- char myprompt[BUFSIZ];
- char input[BUFSIZ];
- char *p,*q=0;
- char **cp,*cmds[200];
- int ncmd,i;
-
- sprintf(myprompt,"%s> ", d->name);
- while(1) {
- printf("--==##==--\n");
- Debug_Disk(d);
- p = CheckRules(d);
- if (p) {
- printf("%s",p);
- free(p);
- }
- printf(myprompt);
- fflush(stdout);
- q = p = fgets(input,sizeof(input),stdin);
- if(!p)
- break;
- for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
- if (**cp != '\0')
- cp++;
- ncmd = cp - cmds;
- if(!ncmd)
- continue;
- if (!strcasecmp(*cmds,"quit")) { break; }
- if (!strcasecmp(*cmds,"exit")) { break; }
- if (!strcasecmp(*cmds,"q")) { break; }
- if (!strcasecmp(*cmds,"x")) { break; }
- if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
- printf("delete = %d\n",
- Delete_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"allfreebsd")) {
- All_FreeBSD(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
- Set_Bios_Geom(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
- d = Set_Phys_Geom(d,
+ struct disk *db;
+ char myprompt[BUFSIZ];
+ char input[BUFSIZ];
+ char *p,*q=0;
+ char **cp,*cmds[200];
+ int ncmd,i;
+
+ sprintf(myprompt,"%s> ", d->name);
+ while(1) {
+ printf("--==##==--\n");
+ Debug_Disk(d);
+ p = CheckRules(d);
+ if (p) {
+ printf("%s",p);
+ free(p);
+ }
+ printf(myprompt);
+ fflush(stdout);
+ q = p = fgets(input,sizeof(input),stdin);
+ if(!p)
+ break;
+ for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
+ if (**cp != '\0')
+ cp++;
+ ncmd = cp - cmds;
+ if(!ncmd)
+ continue;
+ if (!strcasecmp(*cmds,"quit")) { break; }
+ if (!strcasecmp(*cmds,"exit")) { break; }
+ if (!strcasecmp(*cmds,"q")) { break; }
+ if (!strcasecmp(*cmds,"x")) { break; }
+ if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
+ printf("delete = %d\n",
+ Delete_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"allfreebsd")) {
+ All_FreeBSD(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
+ Set_Bios_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
+ d = Set_Phys_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"collapse")) {
+ if (cmds[1])
+ while (Collapse_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)))
+ ;
+ else
+ Collapse_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"list")) {
+ cp = Disk_Names();
+ printf("Disks:");
+ for(i=0;cp[i];i++) {
+ printf(" %s",cp[i]);
+ free(cp[i]);
+ }
+ free(cp);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"create") && ncmd == 6) {
+
+ printf("Create=%d\n",
+ Create_Chunk(d,
strtol(cmds[1],0,0),
strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"collapse")) {
- if (cmds[1])
- while (Collapse_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)))
- ;
- else
- Collapse_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"list")) {
- cp = Disk_Names();
- printf("Disks:");
- for(i=0;cp[i];i++) {
- printf(" %s",cp[i]);
- free(cp[i]);
- }
- free(cp);
- continue;
- }
- if (!strcasecmp(*cmds,"create") && ncmd == 6) {
-
- printf("Create=%d\n",
- Create_Chunk(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0),
- strtol(cmds[4],0,0),
- strtol(cmds[5],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"read")) {
- db = d;
- if (ncmd > 1)
- d = Open_Disk(cmds[1]);
- else
- d = Open_Disk(d->name);
- if (d)
- Free_Disk(db);
- else
- d = db;
- continue;
- }
- if (!strcasecmp(*cmds,"scan")) {
- Scan_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bteasy")) {
- Set_Boot_Mgr(d,bteasy17);
- continue;
- }
- if (!strcasecmp(*cmds,"mbr")) {
- Set_Boot_Mgr(d,mbr);
- continue;
- }
- if (!strcasecmp(*cmds,"boot")) {
- extern u_char boot1[],boot2[];
- Set_Boot_Blocks(d,boot1,boot2);
- continue;
- }
- if (!strcasecmp(*cmds,"write")) {
- printf("Write=%d\n",
- Write_Disk(d));
- Free_Disk(d);
- d = Open_Disk(d->name);
- continue;
- }
- if (strcasecmp(*cmds,"help"))
- printf("\007ERROR\n");
- printf("CMDS:\n");
- printf("allfreebsd\t\t");
- printf("bios cyl hd sect\n");
- printf("boot\t\t");
- printf("bteasy17\n");
- printf("collapse [pointer]\t\t");
- printf("create offset size enum subtype flags\n");
- printf("subtype(part): swap=1, ffs=7\t\t");
- printf("delete pointer\n");
- printf("list\t\t");
- printf("mbr\n");
- printf("phys cyl hd sect\t\t");
- printf("quit\n");
- printf("read [disk]\t\t");
- printf("scan\n");
- printf("write\t\t");
- printf("ENUM:\n\t");
- for(i=0;chunk_n[i];i++)
- printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
- printf("\n");
-
+ strtol(cmds[3],0,0),
+ strtol(cmds[4],0,0),
+ strtol(cmds[5],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"read")) {
+ db = d;
+ if (ncmd > 1)
+ d = Open_Disk(cmds[1]);
+ else
+ d = Open_Disk(d->name);
+ if (d)
+ Free_Disk(db);
+ else
+ d = db;
+ continue;
+ }
+ if (!strcasecmp(*cmds,"scan")) {
+ Scan_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bteasy")) {
+ Set_Boot_Mgr(d,bteasy17);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"mbr")) {
+ Set_Boot_Mgr(d,mbr);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"boot")) {
+ extern u_char boot1[],boot2[];
+ Set_Boot_Blocks(d,boot1,boot2);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"write")) {
+ printf("Write=%d\n",
+ Write_Disk(d));
+ Free_Disk(d);
+ d = Open_Disk(d->name);
+ continue;
}
+ if (strcasecmp(*cmds,"help"))
+ printf("\007ERROR\n");
+ printf("CMDS:\n");
+ printf("allfreebsd\t\t");
+ printf("bios cyl hd sect\n");
+ printf("boot\t\t");
+ printf("bteasy17\n");
+ printf("collapse [pointer]\t\t");
+ printf("create offset size enum subtype flags\n");
+ printf("subtype(part): swap=1, ffs=7\t\t");
+ printf("delete pointer\n");
+ printf("list\t\t");
+ printf("mbr\n");
+ printf("phys cyl hd sect\t\t");
+ printf("quit\n");
+ printf("read [disk]\t\t");
+ printf("scan\n");
+ printf("write\t\t");
+ printf("ENUM:\n\t");
+ for(i=0;chunk_n[i];i++)
+ printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
+ printf("\n");
+
+ }
}
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 24baf10..ad6e00b 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -8,7 +8,8 @@ SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
- disks.c command.c decode.c
+ disks.c command.c decode.c label.c \
+ tcpip.c
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
diff --git a/usr.sbin/sade/command.c b/usr.sbin/sade/command.c
index a143be0..5d59426 100644
--- a/usr.sbin/sade/command.c
+++ b/usr.sbin/sade/command.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: command.c,v 1.1 1995/05/08 06:08:27 jkh Exp $
+ * $Id: command.c,v 1.2 1995/05/11 09:01:24 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,7 +47,10 @@
typedef struct {
char key[FILENAME_MAX];
- char *cmds[MAX_NUM_COMMANDS];
+ struct {
+ enum { CMD_SHELL, CMD_FUNCTION } type;
+ void *ptr, *data;
+ } cmds[MAX_NUM_COMMANDS];
int ncmds;
} Command;
@@ -55,6 +58,7 @@ typedef struct {
static Command *commandStack[MAX_CMDS];
int numCommands;
+/* Nuke the command stack */
void
command_clear(void)
{
@@ -62,13 +66,15 @@ command_clear(void)
for (i = 0; i < numCommands; i++)
for (j = 0; j < commandStack[i]->ncmds; j++)
- free(commandStack[i]->cmds[j]);
+ if (commandStack[i]->cmds[j].type == CMD_SHELL)
+ free(commandStack[i]->cmds[j].ptr);
free(commandStack[i]);
numCommands = 0;
}
+/* Add a shell command under a given key */
void
-command_add(char *key, char *fmt, ...)
+command_shell_add(char *key, char *fmt, ...)
{
va_list args;
char *cmd;
@@ -82,22 +88,59 @@ command_add(char *key, char *fmt, ...)
/* First, look for the key already present and add a command to it */
for (i = 0; i < numCommands; i++) {
if (!strcmp(commandStack[i]->key, key)) {
- commandStack[i]->cmds[commandStack[i]->ncmds++] = cmd;
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
msgFatal("More than %d commands stacked up behind %s??",
MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_SHELL;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)cmd;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = NULL;
+ ++(commandStack[i]->ncmds);
return;
}
}
+ if (numCommands == MAX_CMDS)
+ msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
/* If we fell to here, it's a new key */
commandStack[numCommands] = safe_malloc(sizeof(Command));
strcpy(commandStack[numCommands]->key, key);
commandStack[numCommands]->ncmds = 1;
- commandStack[numCommands++]->cmds[0] = cmd;
+ commandStack[numCommands]->cmds[0].type = CMD_SHELL;
+ commandStack[numCommands]->cmds[0].ptr = (void *)cmd;
+ commandStack[numCommands]->cmds[0].data = NULL;
+}
+
+/* Add a shell command under a given key */
+void
+command_func_add(char *key, commandFunc func, void *data)
+{
+ int i;
+
+ /* First, look for the key already present and add a command to it */
+ for (i = 0; i < numCommands; i++) {
+ if (!strcmp(commandStack[i]->key, key)) {
+ if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
+ msgFatal("More than %d commands stacked up behind %s??",
+ MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_FUNC;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)func;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = data;
+ ++(commandStack[i]->ncmds);
+ return;
+ }
+ }
if (numCommands == MAX_CMDS)
msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
+ /* If we fell to here, it's a new key */
+ commandStack[numCommands] = safe_malloc(sizeof(Command));
+ strcpy(commandStack[numCommands]->key, key);
+ commandStack[numCommands]->ncmds = 1;
+ commandStack[numCommands]->cmds[0].type = CMD_FUNC;
+ commandStack[numCommands++]->cmds[0].ptr = (void *)func;
}
+/* arg to sort */
static int
sort_compare(const void *p1, const void *p2)
{
@@ -110,17 +153,30 @@ command_sort(void)
qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
}
+/* Run all accumulated commands in sorted order */
void
command_execute(void)
{
int i, j, ret;
+ commandFunc func;
for (i = 0; i < numCommands; i++) {
for (j = 0; j < commandStack[i]->ncmds; j++) {
- msgNotify("Executing command: %s", commandStack[i]->cmds[j]);
- ret = system(commandStack[i]->cmds[j]);
- msgDebug("Command: %s returns status %d\n",
- commandStack[i]->cmds[j], ret);
+ if (commandStack[i].type == CMD_SHELL) {
+ msgNotify("Executing command: %s",
+ commandStack[i]->cmds[j].ptr);
+ ret = system((char *)commandStack[i]->cmds[j].ptr);
+ msgDebug("Command `%s' returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
+ else {
+ func = (commandFunc)commandStack[i]->cmds.ptr;
+ msgNotify("Executing internal command @ %0x", func);
+ ret = (*func)(commandStack[i]->cmds.key,
+ commandStack[i]->cmds.data);
+ msgDebug("Function @ %x returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
}
}
}
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index c1f4b94..aa63d8d 100644
--- a/usr.sbin/sade/devices.c
+++ b/usr.sbin/sade/devices.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: devices.c,v 1.13 1995/05/11 06:10:45 jkh Exp $
+ * $Id: devices.c,v 1.14 1995/05/11 06:47:42 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,324 +42,277 @@
*/
#include "sysinstall.h"
+
#include <sys/fcntl.h>
-#include <ctype.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <arpa/inet.h>
+
+#define NSIP
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#include <netdb.h>
+
+#define EON
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
+#include <sys/protosw.h>
-/* Where we start displaying chunk information on the screen */
-#define CHUNK_START_ROW 5
+#include <ctype.h>
-static char *cdrom_table[] = {
- "cd0a", "cd1a", /* SCSI */
- "mcd0a", "mcd1a", /* Mitsumi (old model) */
- "scd0a", "scd1a", /* Sony CDROM */
- "matcd0a", "matcd1a", /* Matsushita (SB) */
- NULL,
+static Device *Devices[DEV_MAX];
+static int numDevs;
+
+#define CHECK_DEVS \
+ if (numDevs == DEV_MAX) msgFatal("Too many devices found!")
+
+static struct {
+ DeviceType type;
+ char *name;
+ char *description;
+} device_names[] = {
+ { DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
+ { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
+ { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", }
+ { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ("sound blaster" type)" },
+ { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM ("sound blaster" type - 2nd unit)" },
+ { DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
+ { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
+ { DEVICE_TYPE_TAPE, "ft0", "Floppy tape drive (QIC-02)" },
+ { DEVICE_TYPE_TAPE, "wt0", "Wangtek tape drive" },
+ { DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
+ { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
+ { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
+ { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
+ { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" },
+ { DEVICE_TYPE_NETWORK, "tun", "Tunneling IP driver (not for direct use)" },
+ { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 cards" },
+ { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 interface card" },
+ { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 interface card" },
+ { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A Ethernet" },
+ { DEVICE_TYPE_NETWORK, "ie", "AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210" },
+ { DEVICE_TYPE_NETWORK, "le", "DEC EtherWorks 2 and 3" },
+ { DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL)" },
+ { DEVICE_TYPE_NETWORK, "ze", "IBM/National Semiconductor PCMCIA ethernet controller" },
+ { DEVICE_TYPE_NETWORK, "zp", "3Com PCMCIA Etherlink III" },
+ { NULL },
};
-/* Get all device information for a given device class */
static Device *
-device_get_all(DeviceType which, int *ndevs)
+new_device(char *name)
{
- 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;
- }
- free(names);
- }
- }
- if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
- char try[FILENAME_MAX];
- int i, fd;
-
- for (i = 0; cdrom_table[i]; i++) {
- snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
- fd = open(try, O_RDWR);
- if (fd > 0) {
- close(fd);
- devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
- strcpy(devs[*ndevs].name, cdrom_table[i]);
- devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
- break;
- }
- }
- }
- /* Terminate the devices array */
- devs[*ndevs].name[0] = '\0';
- return devs;
+ Device *dev;
+
+ dev = safe_malloc(sizeof(Device));
+ if (name)
+ strcpy(dev->name, name);
+ else
+ dev->name[0] = '\0';
+ return dev;
}
-static struct chunk *chunk_info[10];
-static int current_chunk;
-
-static void
-record_chunks(struct disk *d)
+static int
+deviceTry(char *name)
{
- struct chunk *c1;
- int i = 0;
- int last_free = 0;
- if (!d->chunks)
- msgFatal("No chunk list found for %s!", d->name);
- c1 = d->chunks->part;
- current_chunk = 0;
- while (c1) {
- if (c1->type == unused && c1->size > last_free) {
- last_free = c1->size;
- current_chunk = i;
- }
- chunk_info[i++] = c1;
- c1 = c1->next;
- }
- chunk_info[i] = NULL;
-}
-
-static void
-print_chunks(struct disk *d)
-{
- int row;
- int i;
-
- attrset(A_NORMAL);
- mvaddstr(0, 0, "Disk name:\t");
- attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
- attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
- mvprintw(1, 0,
- "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
- "Offset", "Size", "End", "Name", "PType", "Desc",
- "Subtype", "Flags");
- for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
- if (i == current_chunk)
- attrset(A_REVERSE);
- mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
- chunk_info[i]->offset, chunk_info[i]->size,
- chunk_info[i]->end, chunk_info[i]->name,
- chunk_info[i]->type, chunk_n[chunk_info[i]->type],
- chunk_info[i]->subtype, chunk_info[i]->flags);
- if (i == current_chunk)
- attrset(A_NORMAL);
- }
+ char try[FILENAME_MAX];
+
+ snprintf(try, FILENAME_MAX, "/dev/%s", name);
+ fd = open(try, O_RDWR);
+ if (fd > 0)
+ return fd;
+ snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
+ fd = open(try, O_RDWR);
+ return fd;
}
static void
-print_command_summary()
+deviceDiskFree(Device *dev)
{
- mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
- mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
- mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
- mvprintw(20, 0, "The currently selected partition is displayed in ");
- attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
- mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
- move(0, 0);
+ Disk_Close(dev->private);
}
-struct disk *
-device_slice_disk(struct disk *d)
+/* Get all device information for devices we have attached */
+void
+deviceGetAll(Boolean disksOnly)
{
- char *p;
- int key = 0;
- Boolean chunking;
- char *msg = NULL;
- char name[40];
+ int i, fd, s;
+ struct ifconf ifc;
+ struct ifreq *ifptr, *end;
+ int ifflags, selectflag = -1;
+ char buffer[INTERFACES_MAX * sizeof(struct ifreq)];
- dialog_clear();
- chunking = TRUE;
- strncpy(name, d->name, 40);
- keypad(stdscr, TRUE);
+ /* We do this at the very beginning */
+ if (disksOnly) {
+ char **names = Disk_names();
- record_chunks(d);
- while (chunking) {
- clear();
- print_chunks(d);
- print_command_summary();
- if (msg) {
- standout(); mvprintw(23, 0, msg); standend();
- beep();
- msg = NULL;
+ if (names) {
+ int i;
+
+ for (i = 0; names[i]; i++) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_device(names[i]);
+ Devices[numDevs]->type = DEVICE_TYPE_DISK;
+ Devices[numDevs]->ignore = TRUE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaUFSGet;
+ Devices[numDevs]->close = deviceDiskFree;
+ Devices[numDevs]->private = Open_Disk(names[i]);
+ if (!Devices[numDevs]->private)
+ msgFatal("Unable to open device for %s!", names[i]);
+ msgDebug("Found a device of type disk named: %s\n",
+ names[i]);
+ ++numDevs;
+ }
+ free(names);
}
- refresh();
-
- key = toupper(getch());
- switch (key) {
- case KEY_UP:
- case '-':
- if (current_chunk != 0)
- --current_chunk;
- break;
-
- case KEY_DOWN:
- case '+':
- case '\r':
- case '\n':
- if (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_HOME:
- current_chunk = 0;
- break;
-
- case KEY_END:
- while (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_F(1):
- case '?':
- systemDisplayFile("slice.hlp");
- break;
-
- case 'A':
- All_FreeBSD(d);
- record_chunks(d);
- break;
-
- case 'B':
- if (chunk_info[current_chunk]->type != freebsd)
- msg = "Can only scan for bad blocks in FreeBSD partition.";
- else if (strncmp(name, "sd", 2) ||
- !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
- chunk_info[current_chunk]->flags |= CHUNK_BAD144;
- break;
-
- case 'C':
- if (chunk_info[current_chunk]->type != unused)
- msg = "Partition in use, delete it first or move to an unused one.";
- else {
- char *val, tmp[20];
- int size;
+ return;
+ }
- snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
- val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
- if (val && (size = strtol(val, 0, 0)) > 0) {
- Create_Chunk(d, chunk_info[current_chunk]->offset,
- size,
- freebsd,
- 3,
- (chunk_info[current_chunk]->flags &
- CHUNK_ALIGN));
- record_chunks(d);
- }
+ /*
+ * Try to get all the types of devices it makes sense to get at the
+ * second stage of the installation.
+ */
+ for (i = 0; device_names[i].name; i++) {
+ switch(device_names[i].type) {
+ case DEVICE_TYPE_CDROM:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_CDROM;
+ Devices[numDevs]->description = devices_names[i].description;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaCDROMGet;
+ Devices[numDevs]->close = NULL;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type CDROM named: %s\n",
+ cdrom_table[i]);
+ ++numDevs;
}
break;
- case 'D':
- if (chunk_info[current_chunk]->type == unused)
- msg = "Partition is already unused!";
- else {
- Delete_Chunk(d, chunk_info[current_chunk]);
- record_chunks(d);
+ case DEVICE_TYPE_TAPE:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_TAPE;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaTapeInit;
+ Devices[numDevs]->get = mediaTapeGet;
+ Devices[numDevs]->close = mediaTapeClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type TAPE named: %s\n",
+ tape_table[i]);
+ ++numDevs;
}
break;
-
- case 'G': {
- char *val, geometry[80];
-
- snprintf(geometry, 80, "%lu/%lu/%lu",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- val = msgGetInput(geometry,
-"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
- if (val) {
- d->bios_cyl = strtol(val, &val, 0);
- d->bios_hd = strtol(val + 1, &val, 0);
- d->bios_sect = strtol(val + 1, 0, 0);
- }
}
- break;
-
- case 'S':
- /* Set Bootable */
- chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
- break;
-
- case 'U':
- Free_Disk(d);
- d = Open_Disk(name);
- if (!d)
- msgFatal("Can't reopen disk %s!", name);
- record_chunks(d);
- break;
-
- case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
- clear();
- dialog_clear();
- end_dialog();
- DialogActive = FALSE;
- slice_wizard(d);
- clear();
- dialog_clear();
- DialogActive = TRUE;
- record_chunks(d);
- }
- else
- msg = "Wise choice!";
- break;
-
- case 27: /* ESC */
- chunking = FALSE;
- break;
+ }
- default:
- beep();
- msg = "Type F1 or ? for help";
- break;
+ /*
+ * Now go for the network interfaces dynamically. Stolen shamelessly
+ * from ifconfig!
+ */
+ ifc.ifc_len = sizeof(buffer);
+ ifc.ifc_buf = buffer;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ msgConfirm("ifconfig: socket");
+ return;
+ }
+ if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
+ msgConfirm("ifconfig (SIOCGIFCONF)");
+ return;
+ }
+ ifflags = ifc.ifc_req->ifr_flags;
+ end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
+ ifptr = ifc.ifc_req;
+ while (ifptr < end) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(ifptr->ifr_name);
+ Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaNetworkInit;
+ Devices[numDevs]->get = mediaNetworkGet;
+ Devices[numDevs]->close = mediaNetworkClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type network named: %s\n",
+ ifptr->ifr_name);
+ ++numDevs;
+ close(s);
+ if ((s = socket(af, SOCK_DGRAM, 0)) < 0) {
+ msgConfirm("ifconfig: socket");
+ continue;
}
+ if (ifptr->ifr_addr.sa_len) /* Dohw! */
+ ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len
+ - sizeof(struct sockaddr));
+ ifptr++;
}
- p = CheckRules(d);
- if (p) {
- msgConfirm(p);
- free(p);
+ /* Terminate the devices array */
+ Devices[numDevs] = NULL;
+}
+
+/*
+ * Find all devices that match the criteria, allowing "wildcarding" as well
+ * by allowing NULL or ANY values to match all.
+ */
+Device **
+deviceFind(char *name, DeviceType class)
+{
+ static Device *found[DEV_MAX];
+ int i, j;
+
+ for (i = 0, j = 0; i < numDevs; i++) {
+ if ((!name || !strcmp(Devices[i]->name, name)) &&
+ (class == DEVICE_TYPE_ANY || class == Devices[i]->type))
+ found[j++] = Devices[i];
}
- clear();
- refresh();
- return d;
+ found[j] = NULL;
+ return j ? found : NULL;
}
/*
- * Create a menu listing all the devices in the system. The pass-in menu
- * is expected to be a "prototype" from which the new menu is cloned.
+ * Create a menu listing all the devices of a certain type in the system.
+ * The passed-in menu is expected to be a "prototype" from which the new
+ * menu is cloned.
*/
DMenu *
-device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
+deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)())
{
- Device *devices;
- int numdevs;
+ Device **devs;
- 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;
+ devs = deviceFind(NULL, type);
+ if (devs) {
DMenu *tmp;
- int i;
+ int i, j;
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);
+ for (i = 0; *devs; i++, devs++) {
+ tmp->items[i].title = *devs->name;
+ for (j = 0; device_names[j].name; j++) {
+ if (!strncmp(*devs->name, device_names[j].name,
+ strlen(device_names[j].name)))
+ tmp->items[i].prompt = devices_names[j].description;
+ }
+ if (!device_names[j].name)
+ tmp->items[i].prompt = "<unknown device type>";
tmp->items[i].type = DMENU_CALL;
tmp->items[i].ptr = hook;
tmp->items[i].disabled = FALSE;
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index baf2137..dafaf37 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.16 1995/05/11 06:10:48 jkh Exp $
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -45,298 +45,58 @@
#include <ctype.h>
#include <sys/disklabel.h>
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-
-#define MAX_CHUNKS 50
-
-/* Where to start printing the freebsd slices */
-#define CHUNK_SLICE_START_ROW 2
-#define CHUNK_PART_START_ROW 10
-
-/* The smallest filesystem we're willing to create */
-#define FS_MIN_SIZE 2048
-
-#define MSG_NOT_APPLICABLE "That option is not applicable here"
+/* Where we start displaying chunk information on the screen */
+#define CHUNK_START_ROW 5
-static struct {
- struct disk *d;
- struct chunk *c;
- PartType type;
-} fbsd_chunk_info[MAX_CHUNKS + 1];
+/* Where we keep track of MBR chunks */
+static struct chunk *chunk_info[10];
static int current_chunk;
-
-static Boolean
-check_conflict(char *name)
-{
- int i;
-
- for (i = 0; fbsd_chunk_info[i].d; i++)
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
- fbsd_chunk_info[i].c->private &&
- !strcmp(((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint,
- name))
- return TRUE;
- return FALSE;
-}
-
-static int
-space_free(struct chunk *c)
-{
- struct chunk *c1 = c->part;
- int sz = c->size;
-
- while (c1) {
- if (c1->type != unused)
- sz -= c1->size;
- c1 = c1->next;
- }
- if (sz < 0)
- msgFatal("Partitions are larger than actual chunk??");
- return sz;
-}
-
static void
-record_fbsd_chunks()
+record_chunks(Disk *d)
{
- int i, j, p;
- struct chunk *c1, *c2;
-
- j = p = 0;
- for (i = 0; Disks[i]; i++) {
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
-
- /* Put the freebsd chunks first */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- fbsd_chunk_info[j].type = PART_SLICE;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c1;
- ++j;
- }
- }
- }
- for (i = 0; Disks[i]; i++) {
- /* Then buzz through and pick up the partitions */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part) {
- if (c2->subtype == FS_SWAP)
- fbsd_chunk_info[j].type = PART_SWAP;
- else
- fbsd_chunk_info[j].type = PART_FILESYSTEM;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c2;
- ++j;
- }
- }
- }
- }
- }
- fbsd_chunk_info[j].d = NULL;
- fbsd_chunk_info[j].c = NULL;
- if (current_chunk >= j)
- current_chunk = j ? j - 1 : 0;
-}
-
-static PartInfo *
-new_part(char *mpoint, Boolean newfs)
-{
- PartInfo *ret;
-
- ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
- strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
- strcpy(ret->newfs_cmd, "newfs");
- ret->newfs = newfs;
- return ret;
-}
-
-PartInfo *
-get_mountpoint(struct chunk *c)
-{
- char *val;
- PartInfo *tmp;
-
- val = msgGetInput(c && c->private ?
- ((PartInfo *)c->private)->mountpoint : NULL,
- "Please specify a mount point for the partition");
- if (val) {
- if (check_conflict(val)) {
- msgConfirm("You already have a mount point for %s assigned!", val);
- return NULL;
- }
- else if (*val != '/') {
- msgConfirm("Mount point must start with a / character");
- return NULL;
- }
- else if (!strcmp(val, "/")) {
- if (c) {
- if (c->flags & CHUNK_PAST_1024) {
- msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
- return NULL;
- }
-#if 0 /* This never seems to be set */
- else if (!(c->flags & CHUNK_BSD_COMPAT)) {
- msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
- return NULL;
- }
-#endif
- else
- c->flags |= CHUNK_IS_ROOT;
- }
- }
- else if (c)
- c->flags &= ~CHUNK_IS_ROOT;
- safe_free(c ? c->private : NULL);
- tmp = new_part(val, TRUE);
- if (c) {
- c->private = tmp;
- c->private_free = safe_free;
+ struct chunk *c1;
+ int i = 0;
+ int last_free = 0;
+ if (!d->chunks)
+ msgFatal("No chunk list found for %s!", d->name);
+ c1 = d->chunks->part;
+ current_chunk = 0;
+ while (c1) {
+ if (c1->type == unused && c1->size > last_free) {
+ last_free = c1->size;
+ current_chunk = i;
}
- return tmp;
- }
- return NULL;
-}
-
-static PartType
-get_partition_type(void)
-{
- char selection[20];
- static unsigned char *fs_types[] = {
- "FS",
- "A file system",
- "Swap",
- "A swap partition.",
- };
-
- if (!dialog_menu("Please choose a partition type",
- "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
- if (!strcmp(selection, "FS"))
- return PART_FILESYSTEM;
- else if (!strcmp(selection, "Swap"))
- return PART_SWAP;
+ chunk_info[i++] = c1;
+ c1 = c1->next;
}
- return PART_NONE;
-}
-
-static void
-getNewfsCmd(PartInfo *p)
-{
- char *val;
-
- val = msgGetInput(p->newfs_cmd,
- "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
- if (val)
- strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+ chunk_info[i] = NULL;
}
-
-#define MAX_MOUNT_NAME 12
-
-#define PART_PART_COL 0
-#define PART_MOUNT_COL 8
-#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
-#define PART_NEWFS_COL (PART_SIZE_COL + 7)
-#define PART_OFF 38
-
-/* How many mounted partitions to display in column before going to next */
-#define CHUNK_COLUMN_MAX 6
-
static void
-print_fbsd_chunks(void)
+print_chunks(Disk *d)
{
- int i, j, srow, prow, pcol;
- int sz;
+ int row;
+ int i;
- attrset(A_REVERSE);
- mvaddstr(0, 25, "FreeBSD Partition Editor");
attrset(A_NORMAL);
-
- for (i = 0; i < 2; i++) {
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
- "Part");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
- "Mount");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
- "Size");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
- "Newfs");
- attrset(A_NORMAL);
- }
-
- srow = CHUNK_SLICE_START_ROW;
- prow = CHUNK_PART_START_ROW;
- pcol = 0;
-
- for (i = 0; fbsd_chunk_info[i].d; i++) {
+ mvaddstr(0, 0, "Disk name:\t");
+ attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
+ attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
+ mvprintw(1, 0,
+ "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
attrset(A_REVERSE);
- /* Is it a slice entry displayed at the top? */
- if (fbsd_chunk_info[i].type == PART_SLICE) {
- sz = space_free(fbsd_chunk_info[i].c);
- mvprintw(srow++, 0,
- "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
- fbsd_chunk_info[i].d->name,
- fbsd_chunk_info[i].c->name, sz, (sz / 2048));
- }
- /* Otherwise it's a swap or filesystem entry, at the bottom */
- else {
- char onestr[PART_OFF], num[10], *mountpoint, *newfs;
-
- memset(onestr, ' ', PART_OFF - 1);
- onestr[PART_OFF - 1] = '\0';
- /* Go for two columns */
- if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
- pcol = PART_OFF;
- prow = CHUNK_PART_START_ROW;
- }
- memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
- strlen(fbsd_chunk_info[i].c->name));
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
- if (fbsd_chunk_info[i].c->private) {
- mountpoint = ((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint;
- newfs = ((PartInfo *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N";
- }
- else {
- fbsd_chunk_info[i].c->private = new_part("", FALSE);
- fbsd_chunk_info[i].c->private_free = safe_free;
- mountpoint = " ";
- newfs = "N";
- }
- }
- else {
- mountpoint = "swap";
- newfs = " ";
- }
- for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
- onestr[PART_MOUNT_COL + j] = mountpoint[j];
- snprintf(num, 10, "%4ldMB", fbsd_chunk_info[i].c->size ?
- fbsd_chunk_info[i].c->size / 2048 : 0);
- memcpy(onestr + PART_SIZE_COL, num, strlen(num));
- memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
- onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
- mvaddstr(prow, pcol, onestr);
- ++prow;
- }
+ mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
+ chunk_info[i]->offset, chunk_info[i]->size,
+ chunk_info[i]->end, chunk_info[i]->name,
+ chunk_info[i]->type, chunk_n[chunk_info[i]->type],
+ chunk_info[i]->subtype, chunk_info[i]->flags);
if (i == current_chunk)
attrset(A_NORMAL);
}
@@ -345,46 +105,44 @@ print_fbsd_chunks(void)
static void
print_command_summary()
{
- mvprintw(17, 0,
- "The following commands are valid here (upper or lower case):");
- mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
- mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
- mvprintw(21, 0, "The default target will be displayed in ");
-
- attrset(A_REVERSE);
- addstr("reverse video.");
- attrset(A_NORMAL);
- mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
+ mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
+ mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
+ mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
+ mvprintw(20, 0, "The currently selected partition is displayed in ");
+ attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
+ mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
move(0, 0);
}
-void
-partition_disks(void)
+static Disk *
+diskPartition(Disk *d)
{
- int sz, key = 0;
- Boolean partitioning;
+ char *p;
+ int key = 0;
+ Boolean chunking;
char *msg = NULL;
- PartInfo *p;
- PartType type;
+ char name[40];
dialog_clear();
- partitioning = TRUE;
+ chunking = TRUE;
+ strncpy(name, d->name, 40);
keypad(stdscr, TRUE);
- record_fbsd_chunks();
- while (partitioning) {
+ record_chunks(d);
+ while (chunking) {
clear();
- print_fbsd_chunks();
+ print_chunks(d);
print_command_summary();
if (msg) {
- attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ standout(); mvprintw(23, 0, msg); standend();
beep();
msg = NULL;
}
refresh();
+
key = toupper(getch());
switch (key) {
-
case KEY_UP:
case '-':
if (current_chunk != 0)
@@ -395,7 +153,7 @@ partition_disks(void)
case '+':
case '\r':
case '\n':
- if (fbsd_chunk_info[current_chunk + 1].d)
+ if (chunk_info[current_chunk + 1])
++current_chunk;
break;
@@ -404,138 +162,104 @@ partition_disks(void)
break;
case KEY_END:
- while (fbsd_chunk_info[current_chunk + 1].d)
+ while (chunk_info[current_chunk + 1])
++current_chunk;
break;
case KEY_F(1):
case '?':
- systemDisplayFile("partitioning.hlp");
+ systemDisplayFile("slice.hlp");
+ break;
+
+ case 'A':
+ All_FreeBSD(d);
+ record_chunks(d);
+ break;
+
+ case 'B':
+ if (chunk_info[current_chunk]->type != freebsd)
+ msg = "Can only scan for bad blocks in FreeBSD partition.";
+ else if (strncmp(name, "sd", 2) ||
+ !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
+ chunk_info[current_chunk]->flags |= CHUNK_BAD144;
break;
case 'C':
- if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
- msg = "You can only do this in a master partition (see top of screen)";
- break;
- }
- sz = space_free(fbsd_chunk_info[current_chunk].c);
- if (sz <= FS_MIN_SIZE)
- msg = "Not enough space to create additional FreeBSD partition";
+ if (chunk_info[current_chunk]->type != unused)
+ msg = "Partition in use, delete it first or move to an unused one.";
else {
- char *val, *cp, tmp[20];
+ char *val, tmp[20];
int size;
- snprintf(tmp, 20, "%d", sz);
- val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
- if (val && (size = strtol(val, &cp, 0)) > 0) {
- struct chunk *tmp;
- u_long flags = 0;
-
- if (*cp && toupper(*cp) == 'M')
- size *= 2048;
-
- type = get_partition_type();
- if (type == PART_NONE)
- break;
- else if (type == PART_FILESYSTEM) {
- if ((p = get_mountpoint(NULL)) == NULL)
- break;
- else if (!strcmp(p->mountpoint, "/"))
- flags |= CHUNK_IS_ROOT;
- else
- flags &= ~CHUNK_IS_ROOT;
- }
- else
- p = NULL;
-
- tmp = Create_Chunk_DWIM(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c,
- size,
- part,
- (type == PART_SWAP) ?
- FS_SWAP : FS_BSDFFS,
- flags);
- if (!tmp)
- msgConfirm("Unable to create the partition. Too big?");
- else {
- tmp->private = p;
- tmp->private_free = safe_free;
- record_fbsd_chunks();
- }
+ snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
+ val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
+ if (val && (size = strtol(val, 0, 0)) > 0) {
+ Create_Chunk(d, chunk_info[current_chunk]->offset,
+ size,
+ freebsd,
+ 3,
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
+ record_chunks(d);
}
}
break;
- case 'D': /* delete */
- if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
- msg = MSG_NOT_APPLICABLE;
- break;
+ case 'D':
+ if (chunk_info[current_chunk]->type == unused)
+ msg = "Partition is already unused!";
+ else {
+ Delete_Chunk(d, chunk_info[current_chunk]);
+ record_chunks(d);
}
- Delete_Chunk(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c);
- record_fbsd_chunks();
break;
- case 'M': /* mount */
- switch(fbsd_chunk_info[current_chunk].type) {
- case PART_SLICE:
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case PART_SWAP:
- msg = "You don't need to specify a mountpoint for a swap partition.";
- break;
-
- case PART_FILESYSTEM:
- p = get_mountpoint(fbsd_chunk_info[current_chunk].c);
- if (p) {
- p->newfs = FALSE;
- record_fbsd_chunks();
- }
- break;
-
- default:
- msgFatal("Bogus partition under cursor???");
- break;
+ case 'G': {
+ char *val, geometry[80];
+
+ snprintf(geometry, 80, "%lu/%lu/%lu",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ val = msgGetInput(geometry,
+"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
+ if (val) {
+ d->bios_cyl = strtol(val, &val, 0);
+ d->bios_hd = strtol(val + 1, &val, 0);
+ d->bios_sect = strtol(val + 1, 0, 0);
}
+ }
break;
- case 'N': /* Set newfs options */
- if (fbsd_chunk_info[current_chunk].c->private &&
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
- getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'S':
+ /* Set Bootable */
+ chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
- case 'T': /* Toggle newfs state */
- if (fbsd_chunk_info[current_chunk].c->private)
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'U':
+ Free_Disk(d);
+ d = Open_Disk(name);
+ if (!d)
+ msgFatal("Can't reopen disk %s!", name);
+ record_chunks(d);
break;
case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
- int i;
-
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
clear();
dialog_clear();
end_dialog();
DialogActive = FALSE;
- for (i = 0; Disks[i]; i++)
- slice_wizard(Disks[i]);
+ slice_wizard(d);
clear();
dialog_clear();
DialogActive = TRUE;
- record_fbsd_chunks();
+ record_chunks(d);
}
else
- msg = "A most prudent choice!";
+ msg = "Wise choice!";
break;
case 27: /* ESC */
- partitioning = FALSE;
+ chunking = FALSE;
break;
default:
@@ -544,31 +268,65 @@ partition_disks(void)
break;
}
}
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ clear();
+ refresh();
+ variable_set2(DISK_PARTITIONED, "yes");
+ return d;
}
-int
-write_disks(void)
+static int
+partitionHook(char *str)
{
- int i;
- extern u_char boot1[], boot2[];
- extern u_char mbr[], bteasy17[];
-
- dialog_clear();
- for (i = 0; Disks[i]; i++) {
- Set_Boot_Blocks(Disks[i], boot1, boot2);
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
- Set_Boot_Mgr(Disks[i], bteasy17);
- else {
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to remove an existing boot manager?"))
- Set_Boot_Mgr(Disks[i], mbr);
+ Device *devs;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ /* Try and open all the disks */
+ while (str) {
+ char *cp;
+
+ cp = index(str, '\n');
+ if (cp)
+ *cp++ = 0;
+ if (!*str) {
+ beep();
+ return 0;
}
- dialog_clear();
- if (!msgYesNo("Last Chance! Are you sure you want to write out\nall these changes to disk?")) {
- Write_Disk(Disks[i]);
+ devs = deviceFind(str, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Unable to find disk %s!", str);
return 0;
}
+ else if (devs[1])
+ msgConfirm("Bizarre multiple match for %s!", str);
+ devs[0]->private = diskPartition((Disk *)devs[0]->private);
+ str = cp;
+ }
+ return devs ? 1 : 0;
+}
+
+extern DMenu MenuInstall;
+
+int
+diskPartitionEditor(char *str)
+{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+
+ menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
+ if (!menu) {
+ 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 0;
}
- return 1;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ return 0;
}
diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c
index 7c43ed2..d10167c 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.6 1995/05/10 08:00:47 jkh Exp $
+ * $Id: dmenu.c,v 1.7 1995/05/11 06:10:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,6 +47,16 @@
static DMenuItem shellAction = { NULL, NULL, DMENU_SHELL_ESCAPE, NULL, 0 };
+/* Traverse menu but give user no control over positioning */
+void
+dmenuOpenSimple(DMenu *menu)
+{
+ int choice, scroll, curr, max;
+
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+}
+
/* Traverse over an internal menu */
void
dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
@@ -139,7 +149,8 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
}
- if (dispatch(tmp, result) || menu->options & DMENU_SELECTION_RETURNS) {
+ if (dispatch(tmp, result) ||
+ menu->options & DMENU_SELECTION_RETURNS) {
items_free(nitems, curr, max);
return;
}
diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c
index 7fc4436..81c75b0 100644
--- a/usr.sbin/sade/globals.c
+++ b/usr.sbin/sade/globals.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
+ * $Id: globals.c,v 1.3 1995/05/08 21:39:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,8 +56,6 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
-DeviceType MediaType; /* Where we're installing from */
-char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 8599c01..7f531f7 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.15 1995/05/11 06:47:44 jkh Exp $
+ * $Id: install.c,v 1.16 1995/05/11 09:01:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -48,136 +48,88 @@
#include <unistd.h>
Boolean SystemWasInstalled;
-struct disk *Disks[100]; /* some ridiculously large number */
-static int
-installHook(char *str)
+static void make_filesystems(void);
+static void cpio_extract(void);
+static void install_configuration_files(void);
+static void do_final_setup(void);
+
+int
+installCommit(char *str)
{
+ extern u_char boot1[], boot2[];
+ extern u_char mbr[], bteasy17[];
+ u_char *mbrContents;
+ Device **devs;
int i;
- extern DMenu MenuInstall;
- i = 0;
- /* Clip garbage off the ends */
- string_prune(str);
- str = string_skipwhite(str);
- /* Try and open all the disks */
- while (str) {
- char *cp;
+ if (!getenv(DISK_PARTITIONED)) {
+ msgConfirm("You need to partition your disk before you can proceed with\nthe installation.");
- cp = index(str, '\n');
- if (cp)
- *cp++ = 0;
- if (!*str) {
- beep();
- return 0;
- }
- Disks[i] = Open_Disk(str);
- if (!Disks[i])
- msgFatal("Unable to open disk %s!", str);
- ++i;
- str = cp;
+ return 0;
}
- Disks[i] = NULL;
- if (!i)
+ if (!getenv(DISK_LABELLED)) {
+ msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
return 0;
-
- while (1) {
- /* Now go set up all the MBR partition information */
- for (i = 0; Disks[i]; i++)
- Disks[i] = device_slice_disk(Disks[i]);
-
- /* Whap partitions on all the FreeBSD slices created */
- partition_disks();
-
- /* Try and write it out */
- if (!write_disks()) {
- int scroll, choice, curr, max;
-
- make_filesystems();
- scroll = choice = curr = max = 0;
- dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
- chdir("/mnt");
- cpio_extract();
- chroot("/mnt");
- distExtractAll();
- install_configuration_files();
- do_final_setup();
- SystemWasInstalled = TRUE;
- break;
- }
- else {
- dialog_clear();
- if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
- for (i = 0; Disks[i]; i++)
- Free_Disk(Disks[i]);
- break;
- }
- }
}
- return SystemWasInstalled;
-}
-
-int
-installCustom(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "custom");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ if (!Dists) {
+ msgConfirm("You haven't told me what distributions to load yet!\nPlease select a distribution from the Distributions menu.");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installExpress(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "express");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ }
+ if (mediaVerifyStatus()) {
+ msgConfirm("Please correct installation media problems and try again!");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installMaint(char *str)
-{
- msgConfirm("Sorry, maintainance mode is not implemented in this version.");
- return 0;
+ }
+ if (msgYesNo("Last Chance! Are you SURE you want continue the\ninstallation? If you're running this on an existing system, we STRONGLY\nencourage you to make proper backups before doing this.\nWe take no responsibility for lost disk contents!"))
+ return 0;
+ dialog_clear();
+ mbrContents = NULL;
+ if (!msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
+ mbrContents = bteasy17;
+ else {
+ dialog_clear();
+ if (!msgYesNo("Would you like to remove an existing boot manager?"))
+ mbrContents = mbr;
+ }
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+ if (mbrContents) {
+ Set_Boot_Mgr((Disk *)Devices[i]->private, mbrContents);
+ mbrContents = NULL;
+ }
+ Set_Boot_Blocks((Disk *)Devices[i]->private, boot1, boot2);
+ msgNotify("Writing partition information to drive %s",
+ Devices[i]->name);
+ Write_Disk((Disk *)Devices[i]->private);
+ }
+ make_filesystems();
+ cpio_extract();
+ install_configuration_files();
+ do_final_setup();
+ return 1;
}
/* Go newfs and/or mount all the filesystems we've been asked to */
-void
+static void
make_filesystems(void)
{
int i;
+ Disk *disk;
+ Chunk *c1;
command_clear();
- for (i = 0; Disks[i]; i++) {
- struct chunk *c1;
-
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
- c1 = Disks[i]->chunks->part;
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+
+ disk = (Disk *)Devices[i]->private;
+ if (!disk->chunks)
+ msgFatal("No chunk list found for %s!", disk->name);
+ c1 = disk->chunks->part;
while (c1) {
if (c1->type == freebsd) {
- struct chunk *c2 = c1->part;
+ Chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP &&
@@ -185,19 +137,12 @@ make_filesystems(void)
PartInfo *tmp = (PartInfo *)c2->private;
if (tmp->newfs)
- command_add(tmp->mountpoint,
- "%s %s", tmp->newfs_cmd, c2->name);
- if (strcmp(tmp->mountpoint, "/")) {
- command_add(tmp->mountpoint,
- "mkdir -p /mnt%s", tmp->mountpoint);
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt%s", c2->name,
- tmp->mountpoint);
- }
- else
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt", c2->name);
-
+ command_shell_add(tmp->mountpoint,
+ "%s %s", tmp->newfs_cmd,
+ c2->name);
+ if (strcmp(tmp->mountpoint, "/"))
+ command_func_add(tmp->mountpoint, Mkdir, NULL);
+ command_func_add(tmp->mountpoint, Mount, c2->name);
}
c2 = c2->next;
}
@@ -209,7 +154,7 @@ make_filesystems(void)
command_execute();
}
-void
+static void
cpio_extract(void)
{
int i, j, zpid, cpid, pfd[2];
@@ -253,13 +198,12 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
-void
+static void
install_configuration_files(void)
{
}
-void
+static void
do_final_setup(void)
{
}
-
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
new file mode 100644
index 0000000..9d769a0
--- /dev/null
+++ b/usr.sbin/sade/label.c
@@ -0,0 +1,602 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 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 <ctype.h>
+#include <sys/disklabel.h>
+
+/*
+ * Everything to do with editing the contents of disk labels.
+ */
+
+/* A nice message we use a lot in the disklabel editor */
+#define MSG_NOT_APPLICABLE "That option is not applicable here"
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+#define MAX_CHUNKS 50
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* The smallest filesystem we're willing to create */
+#define FS_MIN_SIZE 2048
+
+
+/* All the chunks currently displayed on the screen */
+static struct {
+ struct disk *d;
+ struct chunk *c;
+ PartType type;
+} label_chunk_info[MAX_CHUNKS + 1];
+static int here;
+
+/* See if we're already using a desired partition name */
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; label_chunk_info[i].d; i++)
+ if (label_chunk_info[i].type == PART_FILESYSTEM
+ && label_chunk_info[i].c->private
+ && !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
+ return TRUE;
+ return FALSE;
+}
+
+/* How much space is in this FreeBSD slice? */
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+/* Snapshot the current situation into the displayed chunks structure */
+static void
+record_label_chunks()
+{
+ int i, j, p;
+ struct chunk *c1, *c2;
+ Device **devs;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("No disks found!");
+ return;
+ }
+
+ j = p = 0;
+ for (i = 0; devs[i]; i++) {
+ if (!((Disk *)devs[i]->private)->chunks)
+ msgFatal("No chunk list found for %s!", ((Disk *)devs[i]->private)->name);
+
+ /* Put the freebsd chunks first */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ label_chunk_info[j].type = PART_SLICE;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ ++j;
+ }
+ }
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++) {
+ /* Then buzz through and pick up the partitions */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ for (c2 = c1->part; c2; c2 = c2->next) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ label_chunk_info[j].type = PART_SWAP;
+ else
+ label_chunk_info[j].type = PART_FILESYSTEM;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c2;
+ ++j;
+ }
+ }
+ }
+ else if (c1->type == fat) {
+ label_chunk_info[j].type = PART_FAT;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ }
+ }
+ }
+ label_chunk_info[j].d = NULL;
+ label_chunk_info[j].c = NULL;
+ if (here >= j)
+ here = j ? j - 1 : 0;
+}
+
+/* A new partition entry */
+static PartInfo *
+new_part(char *mpoint, Boolean newfs)
+{
+ PartInfo *ret;
+
+ ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
+ strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
+ strcpy(ret->newfs_cmd, "newfs");
+ ret->newfs = newfs;
+ return ret;
+}
+
+/* Get the mountpoint for a partition and save it away */
+PartInfo *
+get_mountpoint(struct chunk *parent, struct chunk *me)
+{
+ char *val;
+ PartInfo *tmp;
+
+ val = msgGetInput(me && me->private ? ((PartInfo *)me->private)->mountpoint : NULL,
+ "Please specify a mount point for the partition");
+ if (val) {
+ /* Is it just the same value? */
+ if (me && me->private && !strcmp(((PartInfo *)me->private)->mountpoint, val))
+ return NULL;
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mount point for %s assigned!", val);
+ return NULL;
+ }
+ else if (*val != '/') {
+ msgConfirm("Mount point must start with a / character");
+ return NULL;
+ }
+ else if (!strcmp(val, "/")) {
+ if (parent) {
+ if (parent->flags & CHUNK_PAST_1024) {
+ msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return NULL;
+ }
+ else if (!(parent->flags & CHUNK_BSD_COMPAT)) {
+ msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
+ return NULL;
+ }
+ }
+ if (me)
+ me->flags |= CHUNK_IS_ROOT;
+ }
+ else if (me)
+ me->flags &= ~CHUNK_IS_ROOT;
+ safe_free(me ? me->private : NULL);
+ tmp = new_part(val, TRUE);
+ if (me) {
+ me->private = tmp;
+ me->private_free = safe_free;
+ }
+ return tmp;
+ }
+ return NULL;
+}
+
+/* Get the type of the new partiton */
+static PartType
+get_partition_type(void)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "FS",
+ "A file system",
+ "Swap",
+ "A swap partition.",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+/* If the user wants a special newfs command for this, set it */
+static void
+getNewfsCmd(PartInfo *p)
+{
+ char *val;
+
+ val = msgGetInput(p->newfs_cmd,
+ "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
+ if (val)
+ strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+}
+
+
+#define MAX_MOUNT_NAME 12
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
+#define PART_NEWFS_COL (PART_SIZE_COL + 7)
+#define PART_OFF 38
+
+/* How many mounted partitions to display in column before going to next */
+#define CHUNK_COLUMN_MAX 6
+
+/* stick this all up on the screen */
+static void
+print_label_chunks(void)
+{
+ int i, j, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Disklabel Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
+ "Size");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+ pcol = 0;
+
+ for (i = 0; label_chunk_info[i].d; i++) {
+ if (i == here)
+ attrset(A_REVERSE);
+ /* Is it a slice entry displayed at the top? */
+ if (label_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(label_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ label_chunk_info[i].d->name,
+ label_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */
+ else {
+ char onestr[PART_OFF], num[10], *mountpoint, *newfs;
+
+ /*
+ * We copy this into a blank-padded string so that it looks like
+ * a solid bar in reverse-video
+ */
+ memset(onestr, ' ', PART_OFF - 1);
+ onestr[PART_OFF - 1] = '\0';
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
+ pcol = PART_OFF;
+ prow = CHUNK_PART_START_ROW;
+ }
+ memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name,
+ strlen(label_chunk_info[i].c->name));
+ /* If it's a filesystem, display the mountpoint */
+ if (label_chunk_info[i].type == PART_FILESYSTEM) {
+ if (label_chunk_info[i].c->private == NULL) {
+ static int mnt = 0;
+ char foo[10];
+
+ /*
+ * Hmm! A partition that must have already been here.
+ * Fill in a fake mountpoint and register it
+ */
+ sprintf(foo, "/mnt%d", mnt++);
+ label_chunk_info[i].c->private = new_part(foo, FALSE);
+ label_chunk_info[i].c->private_free = safe_free;
+ }
+ mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
+ newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
+ }
+ else if (label_chunk_info[i].type == PART_SWAP) {
+ mountpoint = "swap";
+ newfs = " ";
+ }
+ else if (label_chunk_info[i].type == PART_FAT) {
+ mountpoint = "DOS FAT";
+ newfs = "*";
+ }
+ else {
+ mountpoint = "<unknown>";
+ newfs = "*";
+ }
+ for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
+ onestr[PART_MOUNT_COL + j] = mountpoint[j];
+ snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ?
+ label_chunk_info[i].c->size / 2048 : 0);
+ memcpy(onestr + PART_SIZE_COL, num, strlen(num));
+ memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
+ onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
+ mvaddstr(prow, pcol, onestr);
+ ++prow;
+ }
+ if (i == here)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ mvprintw(17, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
+ mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
+ mvprintw(21, 0, "The default target will be displayed in ");
+
+ attrset(A_REVERSE);
+ addstr("reverse video.");
+ attrset(A_NORMAL);
+ mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ move(0, 0);
+}
+
+void
+diskLabelEditor(char *str)
+{
+ int sz, key = 0;
+ Boolean labeling;
+ char *msg = NULL;
+ PartInfo *p;
+ PartType type;
+
+ dialog_clear();
+ labeling = TRUE;
+ keypad(stdscr, TRUE);
+ record_label_chunks();
+
+ while (labeling) {
+ clear();
+ print_label_chunks();
+ print_command_summary();
+ if (msg) {
+ attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+
+ case KEY_UP:
+ case '-':
+ if (here != 0)
+ --here;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_HOME:
+ here = 0;
+ break;
+
+ case KEY_END:
+ while (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("disklabel.hlp");
+ break;
+
+ case 'C':
+ if (label_chunk_info[here].type != PART_SLICE) {
+ msg = "You can only do this in a master partition (see top of screen)";
+ break;
+ }
+ sz = space_free(label_chunk_info[here].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, *cp, tmp[20];
+ int size;
+
+ snprintf(tmp, 20, "%d", sz);
+ val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
+ if (val && (size = strtol(val, &cp, 0)) > 0) {
+ struct chunk *tmp;
+ u_long flags = 0;
+
+ if (*cp && toupper(*cp) == 'M')
+ size *= 2048;
+
+ type = get_partition_type();
+ if (type == PART_NONE)
+ break;
+ else if (type == PART_FILESYSTEM) {
+ if ((p = get_mountpoint(label_chunk_info[here].c, NULL)) == NULL)
+ break;
+ else if (!strcmp(p->mountpoint, "/"))
+ flags |= CHUNK_IS_ROOT;
+ else
+ flags &= ~CHUNK_IS_ROOT;
+ }
+ else
+ p = NULL;
+
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
+ label_chunk_info[here].c,
+ size, part,
+ (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
+ flags);
+ if (!tmp)
+ msgConfirm("Unable to create the partition. Too big?");
+ else {
+ tmp->private = p;
+ tmp->private_free = safe_free;
+ record_label_chunks();
+ }
+ }
+ }
+ break;
+
+ case 'D': /* delete */
+ if (label_chunk_info[here].type == PART_SLICE) {
+ msg = MSG_NOT_APPLICABLE;
+ break;
+ }
+ else if (label_chunk_info[here].type == PART_FAT) {
+ msg = "Use the Disk Partition Editor to delete this";
+ break;
+ }
+ Delete_Chunk(label_chunk_info[here].d, label_chunk_info[here].c);
+ record_label_chunks();
+ break;
+
+ case 'M': /* mount */
+ switch(label_chunk_info[here].type) {
+ case PART_SLICE:
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case PART_SWAP:
+ msg = "You don't need to specify a mountpoint for a swap partition.";
+ break;
+
+ case PART_DOS:
+ case PART_FILESYSTEM:
+ p = get_mountpoint(NULL, label_chunk_info[here].c);
+ if (p) {
+ p->newfs = FALSE;
+ record_label_chunks();
+ }
+ break;
+
+ default:
+ msgFatal("Bogus partition under cursor???");
+ break;
+ }
+ break;
+
+ case 'N': /* Set newfs options */
+ if (label_chunk_info[here].c->private &&
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs)
+ getNewfsCmd(label_chunk_info[here].c->private);
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'T': /* Toggle newfs state */
+ if (label_chunk_info[here].type == PART_FILESYSTEM &&
+ label_chunk_info[here].c->private)
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs =
+ !((PartInfo *)label_chunk_info[here].c->private)->newfs;
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'W':
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
+ int i;
+ Device **devs;
+
+ clear();
+ dialog_clear();
+ end_dialog();
+ DialogActive = FALSE;
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Can't find any disk devicse!");
+ break;
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++)
+ slice_wizard(((Disk *)devs[i]->private));
+ clear();
+ dialog_clear();
+ DialogActive = TRUE;
+ record_label_chunks();
+ }
+ else
+ msg = "A most prudent choice!";
+ break;
+
+ case 27: /* ESC */
+ labeling = FALSE;
+ break;
+
+ default:
+ beep();
+ msg = "Type F1 or ? for help";
+ break;
+ }
+ }
+ variable_set2(DISK_LABELLED, "yes");
+}
+
+
+
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index c5b85cd..ce9ce46 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/main.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: main.c,v 1.4 1995/05/05 23:47:42 jkh Exp $
+ * $Id: main.c,v 1.5 1995/05/07 03:38:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,10 +63,12 @@ main(int argc, char **argv)
/* Default to English */
/* lang_set_English(NULL); */
+ /*
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
+ dialog_clear();
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? System will reboot."))
break;
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 40093ee..f2da40b 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.11 1995/05/11 06:10:54 jkh Exp $
+ * $Id: menus.c,v 1.12 1995/05/11 06:47:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,7 +52,9 @@
/* Forward decls for submenus */
extern DMenu MenuDocumentation;
-extern DMenu MenuLanguage;
+extern DMenu MenuOptions;
+extern DMenu MenuOptionsLanguage;
+extern DMenu MenuOptionsFtp;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
@@ -62,7 +64,6 @@ extern DMenu MenuXF86SelectCore;
extern DMenu MenuXF86SelectServer;
extern DMenu MenuXF86SelectFonts;
extern DMenu MenuXF86;
-extern DMenu MenuInstallFtpOptions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -74,42 +75,42 @@ first character of the option name you're interested in. Invoke an\n\
option by pressing enter. If you'd like a shell, press ESC", /* prompt */
"Press F1 for usage instructions", /* help line */
"usage.hlp", /* help file */
-{ { "Usage", "Quick start - How to use this menu system.", /* U */
+ { { "Usage", "Quick start - How to use this menu system.", /* U */
DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0, 0 },
- { "Doc", "More detailed documentation on FreeBSD.", /* D */
+ { "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0, 0 },
- { "Lang", "Select natural language options.", /* L */
- DMENU_SUBMENU, (void *)&MenuLanguage, 0, 0 },
- { "Install", "Begin installation", /* I */
+ { "Options", "Select options for this utility.", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0 },
+ { "Install", "Begin installation", /* I */
DMENU_CALL, (void *)installCustom, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main documentation menu */
DMenu MenuDocumentation = {
-DMENU_NORMAL_TYPE,
-"Documentation for FreeBSD 2.0.5", /* Title */
-"If you are at all unsure about the configuration of your hardware\n\
+ DMENU_NORMAL_TYPE,
+ "Documentation for FreeBSD 2.0.5", /* Title */
+ "If you are at all unsure about the configuration of your hardware\n\
or are looking to build a system specifically for FreeBSD, read the\n\
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.",
-"Confused? Press F1 for help.",
-"usage.hlp", /* help file */
-{ { "README", "Read this for a general description of FreeBSD", /* R */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
+ { { "README", "Read this for a general description of FreeBSD", /* R */
DMENU_DISPLAY_FILE, (void *)"README", 0, 0 },
- { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
+ { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0, 0 },
- { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
+ { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
DMENU_DISPLAY_FILE, (void *)"install.hlp", 0, 0 },
- { "Copyright", "The FreeBSD Copyright notices.", /* C */
+ { "Copyright", "The FreeBSD Copyright notices.", /* C */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "Release", "The release notes for this version of FreeBSD.", /* R */
+ { "Release", "The release notes for this version of FreeBSD.", /* R */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
+ { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0, 0 },
- { NULL } },
+ { NULL } },
};
/*
@@ -119,451 +120,457 @@ answers in the FAQ.",
* name starts with `*', it's considered to be "ON" by default,
* otherwise off.
*/
-DMenu MenuLanguage = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Natural language selection", /* title */
-"Please specify the language you'd like to use by default.\n\n\
+DMenu MenuOptionsLanguage = {
+ DMENU_NORMAL_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 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. This feature is nonetheless considered\n\
to be in experimental status at this time.", /* prompt */
-"Press F1 for more information", /* help line */
-"language.hlp", /* help file */
-{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
+ "Press F1 for more information", /* help line */
+ "language.hlp", /* help file */
+ { { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Danish, 0, 0 },
- { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Dutch, 0, 0 },
- { "English", "English language (system default)", /* E */
+ { "English", "English language (system default)", /* E */
DMENU_CALL, (void *)lang_set_English, 0, 0 },
- { "French", "French language and character set (ISO-8859-1)", /* F */
+ { "French", "French language and character set (ISO-8859-1)", /* F */
DMENU_CALL, (void *)lang_set_French, 0, 0 },
- { "German", "German language and character set (ISO-8859-1)", /* G */
+ { "German", "German language and character set (ISO-8859-1)", /* G */
DMENU_CALL, (void *)lang_set_German, 0, 0 },
- { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
DMENU_CALL, (void *)lang_set_Italian, 0, 0 },
- { "Japanese", "Japanese language and default character set (romaji)",/* J */
+ { "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0, 0 },
- { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
DMENU_CALL, (void *)lang_set_Norwegian, 0, 0 },
- { "Russian", "Russian language and character set (cp866-8x14)", /* R */
+ { "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0, 0 },
- { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Spanish, 0, 0 },
- { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
+ { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Swedish, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaCDROM = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose a CDROM type",
-"FreeBSD can be installed directly from a CDROM containing a valid\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose a CDROM type",
+ "FreeBSD can be installed directly from a CDROM containing a valid\n\
FreeBSD 2.0.5 distribution. If you're seeing this menu, it's because\n\
your CDROM drive was not properly auto-detected, or you did not launch\n\
this installation from the CD under DOS or Windows. If you think you are\n
seeing this dialog in error, you may wish to reboot FreeBSD with the\n\
-c boot flag (.. boot: /kernel -c) and check that your hardware and\n\
the kernel agree on reasonable values.",
-"Press F1 for more information on CDROM support",
-"media_cdrom.hlp",
-{ { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
+ "Press F1 for more information on CDROM support",
+ "media_cdrom.hlp",
+ { { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/matcd0a", 0, 0 },
- { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
+ { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/mcd0a", 0, 0 },
- { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
+ { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/cd0a", 0, 0 },
- { "Sony", "Sony CDU31/33A or compatible CDROM drive",
+ { "Sony", "Sony CDU31/33A or compatible CDROM drive",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/scd0a", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaFTP = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Please specify an FTP site",
-"FreeBSD is distributed from a number of sites on the Internet.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Please specify an FTP site",
+ "FreeBSD is distributed from a number of sites on the Internet.\n\
Please select the site closest to you or \"other\" if you'd like\n\
to specify another choice. Also note that not all sites carry\n\
every possible distribution! Distributions other than the basic\n\
binary set are only guaranteed to be available from the Primary site.\n\
If the first site selected doesn't respond, try one of the alternates.",
-"Select a site that's close!",
-"media_ftp.hlp",
-{ { "Primary", "ftp.freebsd.org",
+ "Select a site that's close!",
+ "media_ftp.hlp",
+ { { "Primary", "ftp.freebsd.org",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.freebsd.org/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Secondary", "freefall.cdrom.com",
+ { "Secondary", "freefall.cdrom.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://freefall.cdrom.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Australia", "ftp.physics.usyd.edu.au",
+ { "Australia", "ftp.physics.usyd.edu.au",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.physics.usyd.edu.au/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Finland", "nic.funet.fi",
+ { "Finland", "nic.funet.fi",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://nic.funet.fi/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "France", "ftp.ibp.fr",
+ { "France", "ftp.ibp.fr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ibp.fr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Germany", "ftp.uni-duisburg.de",
+ { "Germany", "ftp.uni-duisburg.de",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.uni-duisburg.de/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Israel", "orgchem.weizmann.ac.il",
+ { "Israel", "orgchem.weizmann.ac.il",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://orgchem.weizmann.ac.il/pub/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan", "ftp.sra.co.jp",
+ { "Japan", "ftp.sra.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.sra.co.jp/pub/os/FreeBSD/distribution/2.0.5-ALPHA", 0, 0 },
- { "Japan-2", "ftp.mei.co.jp",
+ { "Japan-2", "ftp.mei.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-3", "ftp.waseda.ac.jp",
+ { "Japan-3", "ftp.waseda.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.waseda.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-4", "ftp.pu-toyama.ac.jp",
+ { "Japan-4", "ftp.pu-toyama.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-5", "ftpsv1.u-aizu.ac.jp",
+ { "Japan-5", "ftpsv1.u-aizu.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-6", "tutserver.tutcc.tut.ac.jp",
+ { "Japan-6", "tutserver.tutcc.tut.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://tutserver.tutcc.tut.ac.jp/FreeBSD/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan-7", "ftp.ee.uec.ac.jp",
+ { "Japan-7", "ftp.ee.uec.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Korea", "ftp.cau.ac.kr",
+ { "Korea", "ftp.cau.ac.kr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.cau.ac.kr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Netherlands", "ftp.nl.net",
+ { "Netherlands", "ftp.nl.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nl.net/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Russia", "ftp.kiae.su",
+ { "Russia", "ftp.kiae.su",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.kiae.su/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Sweden", "ftp.luth.se",
+ { "Sweden", "ftp.luth.se",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.luth.se/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Taiwan", "netbsd.csie.nctu.edu.tw",
+ { "Taiwan", "netbsd.csie.nctu.edu.tw",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Thailand", "ftp.nectec.or.th",
+ { "Thailand", "ftp.nectec.or.th",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nectec.or.th/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK", "ftp.demon.co.uk",
+ { "UK", "ftp.demon.co.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-2", "src.doc.ic.ac.uk",
+ { "UK-2", "src.doc.ic.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-3", "unix.hensa.ac.uk",
+ { "UK-3", "unix.hensa.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA", "ref.tfs.com",
+ { "USA", "ref.tfs.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ref.tfs.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-2", "ftp.dataplex.net",
+ { "USA-2", "ftp.dataplex.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.dataplex.net/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-3", "kryten.atinc.com",
+ { "USA-3", "kryten.atinc.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://kryten.atinc.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-4", "ftp.neosoft.com",
+ { "USA-4", "ftp.neosoft.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.neosoft.com/systems/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { NULL } }
+ { NULL } }
};
/* The media selection menu */
DMenu MenuMedia = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Media",
-"FreeBSD can be installed from a variety of different installation\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Media",
+ "FreeBSD can be installed from a variety of different installation\n\
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.",
-"Press F1 for more information on the various media types",
-"media.hlp",
-{ { "CDROM", "Install from a FreeBSD CDROM",
+ "Press F1 for more information on the various media types",
+ "media.hlp",
+ { { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0, 0 },
- { "Floppy", "Install from a floppy disk set",
+ { "Floppy", "Install from a floppy disk set",
DMENU_CALL, (void *)mediaSetFloppy, 0, 0 },
- { "DOS", "Install from a DOS partition",
+ { "DOS", "Install from a DOS partition",
DMENU_CALL, (void *)mediaSetDOS, 0, 0 },
- { "Tape", "Install from SCSI or QIC tape",
+ { "Tape", "Install from SCSI or QIC tape",
DMENU_CALL, (void *)mediaSetTape, 0, 0 },
- { "FTP", "Install from an Internet FTP server",
+ { "FTP", "Install from an Internet FTP server",
DMENU_CALL, (void *)mediaSetFTP, 0, 0 },
- { "File System", "Install from a UFS or NFS mounted distribution",
+ { "File System", "Install from a UFS or NFS mounted distribution",
DMENU_CALL, (void *)mediaSetFS, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The installation type menu */
DMenu MenuInstallType = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Type",
-"As a convenience, we provide several `canned' installation types.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Type",
+ "As a convenience, we provide several `canned' installation types.\n\
These pick what we consider to be the most reasonable defaults for the\n\
type of system in question. If you would prefer to pick and choose\n\
the list of distributions yourself, simply select `custom'.",
-"Press F1 for more information on the various distributions",
-"dist_types.hlp",
-{ { "Developer", "Includes full sources, binaries and doc but no games.",
+ "Press F1 for more information on the various distributions",
+ "dist_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
DMENU_CALL, (void *)distSetDeveloper, 0, 0 },
- { "X-Developer", "Same as above, but includes XFree86.",
+ { "X-Developer", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXDeveloper, 0, 0 },
- { "User", "General user. Binaries and doc but no sources.",
+ { "User", "General user. Binaries and doc but no sources.",
DMENU_CALL, (void *)distSetUser, 0, 0 },
- { "X-User", "Same as above, but includes XFree86.",
+ { "X-User", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXUser, 0, 0 },
- { "Minimal", "The smallest configuration possible.",
+ { "Minimal", "The smallest configuration possible.",
DMENU_CALL, (void *)distSetMinimum, 0, 0 },
- { "Everything", "The entire source and binary distribution.",
+ { "Everything", "The entire source and binary distribution.",
DMENU_CALL, (void *)distSetEverything, 0, 0 },
- { "Custom", "Specify your own distribution set",
+ { "Custom", "Specify your own distribution set",
DMENU_SUBMENU, (void *)&MenuDistributions, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"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_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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_SET_FLAG, (void *)&Dists, DIST_BIN, 0 },
- { "commercial", "Commercial demos and shareware",
+ { "commercial", "Commercial demos and shareware",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMMERCIAL, 0 },
- { "compat1x", "FreeBSD 1.x binary compatability package",
+ { "compat1x", "FreeBSD 1.x binary compatability package",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMPAT1X, 0 },
- { "DES", "DES encryption code and sources",
+ { "DES", "DES encryption code and sources",
DMENU_SET_FLAG, (void *)&Dists, DIST_DES, 0 },
- { "dict", "Spelling checker disctionary files",
+ { "dict", "Spelling checker disctionary files",
DMENU_SET_FLAG, (void *)&Dists, DIST_DICT, 0 },
- { "games", "Games and other amusements (non-commercial)",
+ { "games", "Games and other amusements (non-commercial)",
DMENU_SET_FLAG, (void *)&Dists, DIST_GAMES, 0 },
- { "info", "GNU info files",
+ { "info", "GNU info files",
DMENU_SET_FLAG, (void *)&Dists, DIST_INFO, 0 },
- { "*man", "System manual pages - strongly recommended",
+ { "*man", "System manual pages - strongly recommended",
DMENU_SET_FLAG, (void *)&Dists, DIST_MANPAGES, 0 },
- { "proflibs", "Profiled versions of the libraries",
+ { "proflibs", "Profiled versions of the libraries",
DMENU_SET_FLAG, (void *)&Dists, DIST_PROFLIBS, 0 },
- { "src", "Sources for everything but DES",
+ { "src", "Sources for everything but DES",
DMENU_CALL, (void *)distSetSrc, 0 },
- { "XFree86", "The XFree86 3.1.1L distribution",
+ { "XFree86", "The XFree86 3.1.1L distribution",
DMENU_SUBMENU, (void *)&MenuXF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuSrcDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select the sub-components of src you wish to install.",
-"Please check off those portions of the FreeBSD source tree\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Select the sub-components of src you wish to install.",
+ "Please check off those portions of the FreeBSD source tree\n\
you wish to install. A brief description of each source\n\
hierarchy is contained in parenthesis below.",
-"Press F1 for a more complete description of distributions.",
-"distribution_types.hlp",
-{ { "base", "Base src directory (top-level files in /usr/src)",
+ "Press F1 for a more complete description of distributions.",
+ "distribution_types.hlp",
+ { { "base", "Base src directory (top-level files in /usr/src)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_BASE, 0 },
- { "gnu", "/usr/src/gnu (user software from the GNU Project)",
+ { "gnu", "/usr/src/gnu (user software from the GNU Project)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GNU, 0 },
- { "etc", "/usr/src/etc (miscellaneous system files)",
+ { "etc", "/usr/src/etc (miscellaneous system files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_ETC, 0 },
- { "games", "/usr/src/games (games)",
+ { "games", "/usr/src/games (games)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GAMES, 0 },
- { "include", "/usr/src/include (header files)",
+ { "include", "/usr/src/include (header files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_INCLUDE, 0 },
- { "lib", "/usr/src/lib (system libraries)",
+ { "lib", "/usr/src/lib (system libraries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIB, 0 },
- { "libexec", "/usr/src/libexec (various system programs)",
+ { "libexec", "/usr/src/libexec (various system programs)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIBEXEC, 0 },
- { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
+ { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LKM, 0 },
- { "release", "/usr/src/release (release-generation tools)",
+ { "release", "/usr/src/release (release-generation tools)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_RELEASE, 0 },
- { "sbin", "/usr/src/sbin (system binaries)",
+ { "sbin", "/usr/src/sbin (system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SBIN, 0 },
- { "share", "/usr/src/share (documents and shared files)",
+ { "share", "/usr/src/share (documents and shared files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SHARE, 0 },
- { "sys", "/usr/src/sys (FreeBSD kernel)",
+ { "sys", "/usr/src/sys (FreeBSD kernel)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SYS, 0 },
- { "ubin", "/usr/src/usr.bin (user binaries)",
+ { "ubin", "/usr/src/usr.bin (user binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_UBIN, 0 },
- { "usbin", "/usr/src/usr.sbin (aux system binaries)",
+ { "usbin", "/usr/src/usr.sbin (aux system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_USBIN, 0 },
- { "XFree86", "XFree86 3.1.1L source + contrib distribution",
+ { "XFree86", "XFree86 3.1.1L source + contrib distribution",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_XF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86 = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
Project, Inc. Our recommended sequence is to Select the desired\n\
release components, Configure XFree86 and then (optionally)\n\
Start it up!",
-"Press F1 to read the XFree86 release notes for FreeBSD",
-"XFree86.hlp",
-{ { "Select", "Select and load components of the XFree86 distribution",
+ "Press F1 to read the XFree86 release notes for FreeBSD",
+ "XFree86.hlp",
+ { { "Select", "Select and load components of the XFree86 distribution",
DMENU_SUBMENU, &MenuXF86Select, 0, 0 },
- { "Configure", "Configure an installed XFree86 distribution",
+ { "Configure", "Configure an installed XFree86 distribution",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config",
0, 0 },
- { "Start", "Try to start the server up",
+ { "Start", "Try to start the server up",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin startx",
0, 0 },
- { NULL } }
+ { NULL } }
};
DMenu MenuXF86Select = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Please select the components you need from the XFree86 3.1.1u1\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Please select the components you need from the XFree86 3.1.1u1\n\
distribution. Select what you need from the basic components set\n\
and at least one entry from the Server menu and the Font set menu\n",
-"Press F1 for a sample sequence",
-"XF86Select.hlp",
-{ { "Core", "Basic component menu (required)",
+ "Press F1 for a sample sequence",
+ "XF86Select.hlp",
+ { { "Core", "Basic component menu (required)",
DMENU_SUBMENU, &MenuXF86SelectCore, 0, 0 },
- { "Server", "X server menu",
+ { "Server", "X server menu",
DMENU_SUBMENU, &MenuXF86SelectServer, 0, 0 },
- { "Fonts", "Font set menu",
+ { "Fonts", "Font set menu",
DMENU_SUBMENU, &MenuXF86SelectFonts, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectCore = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"XFree86 3.1.1 base distribution types",
-"Please check off the basic XFree86 components you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "XFree86 3.1.1 base distribution types",
+ "Please check off the basic XFree86 components you wish to install.\n\
Those deemed most generally useful are already checked off for you.",
-NULL,
-NULL,
-{ { "*bin", "X client applications and shared libs [4MB].",
+ NULL,
+ NULL,
+ { { "*bin", "X client applications and shared libs [4MB].",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_BIN, 0 },
- { "*lib", "Data files needed at runtime [0.6MB]",
+ { "*lib", "Data files needed at runtime [0.6MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LIB, 0 },
- { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
+ { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XINIT, 0 },
- { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
+ { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XDMCF, 0 },
- { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
+ { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_DOC, 0 },
- { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
+ { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_MAN, 0 },
- { "prog", "Programmer's header and library files [4MB]",
+ { "prog", "Programmer's header and library files [4MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PROG, 0 },
- { "link", "X Server reconfiguration kit [7.8MB]",
+ { "link", "X Server reconfiguration kit [7.8MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LINK, 0 },
- { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
+ { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PEX, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectFonts = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Font distribution selection.",
-"Please check off the individual font distributions you wish to\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Font distribution selection.",
+ "Please check off the individual font distributions you wish to\n\
install. At the minimum, you should certainly install the standard\n\
75 DPI and misc fonts if you're also installing a server.",
-NULL,
-NULL,
-{ { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
+ NULL,
+ NULL,
+ { { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_MISC, 0 },
- { "f100", "100 DPI fonts [1.8MB]",
+ { "f100", "100 DPI fonts [1.8MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_100, 0 },
- { "fscl", "Speedo and Type scalable fonts [1.6MB]",
+ { "fscl", "Speedo and Type scalable fonts [1.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SCALE, 0 },
- { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
+ { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_NON, 0 },
- { "server", "Font server [0.3MB]",
+ { "server", "Font server [0.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SERVER, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectServer = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"X Server selection.",
-"Please check off the types of X servers you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "X Server selection.",
+ "Please check off the types of X servers you wish to install.\n\
If you are unsure as which server will work for your graphics card,\n\
it is recommended that try the SVGA or VGA16 servers (the VGA16 and\n\
Mono servers are also particularly well-suited to most LCD displays).",
-"xservers.hlp",
-"Press F1 for more information on the various X server types",
-{ { "*SVGA", "Standard VGA or Super VGA display",
+ "xservers.hlp",
+ "Press F1 for more information on the various X server types",
+ { { "*SVGA", "Standard VGA or Super VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_SVGA, 0 },
- { "VGA16", "Standard 16 color VGA display",
+ { "VGA16", "Standard 16 color VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_VGA16, 0 },
- { "Mono", "Standard Monochrome display",
+ { "Mono", "Standard Monochrome display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MONO, 0 },
- { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
+ { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_8514, 0 },
- { "AGX", "8-bit AGX card",
+ { "AGX", "8-bit AGX card",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_AGX, 0 },
- { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
+ { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH32, 0 },
- { "Mch8", "8-bit ATI Mach8 card.",
+ { "Mch8", "8-bit ATI Mach8 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH8, 0 },
- { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
+ { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_P9000, 0 },
- { "S3", "8, 16 and 24-bit color for S3 based boards",
+ { "S3", "8, 16 and 24-bit color for S3 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_S3, 0 },
- { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
+ { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_W32, 0 },
- { "nest", "A nested server for testing purposes",
+ { "nest", "A nested server for testing purposes",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_NEST, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDiskDevices = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select Drive(s)",
-"Please select the drive, or drives, on which you wish to install\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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', or have multiple operating\n\
systems on your machine, you will have the option to install a boot\n\
manager later.",
-"Press F1 for more information on what you see here.",
-"drives.hlp",
-{ { NULL } },
+ "Press F1 for more information on what you see here.",
+ "drives.hlp",
+ { { NULL } },
};
/* The installation options menu */
-DMenu MenuInstallOptions = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options",
-"This menu controls how the FreeBSD installation will deal with various\n\
+DMenu MenuOptions = {
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options",
+ "This menu controls how the FreeBSD installation will deal with various\n\
error conditions, should they arise, and the degree to which you, the\n\
user, will be prompted for options.",
-NULL,
-NULL,
-{ { "Ftp Options", "Ftp options menu",
- DMENU_SUBMENU, (void *)&MenuInstallFtpOptions, 0, 0 },
- { "NFS Secure", "NFS server talks only on a secure port",
+ NULL,
+ NULL,
+ { { "Ftp Options", "Ftp options menu",
+ DMENU_SUBMENU, (void *)&MenuOptionsFtp, 0, 0 },
+ { "Language", "Select your preferred language",
+ DMENU_SUBMENU, (void *)&MenuOptionsLanguage, 0, 0 }
+ { "NFS Secure", "NFS server talks only on a secure port",
DMENU_SET_VARIABLE, (void *)"nfsServerSecure=yes", 0, 0 },
- { "NFS Slow", "User is using a slow PC or ethernet card",
+ { "NFS Slow", "User is using a slow PC or ethernet card",
DMENU_SET_VARIABLE, (void *)"nfsSlowPC=yes", 0, 0 },
- { "Extra Debugging", "Toggle the extra debugging flag",
+ { "Extra Debugging", "Toggle the extra debugging flag",
DMENU_SET_VARIABLE, (void *)"debug=yes", 0, 0 },
- { "No Debugging", "Turn the extra debugging flag off",
+ { "No Debugging", "Turn the extra debugging flag off",
DMENU_SET_VARIABLE, (void *)"debug=no", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuInstallFtpOptions = {
-DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Ftp Options",
-"In case of ftp failure, how would you like this installation\n\
+ DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Ftp Options",
+ "In case of ftp failure, how would you like this installation\n\
to deal with it? You have one of several choices:",
-NULL,
-NULL,
-{ { "*Ftp Retry", "On transfer failure, retry same host",
+ NULL,
+ NULL,
+ { { "*Ftp Retry", "On transfer failure, retry same host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=loop", 0, 0 },
- { "Ftp Reselect", "On transfer failure, ask for another host",
+ { "Ftp Reselect", "On transfer failure, ask for another host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=reselect", 0, 0 },
- { "Ftp Abort", "On transfer failure, abort installation",
+ { "Ftp Abort", "On transfer failure, abort installation",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=abort", 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main installation menu */
DMenu MenuInstall = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options", /* title */
-"Before installation can continue, you need to specify a few items\n\
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options", /* title */
+ "Before installation can continue, you need to specify a few items\n\
of information regarding the type of distribution you wish to have\n\
and from where you wish to install it. There are also a number\n\
of options you can specify in the Options menu which will determine\n\
-how . If you do not wish to install FreeBSD at this time, you may\n\
+how. You may choose install FreeBSD at this time, you may\n\
select Cancel to leave this menu.",
-"You may also wish to read the install guide - press F1 to do so",
-"install.hlp",
-{ { "Media", "Choose Installation media type", /* M */
- DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
- { "Type", "Choose the type of installation you want", /* T */
+ "You may also wish to read the install guide - press F1 to do so",
+ "install.hlp",
+ { { "Distributions", "Choose the type of installation you want", /* T */
DMENU_SUBMENU, (void *)&MenuInstallType, 0, 0 },
- { "Options", "Specify installation options", /* O */
- DMENU_SUBMENU, (void *)&MenuInstallOptions, 0, 0},
- { "Proceed", "Proceed with installation", /* P */
+ { "Media", "Choose the installation media type", /* M */
+ DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
+ { "Partition", "Go to the Disk Partition Editor", /* P */
+ DMENU_CALL, (void *)diskPartitionEditor, 0, 0 },
+ { "Label", "Label the contents of disk partitions", /* L */
+ DMENU_CALL, (void *)diskLabelEditor, 0, 0 },
+ { "GO!", "Start the whole show and go out for coffee!", /* P */
DMENU_CANCEL, (void *)NULL, 0, 0 },
- { NULL } },
+ { "Options", "Set special installation options", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0},
+ { NULL } },
};
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index f71ea32..73579e3 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.14 1995/05/08 21:39:40 jkh Exp $
+ * $Id: sysinstall.h,v 1.15 1995/05/10 07:45:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,11 +66,33 @@
#define VAR_VALUE_MAX 1024
/* device limits */
-#define DEV_NAME_MAX 128
+#define DEV_NAME_MAX 128 /* The maximum length of a device name */
+#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
+#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
+
+
+/* Internal flag variables */
+#define DISK_PARTITIONED "_diskPartitioned"
+#define DISK_LABELLED "_diskLabelled"
+#define TCP_CONFIGURED "_tcpConfigured"
+#define NO_CONFIRMATION "_noConfirmation"
+#define MEDIA_DEVICE "mediaDevice"
+#define MEDIA_TYPE "mediaType"
+
+#define VAR_HOSTNAME "hostname"
+#define VAR_DOMAINNAME "domainname"
+#define VAR_IPADDR "ip_addr"
+#define VAR_NAMESERVER "nameserver"
+
+#define VAR_IFCONFIG_ARGS "if_flags"
+#define VAR_NETMASK "netmask"
+#define VAR_GATEWAY "gateway"
/*** Types ***/
typedef unsigned int Boolean;
+typedef struct disk Disk;
+typedef struct chunk Chunk;
typedef enum {
DMENU_SHELL_ESCAPE, /* Fork a shell */
@@ -117,8 +139,6 @@ typedef enum {
DEVICE_TYPE_NETWORK,
DEVICE_TYPE_CDROM,
DEVICE_TYPE_TAPE,
- DEVICE_TYPE_SERIAL,
- DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
@@ -126,6 +146,11 @@ typedef enum {
typedef struct _device {
char name[DEV_NAME_MAX];
DeviceType type;
+ Boolean enabled;
+ int (*deviceInit)(void);
+ int (*deviceGet)(char *fname);
+ int (*deviceClose)(void);
+ void *devicePrivate;
} Device;
/* Some internal representations of partitions */
@@ -133,7 +158,8 @@ typedef enum {
PART_NONE,
PART_SLICE,
PART_SWAP,
- PART_FILESYSTEM
+ PART_FILESYSTEM,
+ PART_FAT,
} PartType;
/* The longest newfs command we'll hand to system() */
@@ -145,6 +171,8 @@ typedef struct _part_info {
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;
+typedef int (*commandFunc)(char *key, void *data);
+
/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
@@ -161,7 +189,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists;/* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
-extern struct disk *Disks[]; /* The disks we're working on */
+extern Device *Devices[]; /* The devices we have to work with */
/*** Prototypes ***/
@@ -169,7 +197,8 @@ extern struct disk *Disks[]; /* The disks we're working on */
extern void command_clear(void);
extern void command_sort(void);
extern void command_execute(void);
-extern void command_add(char *key, char *fmt, ...);
+extern void command_shell_add(char *key, char *fmt, ...);
+extern void command_func_add(char *key, commandFunc func, void *data);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
@@ -177,17 +206,11 @@ extern Boolean dispatch(DMenuItem *tmp, char *name);
extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
/* devices.c */
-extern struct disk *device_slice_disk(struct disk *d);
-extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)());
+extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
+extern Device *deviceGetInfo(DeviceType which);
/* disks.c */
-extern void partition_disks(void);
-extern int write_disks(void);
-extern void make_filesystems(void);
-extern void cpio_extract(void);
-extern void extract_dists(void);
-extern void install_configuration_files(void);
-extern void do_final_setup(void);
+extern int diskPartitionEditor(Disk *disk);
/* dist.c */
extern int distSetDeveloper(char *str);
@@ -202,6 +225,7 @@ extern void distExtractAll(void);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
int *curr, int *max);
+extern void dmenuOpenSimple(DMenu *menu);
/* globals.c */
extern void globalsInit(void);
@@ -224,6 +248,9 @@ extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* label.c */
+extern void diskLabelEditor(char *str);
+
/* makedevs.c (auto-generated) */
extern const char termcap_vt100[];
extern const char termcap_cons25[];
@@ -294,7 +321,7 @@ extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
/* wizard.c */
-extern void slice_wizard(struct disk *d);
+extern void slice_wizard(Disk *d);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/usr.sbin/sade/wizard.c b/usr.sbin/sade/wizard.c
index 88fd33b..dda8b57 100644
--- a/usr.sbin/sade/wizard.c
+++ b/usr.sbin/sade/wizard.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: tst01.c,v 1.8 1995/05/01 04:05:26 phk Exp $
+ * $Id: wizard.c,v 1.1 1995/05/04 23:36:23 jkh Exp $
*
*/
@@ -20,246 +20,246 @@
#include "libdisk.h"
u_char mbr[] = {
-250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
-242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
-131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
-203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
-205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
-51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
-85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
-114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
-108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
-121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
-116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
-1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
-208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,85,170
+ 250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
+ 242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
+ 131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
+ 203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
+ 205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
+ 51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
+ 85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
+ 114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
+ 108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
+ 121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
+ 116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
+ 1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
+ 208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,85,170
};
u_char bteasy17[] = {
-51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
-165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
-4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
-232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
-85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
-179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
-60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
-10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
-7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
-42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
-0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
-243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
-36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
-50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
-160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
-160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
-36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
-211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
-76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
-216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,85,170
+ 51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
+ 165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
+ 4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
+ 232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
+ 85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
+ 179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
+ 60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
+ 10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
+ 7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
+ 42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
+ 0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
+ 243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
+ 36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
+ 50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
+ 160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
+ 160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
+ 36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
+ 211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
+ 76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
+ 216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,85,170
};
int
scan_block(int fd, daddr_t block)
{
- u_char foo[512];
+ u_char foo[512];
- if (-1 == lseek(fd,block * 512,SEEK_SET))
- err(1,"lseek");
- if (512 != read(fd,foo, 512))
- return 1;
- return 0;
+ if (-1 == lseek(fd,block * 512,SEEK_SET))
+ err(1,"lseek");
+ if (512 != read(fd,foo, 512))
+ return 1;
+ return 0;
}
void
Scan_Disk(struct disk *d)
{
- char device[64];
- u_long l;
- int i,j,fd;
-
- strcpy(device,"/dev/r");
- strcat(device,d->name);
-
- fd = open(device,O_RDWR);
- if (fd < 0) {
- warn("open(%s) failed",device);
- return;
- }
- for(i=-1,l=0;;l++) {
- j = scan_block(fd,l);
- if (j != i) {
- if (i == -1) {
- printf("%c: %lu.",j ? 'B' : 'G', l);
- fflush(stdout);
- } else if (i == 0) {
- printf(".%lu\nB: %lu.",l-1,l);
- fflush(stdout);
- } else {
- printf(".%lu\nG: %lu.",l-1,l);
- fflush(stdout);
- }
- i = j;
- }
- }
- close(fd);
+ char device[64];
+ u_long l;
+ int i,j,fd;
+
+ strcpy(device,"/dev/r");
+ strcat(device,d->name);
+
+ fd = open(device,O_RDWR);
+ if (fd < 0) {
+ msgWarn("open(%s) failed", device);
+ return;
+ }
+ for(i=-1,l=0;;l++) {
+ j = scan_block(fd,l);
+ if (j != i) {
+ if (i == -1) {
+ printf("%c: %lu.",j ? 'B' : 'G', l);
+ fflush(stdout);
+ } else if (i == 0) {
+ printf(".%lu\nB: %lu.",l-1,l);
+ fflush(stdout);
+ } else {
+ printf(".%lu\nG: %lu.",l-1,l);
+ fflush(stdout);
+ }
+ i = j;
+ }
+ }
+ close(fd);
}
void
slice_wizard(struct disk *d)
{
- struct disk *db;
- char myprompt[BUFSIZ];
- char input[BUFSIZ];
- char *p,*q=0;
- char **cp,*cmds[200];
- int ncmd,i;
-
- sprintf(myprompt,"%s> ", d->name);
- while(1) {
- printf("--==##==--\n");
- Debug_Disk(d);
- p = CheckRules(d);
- if (p) {
- printf("%s",p);
- free(p);
- }
- printf(myprompt);
- fflush(stdout);
- q = p = fgets(input,sizeof(input),stdin);
- if(!p)
- break;
- for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
- if (**cp != '\0')
- cp++;
- ncmd = cp - cmds;
- if(!ncmd)
- continue;
- if (!strcasecmp(*cmds,"quit")) { break; }
- if (!strcasecmp(*cmds,"exit")) { break; }
- if (!strcasecmp(*cmds,"q")) { break; }
- if (!strcasecmp(*cmds,"x")) { break; }
- if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
- printf("delete = %d\n",
- Delete_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"allfreebsd")) {
- All_FreeBSD(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
- Set_Bios_Geom(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
- d = Set_Phys_Geom(d,
+ struct disk *db;
+ char myprompt[BUFSIZ];
+ char input[BUFSIZ];
+ char *p,*q=0;
+ char **cp,*cmds[200];
+ int ncmd,i;
+
+ sprintf(myprompt,"%s> ", d->name);
+ while(1) {
+ printf("--==##==--\n");
+ Debug_Disk(d);
+ p = CheckRules(d);
+ if (p) {
+ printf("%s",p);
+ free(p);
+ }
+ printf(myprompt);
+ fflush(stdout);
+ q = p = fgets(input,sizeof(input),stdin);
+ if(!p)
+ break;
+ for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
+ if (**cp != '\0')
+ cp++;
+ ncmd = cp - cmds;
+ if(!ncmd)
+ continue;
+ if (!strcasecmp(*cmds,"quit")) { break; }
+ if (!strcasecmp(*cmds,"exit")) { break; }
+ if (!strcasecmp(*cmds,"q")) { break; }
+ if (!strcasecmp(*cmds,"x")) { break; }
+ if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
+ printf("delete = %d\n",
+ Delete_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"allfreebsd")) {
+ All_FreeBSD(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
+ Set_Bios_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
+ d = Set_Phys_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"collapse")) {
+ if (cmds[1])
+ while (Collapse_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)))
+ ;
+ else
+ Collapse_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"list")) {
+ cp = Disk_Names();
+ printf("Disks:");
+ for(i=0;cp[i];i++) {
+ printf(" %s",cp[i]);
+ free(cp[i]);
+ }
+ free(cp);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"create") && ncmd == 6) {
+
+ printf("Create=%d\n",
+ Create_Chunk(d,
strtol(cmds[1],0,0),
strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"collapse")) {
- if (cmds[1])
- while (Collapse_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)))
- ;
- else
- Collapse_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"list")) {
- cp = Disk_Names();
- printf("Disks:");
- for(i=0;cp[i];i++) {
- printf(" %s",cp[i]);
- free(cp[i]);
- }
- free(cp);
- continue;
- }
- if (!strcasecmp(*cmds,"create") && ncmd == 6) {
-
- printf("Create=%d\n",
- Create_Chunk(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0),
- strtol(cmds[4],0,0),
- strtol(cmds[5],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"read")) {
- db = d;
- if (ncmd > 1)
- d = Open_Disk(cmds[1]);
- else
- d = Open_Disk(d->name);
- if (d)
- Free_Disk(db);
- else
- d = db;
- continue;
- }
- if (!strcasecmp(*cmds,"scan")) {
- Scan_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bteasy")) {
- Set_Boot_Mgr(d,bteasy17);
- continue;
- }
- if (!strcasecmp(*cmds,"mbr")) {
- Set_Boot_Mgr(d,mbr);
- continue;
- }
- if (!strcasecmp(*cmds,"boot")) {
- extern u_char boot1[],boot2[];
- Set_Boot_Blocks(d,boot1,boot2);
- continue;
- }
- if (!strcasecmp(*cmds,"write")) {
- printf("Write=%d\n",
- Write_Disk(d));
- Free_Disk(d);
- d = Open_Disk(d->name);
- continue;
- }
- if (strcasecmp(*cmds,"help"))
- printf("\007ERROR\n");
- printf("CMDS:\n");
- printf("allfreebsd\t\t");
- printf("bios cyl hd sect\n");
- printf("boot\t\t");
- printf("bteasy17\n");
- printf("collapse [pointer]\t\t");
- printf("create offset size enum subtype flags\n");
- printf("subtype(part): swap=1, ffs=7\t\t");
- printf("delete pointer\n");
- printf("list\t\t");
- printf("mbr\n");
- printf("phys cyl hd sect\t\t");
- printf("quit\n");
- printf("read [disk]\t\t");
- printf("scan\n");
- printf("write\t\t");
- printf("ENUM:\n\t");
- for(i=0;chunk_n[i];i++)
- printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
- printf("\n");
-
+ strtol(cmds[3],0,0),
+ strtol(cmds[4],0,0),
+ strtol(cmds[5],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"read")) {
+ db = d;
+ if (ncmd > 1)
+ d = Open_Disk(cmds[1]);
+ else
+ d = Open_Disk(d->name);
+ if (d)
+ Free_Disk(db);
+ else
+ d = db;
+ continue;
+ }
+ if (!strcasecmp(*cmds,"scan")) {
+ Scan_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bteasy")) {
+ Set_Boot_Mgr(d,bteasy17);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"mbr")) {
+ Set_Boot_Mgr(d,mbr);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"boot")) {
+ extern u_char boot1[],boot2[];
+ Set_Boot_Blocks(d,boot1,boot2);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"write")) {
+ printf("Write=%d\n",
+ Write_Disk(d));
+ Free_Disk(d);
+ d = Open_Disk(d->name);
+ continue;
}
+ if (strcasecmp(*cmds,"help"))
+ printf("\007ERROR\n");
+ printf("CMDS:\n");
+ printf("allfreebsd\t\t");
+ printf("bios cyl hd sect\n");
+ printf("boot\t\t");
+ printf("bteasy17\n");
+ printf("collapse [pointer]\t\t");
+ printf("create offset size enum subtype flags\n");
+ printf("subtype(part): swap=1, ffs=7\t\t");
+ printf("delete pointer\n");
+ printf("list\t\t");
+ printf("mbr\n");
+ printf("phys cyl hd sect\t\t");
+ printf("quit\n");
+ printf("read [disk]\t\t");
+ printf("scan\n");
+ printf("write\t\t");
+ printf("ENUM:\n\t");
+ for(i=0;chunk_n[i];i++)
+ printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
+ printf("\n");
+
+ }
}
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index 24baf10..ad6e00b 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -8,7 +8,8 @@ SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
- disks.c command.c decode.c
+ disks.c command.c decode.c label.c \
+ tcpip.c
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
diff --git a/usr.sbin/sysinstall/command.c b/usr.sbin/sysinstall/command.c
index a143be0..5d59426 100644
--- a/usr.sbin/sysinstall/command.c
+++ b/usr.sbin/sysinstall/command.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: command.c,v 1.1 1995/05/08 06:08:27 jkh Exp $
+ * $Id: command.c,v 1.2 1995/05/11 09:01:24 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,7 +47,10 @@
typedef struct {
char key[FILENAME_MAX];
- char *cmds[MAX_NUM_COMMANDS];
+ struct {
+ enum { CMD_SHELL, CMD_FUNCTION } type;
+ void *ptr, *data;
+ } cmds[MAX_NUM_COMMANDS];
int ncmds;
} Command;
@@ -55,6 +58,7 @@ typedef struct {
static Command *commandStack[MAX_CMDS];
int numCommands;
+/* Nuke the command stack */
void
command_clear(void)
{
@@ -62,13 +66,15 @@ command_clear(void)
for (i = 0; i < numCommands; i++)
for (j = 0; j < commandStack[i]->ncmds; j++)
- free(commandStack[i]->cmds[j]);
+ if (commandStack[i]->cmds[j].type == CMD_SHELL)
+ free(commandStack[i]->cmds[j].ptr);
free(commandStack[i]);
numCommands = 0;
}
+/* Add a shell command under a given key */
void
-command_add(char *key, char *fmt, ...)
+command_shell_add(char *key, char *fmt, ...)
{
va_list args;
char *cmd;
@@ -82,22 +88,59 @@ command_add(char *key, char *fmt, ...)
/* First, look for the key already present and add a command to it */
for (i = 0; i < numCommands; i++) {
if (!strcmp(commandStack[i]->key, key)) {
- commandStack[i]->cmds[commandStack[i]->ncmds++] = cmd;
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
msgFatal("More than %d commands stacked up behind %s??",
MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_SHELL;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)cmd;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = NULL;
+ ++(commandStack[i]->ncmds);
return;
}
}
+ if (numCommands == MAX_CMDS)
+ msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
/* If we fell to here, it's a new key */
commandStack[numCommands] = safe_malloc(sizeof(Command));
strcpy(commandStack[numCommands]->key, key);
commandStack[numCommands]->ncmds = 1;
- commandStack[numCommands++]->cmds[0] = cmd;
+ commandStack[numCommands]->cmds[0].type = CMD_SHELL;
+ commandStack[numCommands]->cmds[0].ptr = (void *)cmd;
+ commandStack[numCommands]->cmds[0].data = NULL;
+}
+
+/* Add a shell command under a given key */
+void
+command_func_add(char *key, commandFunc func, void *data)
+{
+ int i;
+
+ /* First, look for the key already present and add a command to it */
+ for (i = 0; i < numCommands; i++) {
+ if (!strcmp(commandStack[i]->key, key)) {
+ if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
+ msgFatal("More than %d commands stacked up behind %s??",
+ MAX_NUM_COMMANDS, key);
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_FUNC;
+ commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)func;
+ commandStack[i]->cmds[commandStack[i]->ncmds].data = data;
+ ++(commandStack[i]->ncmds);
+ return;
+ }
+ }
if (numCommands == MAX_CMDS)
msgFatal("More than %d commands accumulated??", MAX_CMDS);
+
+ /* If we fell to here, it's a new key */
+ commandStack[numCommands] = safe_malloc(sizeof(Command));
+ strcpy(commandStack[numCommands]->key, key);
+ commandStack[numCommands]->ncmds = 1;
+ commandStack[numCommands]->cmds[0].type = CMD_FUNC;
+ commandStack[numCommands++]->cmds[0].ptr = (void *)func;
}
+/* arg to sort */
static int
sort_compare(const void *p1, const void *p2)
{
@@ -110,17 +153,30 @@ command_sort(void)
qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
}
+/* Run all accumulated commands in sorted order */
void
command_execute(void)
{
int i, j, ret;
+ commandFunc func;
for (i = 0; i < numCommands; i++) {
for (j = 0; j < commandStack[i]->ncmds; j++) {
- msgNotify("Executing command: %s", commandStack[i]->cmds[j]);
- ret = system(commandStack[i]->cmds[j]);
- msgDebug("Command: %s returns status %d\n",
- commandStack[i]->cmds[j], ret);
+ if (commandStack[i].type == CMD_SHELL) {
+ msgNotify("Executing command: %s",
+ commandStack[i]->cmds[j].ptr);
+ ret = system((char *)commandStack[i]->cmds[j].ptr);
+ msgDebug("Command `%s' returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
+ else {
+ func = (commandFunc)commandStack[i]->cmds.ptr;
+ msgNotify("Executing internal command @ %0x", func);
+ ret = (*func)(commandStack[i]->cmds.key,
+ commandStack[i]->cmds.data);
+ msgDebug("Function @ %x returns status %d\n",
+ commandStack[i]->cmds[j].ptr, ret);
+ }
}
}
}
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
index c1f4b94..aa63d8d 100644
--- a/usr.sbin/sysinstall/devices.c
+++ b/usr.sbin/sysinstall/devices.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: devices.c,v 1.13 1995/05/11 06:10:45 jkh Exp $
+ * $Id: devices.c,v 1.14 1995/05/11 06:47:42 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,324 +42,277 @@
*/
#include "sysinstall.h"
+
#include <sys/fcntl.h>
-#include <ctype.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <arpa/inet.h>
+
+#define NSIP
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#include <netdb.h>
+
+#define EON
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
+#include <sys/protosw.h>
-/* Where we start displaying chunk information on the screen */
-#define CHUNK_START_ROW 5
+#include <ctype.h>
-static char *cdrom_table[] = {
- "cd0a", "cd1a", /* SCSI */
- "mcd0a", "mcd1a", /* Mitsumi (old model) */
- "scd0a", "scd1a", /* Sony CDROM */
- "matcd0a", "matcd1a", /* Matsushita (SB) */
- NULL,
+static Device *Devices[DEV_MAX];
+static int numDevs;
+
+#define CHECK_DEVS \
+ if (numDevs == DEV_MAX) msgFatal("Too many devices found!")
+
+static struct {
+ DeviceType type;
+ char *name;
+ char *description;
+} device_names[] = {
+ { DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
+ { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
+ { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", }
+ { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
+ { DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ("sound blaster" type)" },
+ { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM ("sound blaster" type - 2nd unit)" },
+ { DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
+ { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
+ { DEVICE_TYPE_TAPE, "ft0", "Floppy tape drive (QIC-02)" },
+ { DEVICE_TYPE_TAPE, "wt0", "Wangtek tape drive" },
+ { DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
+ { DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
+ { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
+ { DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
+ { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" },
+ { DEVICE_TYPE_NETWORK, "tun", "Tunneling IP driver (not for direct use)" },
+ { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 cards" },
+ { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 interface card" },
+ { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 interface card" },
+ { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A Ethernet" },
+ { DEVICE_TYPE_NETWORK, "ie", "AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210" },
+ { DEVICE_TYPE_NETWORK, "le", "DEC EtherWorks 2 and 3" },
+ { DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL)" },
+ { DEVICE_TYPE_NETWORK, "ze", "IBM/National Semiconductor PCMCIA ethernet controller" },
+ { DEVICE_TYPE_NETWORK, "zp", "3Com PCMCIA Etherlink III" },
+ { NULL },
};
-/* Get all device information for a given device class */
static Device *
-device_get_all(DeviceType which, int *ndevs)
+new_device(char *name)
{
- 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;
- }
- free(names);
- }
- }
- if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
- char try[FILENAME_MAX];
- int i, fd;
-
- for (i = 0; cdrom_table[i]; i++) {
- snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
- fd = open(try, O_RDWR);
- if (fd > 0) {
- close(fd);
- devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
- strcpy(devs[*ndevs].name, cdrom_table[i]);
- devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
- break;
- }
- }
- }
- /* Terminate the devices array */
- devs[*ndevs].name[0] = '\0';
- return devs;
+ Device *dev;
+
+ dev = safe_malloc(sizeof(Device));
+ if (name)
+ strcpy(dev->name, name);
+ else
+ dev->name[0] = '\0';
+ return dev;
}
-static struct chunk *chunk_info[10];
-static int current_chunk;
-
-static void
-record_chunks(struct disk *d)
+static int
+deviceTry(char *name)
{
- struct chunk *c1;
- int i = 0;
- int last_free = 0;
- if (!d->chunks)
- msgFatal("No chunk list found for %s!", d->name);
- c1 = d->chunks->part;
- current_chunk = 0;
- while (c1) {
- if (c1->type == unused && c1->size > last_free) {
- last_free = c1->size;
- current_chunk = i;
- }
- chunk_info[i++] = c1;
- c1 = c1->next;
- }
- chunk_info[i] = NULL;
-}
-
-static void
-print_chunks(struct disk *d)
-{
- int row;
- int i;
-
- attrset(A_NORMAL);
- mvaddstr(0, 0, "Disk name:\t");
- attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
- attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
- mvprintw(1, 0,
- "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
- "Offset", "Size", "End", "Name", "PType", "Desc",
- "Subtype", "Flags");
- for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
- if (i == current_chunk)
- attrset(A_REVERSE);
- mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
- chunk_info[i]->offset, chunk_info[i]->size,
- chunk_info[i]->end, chunk_info[i]->name,
- chunk_info[i]->type, chunk_n[chunk_info[i]->type],
- chunk_info[i]->subtype, chunk_info[i]->flags);
- if (i == current_chunk)
- attrset(A_NORMAL);
- }
+ char try[FILENAME_MAX];
+
+ snprintf(try, FILENAME_MAX, "/dev/%s", name);
+ fd = open(try, O_RDWR);
+ if (fd > 0)
+ return fd;
+ snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
+ fd = open(try, O_RDWR);
+ return fd;
}
static void
-print_command_summary()
+deviceDiskFree(Device *dev)
{
- mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
- mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
- mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
- mvprintw(20, 0, "The currently selected partition is displayed in ");
- attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
- mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
- move(0, 0);
+ Disk_Close(dev->private);
}
-struct disk *
-device_slice_disk(struct disk *d)
+/* Get all device information for devices we have attached */
+void
+deviceGetAll(Boolean disksOnly)
{
- char *p;
- int key = 0;
- Boolean chunking;
- char *msg = NULL;
- char name[40];
+ int i, fd, s;
+ struct ifconf ifc;
+ struct ifreq *ifptr, *end;
+ int ifflags, selectflag = -1;
+ char buffer[INTERFACES_MAX * sizeof(struct ifreq)];
- dialog_clear();
- chunking = TRUE;
- strncpy(name, d->name, 40);
- keypad(stdscr, TRUE);
+ /* We do this at the very beginning */
+ if (disksOnly) {
+ char **names = Disk_names();
- record_chunks(d);
- while (chunking) {
- clear();
- print_chunks(d);
- print_command_summary();
- if (msg) {
- standout(); mvprintw(23, 0, msg); standend();
- beep();
- msg = NULL;
+ if (names) {
+ int i;
+
+ for (i = 0; names[i]; i++) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_device(names[i]);
+ Devices[numDevs]->type = DEVICE_TYPE_DISK;
+ Devices[numDevs]->ignore = TRUE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaUFSGet;
+ Devices[numDevs]->close = deviceDiskFree;
+ Devices[numDevs]->private = Open_Disk(names[i]);
+ if (!Devices[numDevs]->private)
+ msgFatal("Unable to open device for %s!", names[i]);
+ msgDebug("Found a device of type disk named: %s\n",
+ names[i]);
+ ++numDevs;
+ }
+ free(names);
}
- refresh();
-
- key = toupper(getch());
- switch (key) {
- case KEY_UP:
- case '-':
- if (current_chunk != 0)
- --current_chunk;
- break;
-
- case KEY_DOWN:
- case '+':
- case '\r':
- case '\n':
- if (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_HOME:
- current_chunk = 0;
- break;
-
- case KEY_END:
- while (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_F(1):
- case '?':
- systemDisplayFile("slice.hlp");
- break;
-
- case 'A':
- All_FreeBSD(d);
- record_chunks(d);
- break;
-
- case 'B':
- if (chunk_info[current_chunk]->type != freebsd)
- msg = "Can only scan for bad blocks in FreeBSD partition.";
- else if (strncmp(name, "sd", 2) ||
- !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
- chunk_info[current_chunk]->flags |= CHUNK_BAD144;
- break;
-
- case 'C':
- if (chunk_info[current_chunk]->type != unused)
- msg = "Partition in use, delete it first or move to an unused one.";
- else {
- char *val, tmp[20];
- int size;
+ return;
+ }
- snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
- val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
- if (val && (size = strtol(val, 0, 0)) > 0) {
- Create_Chunk(d, chunk_info[current_chunk]->offset,
- size,
- freebsd,
- 3,
- (chunk_info[current_chunk]->flags &
- CHUNK_ALIGN));
- record_chunks(d);
- }
+ /*
+ * Try to get all the types of devices it makes sense to get at the
+ * second stage of the installation.
+ */
+ for (i = 0; device_names[i].name; i++) {
+ switch(device_names[i].type) {
+ case DEVICE_TYPE_CDROM:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_CDROM;
+ Devices[numDevs]->description = devices_names[i].description;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = NULL;
+ Devices[numDevs]->get = mediaCDROMGet;
+ Devices[numDevs]->close = NULL;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type CDROM named: %s\n",
+ cdrom_table[i]);
+ ++numDevs;
}
break;
- case 'D':
- if (chunk_info[current_chunk]->type == unused)
- msg = "Partition is already unused!";
- else {
- Delete_Chunk(d, chunk_info[current_chunk]);
- record_chunks(d);
+ case DEVICE_TYPE_TAPE:
+ fd = deviceTry(device_names[i].name);
+ if (fd > 0) {
+ close(fd);
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(device_names[i].name);
+ Devices[numDevs]->type = DEVICE_TYPE_TAPE;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaTapeInit;
+ Devices[numDevs]->get = mediaTapeGet;
+ Devices[numDevs]->close = mediaTapeClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type TAPE named: %s\n",
+ tape_table[i]);
+ ++numDevs;
}
break;
-
- case 'G': {
- char *val, geometry[80];
-
- snprintf(geometry, 80, "%lu/%lu/%lu",
- d->bios_cyl, d->bios_hd, d->bios_sect);
- val = msgGetInput(geometry,
-"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
- if (val) {
- d->bios_cyl = strtol(val, &val, 0);
- d->bios_hd = strtol(val + 1, &val, 0);
- d->bios_sect = strtol(val + 1, 0, 0);
- }
}
- break;
-
- case 'S':
- /* Set Bootable */
- chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
- break;
-
- case 'U':
- Free_Disk(d);
- d = Open_Disk(name);
- if (!d)
- msgFatal("Can't reopen disk %s!", name);
- record_chunks(d);
- break;
-
- case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
- clear();
- dialog_clear();
- end_dialog();
- DialogActive = FALSE;
- slice_wizard(d);
- clear();
- dialog_clear();
- DialogActive = TRUE;
- record_chunks(d);
- }
- else
- msg = "Wise choice!";
- break;
-
- case 27: /* ESC */
- chunking = FALSE;
- break;
+ }
- default:
- beep();
- msg = "Type F1 or ? for help";
- break;
+ /*
+ * Now go for the network interfaces dynamically. Stolen shamelessly
+ * from ifconfig!
+ */
+ ifc.ifc_len = sizeof(buffer);
+ ifc.ifc_buf = buffer;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ msgConfirm("ifconfig: socket");
+ return;
+ }
+ if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
+ msgConfirm("ifconfig (SIOCGIFCONF)");
+ return;
+ }
+ ifflags = ifc.ifc_req->ifr_flags;
+ end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
+ ifptr = ifc.ifc_req;
+ while (ifptr < end) {
+ CHECK_DEVS;
+ Devices[numDevs] = new_devices(ifptr->ifr_name);
+ Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->ignore = FALSE;
+ Devices[numDevs]->init = mediaNetworkInit;
+ Devices[numDevs]->get = mediaNetworkGet;
+ Devices[numDevs]->close = mediaNetworkClose;
+ Devices[numDevs]->private = NULL;
+ msgDebug("Found a device of type network named: %s\n",
+ ifptr->ifr_name);
+ ++numDevs;
+ close(s);
+ if ((s = socket(af, SOCK_DGRAM, 0)) < 0) {
+ msgConfirm("ifconfig: socket");
+ continue;
}
+ if (ifptr->ifr_addr.sa_len) /* Dohw! */
+ ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len
+ - sizeof(struct sockaddr));
+ ifptr++;
}
- p = CheckRules(d);
- if (p) {
- msgConfirm(p);
- free(p);
+ /* Terminate the devices array */
+ Devices[numDevs] = NULL;
+}
+
+/*
+ * Find all devices that match the criteria, allowing "wildcarding" as well
+ * by allowing NULL or ANY values to match all.
+ */
+Device **
+deviceFind(char *name, DeviceType class)
+{
+ static Device *found[DEV_MAX];
+ int i, j;
+
+ for (i = 0, j = 0; i < numDevs; i++) {
+ if ((!name || !strcmp(Devices[i]->name, name)) &&
+ (class == DEVICE_TYPE_ANY || class == Devices[i]->type))
+ found[j++] = Devices[i];
}
- clear();
- refresh();
- return d;
+ found[j] = NULL;
+ return j ? found : NULL;
}
/*
- * Create a menu listing all the devices in the system. The pass-in menu
- * is expected to be a "prototype" from which the new menu is cloned.
+ * Create a menu listing all the devices of a certain type in the system.
+ * The passed-in menu is expected to be a "prototype" from which the new
+ * menu is cloned.
*/
DMenu *
-device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
+deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)())
{
- Device *devices;
- int numdevs;
+ Device **devs;
- 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;
+ devs = deviceFind(NULL, type);
+ if (devs) {
DMenu *tmp;
- int i;
+ int i, j;
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);
+ for (i = 0; *devs; i++, devs++) {
+ tmp->items[i].title = *devs->name;
+ for (j = 0; device_names[j].name; j++) {
+ if (!strncmp(*devs->name, device_names[j].name,
+ strlen(device_names[j].name)))
+ tmp->items[i].prompt = devices_names[j].description;
+ }
+ if (!device_names[j].name)
+ tmp->items[i].prompt = "<unknown device type>";
tmp->items[i].type = DMENU_CALL;
tmp->items[i].ptr = hook;
tmp->items[i].disabled = FALSE;
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c
index baf2137..dafaf37 100644
--- a/usr.sbin/sysinstall/disks.c
+++ b/usr.sbin/sysinstall/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.16 1995/05/11 06:10:48 jkh Exp $
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -45,298 +45,58 @@
#include <ctype.h>
#include <sys/disklabel.h>
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-
-#define MAX_CHUNKS 50
-
-/* Where to start printing the freebsd slices */
-#define CHUNK_SLICE_START_ROW 2
-#define CHUNK_PART_START_ROW 10
-
-/* The smallest filesystem we're willing to create */
-#define FS_MIN_SIZE 2048
-
-#define MSG_NOT_APPLICABLE "That option is not applicable here"
+/* Where we start displaying chunk information on the screen */
+#define CHUNK_START_ROW 5
-static struct {
- struct disk *d;
- struct chunk *c;
- PartType type;
-} fbsd_chunk_info[MAX_CHUNKS + 1];
+/* Where we keep track of MBR chunks */
+static struct chunk *chunk_info[10];
static int current_chunk;
-
-static Boolean
-check_conflict(char *name)
-{
- int i;
-
- for (i = 0; fbsd_chunk_info[i].d; i++)
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
- fbsd_chunk_info[i].c->private &&
- !strcmp(((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint,
- name))
- return TRUE;
- return FALSE;
-}
-
-static int
-space_free(struct chunk *c)
-{
- struct chunk *c1 = c->part;
- int sz = c->size;
-
- while (c1) {
- if (c1->type != unused)
- sz -= c1->size;
- c1 = c1->next;
- }
- if (sz < 0)
- msgFatal("Partitions are larger than actual chunk??");
- return sz;
-}
-
static void
-record_fbsd_chunks()
+record_chunks(Disk *d)
{
- int i, j, p;
- struct chunk *c1, *c2;
-
- j = p = 0;
- for (i = 0; Disks[i]; i++) {
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
-
- /* Put the freebsd chunks first */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- fbsd_chunk_info[j].type = PART_SLICE;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c1;
- ++j;
- }
- }
- }
- for (i = 0; Disks[i]; i++) {
- /* Then buzz through and pick up the partitions */
- for (c1 = Disks[i]->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part) {
- if (c2->subtype == FS_SWAP)
- fbsd_chunk_info[j].type = PART_SWAP;
- else
- fbsd_chunk_info[j].type = PART_FILESYSTEM;
- fbsd_chunk_info[j].d = Disks[i];
- fbsd_chunk_info[j].c = c2;
- ++j;
- }
- }
- }
- }
- }
- fbsd_chunk_info[j].d = NULL;
- fbsd_chunk_info[j].c = NULL;
- if (current_chunk >= j)
- current_chunk = j ? j - 1 : 0;
-}
-
-static PartInfo *
-new_part(char *mpoint, Boolean newfs)
-{
- PartInfo *ret;
-
- ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
- strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
- strcpy(ret->newfs_cmd, "newfs");
- ret->newfs = newfs;
- return ret;
-}
-
-PartInfo *
-get_mountpoint(struct chunk *c)
-{
- char *val;
- PartInfo *tmp;
-
- val = msgGetInput(c && c->private ?
- ((PartInfo *)c->private)->mountpoint : NULL,
- "Please specify a mount point for the partition");
- if (val) {
- if (check_conflict(val)) {
- msgConfirm("You already have a mount point for %s assigned!", val);
- return NULL;
- }
- else if (*val != '/') {
- msgConfirm("Mount point must start with a / character");
- return NULL;
- }
- else if (!strcmp(val, "/")) {
- if (c) {
- if (c->flags & CHUNK_PAST_1024) {
- msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
- return NULL;
- }
-#if 0 /* This never seems to be set */
- else if (!(c->flags & CHUNK_BSD_COMPAT)) {
- msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
- return NULL;
- }
-#endif
- else
- c->flags |= CHUNK_IS_ROOT;
- }
- }
- else if (c)
- c->flags &= ~CHUNK_IS_ROOT;
- safe_free(c ? c->private : NULL);
- tmp = new_part(val, TRUE);
- if (c) {
- c->private = tmp;
- c->private_free = safe_free;
+ struct chunk *c1;
+ int i = 0;
+ int last_free = 0;
+ if (!d->chunks)
+ msgFatal("No chunk list found for %s!", d->name);
+ c1 = d->chunks->part;
+ current_chunk = 0;
+ while (c1) {
+ if (c1->type == unused && c1->size > last_free) {
+ last_free = c1->size;
+ current_chunk = i;
}
- return tmp;
- }
- return NULL;
-}
-
-static PartType
-get_partition_type(void)
-{
- char selection[20];
- static unsigned char *fs_types[] = {
- "FS",
- "A file system",
- "Swap",
- "A swap partition.",
- };
-
- if (!dialog_menu("Please choose a partition type",
- "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
- if (!strcmp(selection, "FS"))
- return PART_FILESYSTEM;
- else if (!strcmp(selection, "Swap"))
- return PART_SWAP;
+ chunk_info[i++] = c1;
+ c1 = c1->next;
}
- return PART_NONE;
-}
-
-static void
-getNewfsCmd(PartInfo *p)
-{
- char *val;
-
- val = msgGetInput(p->newfs_cmd,
- "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
- if (val)
- strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+ chunk_info[i] = NULL;
}
-
-#define MAX_MOUNT_NAME 12
-
-#define PART_PART_COL 0
-#define PART_MOUNT_COL 8
-#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
-#define PART_NEWFS_COL (PART_SIZE_COL + 7)
-#define PART_OFF 38
-
-/* How many mounted partitions to display in column before going to next */
-#define CHUNK_COLUMN_MAX 6
-
static void
-print_fbsd_chunks(void)
+print_chunks(Disk *d)
{
- int i, j, srow, prow, pcol;
- int sz;
+ int row;
+ int i;
- attrset(A_REVERSE);
- mvaddstr(0, 25, "FreeBSD Partition Editor");
attrset(A_NORMAL);
-
- for (i = 0; i < 2; i++) {
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
- "Part");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
- "Mount");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
- "Size");
- attrset(A_NORMAL);
-
- attrset(A_UNDERLINE);
- mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
- "Newfs");
- attrset(A_NORMAL);
- }
-
- srow = CHUNK_SLICE_START_ROW;
- prow = CHUNK_PART_START_ROW;
- pcol = 0;
-
- for (i = 0; fbsd_chunk_info[i].d; i++) {
+ mvaddstr(0, 0, "Disk name:\t");
+ attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
+ attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
+ mvprintw(1, 0,
+ "BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
+ "Offset", "Size", "End", "Name", "PType", "Desc",
+ "Subtype", "Flags");
+ for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
attrset(A_REVERSE);
- /* Is it a slice entry displayed at the top? */
- if (fbsd_chunk_info[i].type == PART_SLICE) {
- sz = space_free(fbsd_chunk_info[i].c);
- mvprintw(srow++, 0,
- "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
- fbsd_chunk_info[i].d->name,
- fbsd_chunk_info[i].c->name, sz, (sz / 2048));
- }
- /* Otherwise it's a swap or filesystem entry, at the bottom */
- else {
- char onestr[PART_OFF], num[10], *mountpoint, *newfs;
-
- memset(onestr, ' ', PART_OFF - 1);
- onestr[PART_OFF - 1] = '\0';
- /* Go for two columns */
- if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
- pcol = PART_OFF;
- prow = CHUNK_PART_START_ROW;
- }
- memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
- strlen(fbsd_chunk_info[i].c->name));
- if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
- if (fbsd_chunk_info[i].c->private) {
- mountpoint = ((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint;
- newfs = ((PartInfo *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N";
- }
- else {
- fbsd_chunk_info[i].c->private = new_part("", FALSE);
- fbsd_chunk_info[i].c->private_free = safe_free;
- mountpoint = " ";
- newfs = "N";
- }
- }
- else {
- mountpoint = "swap";
- newfs = " ";
- }
- for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
- onestr[PART_MOUNT_COL + j] = mountpoint[j];
- snprintf(num, 10, "%4ldMB", fbsd_chunk_info[i].c->size ?
- fbsd_chunk_info[i].c->size / 2048 : 0);
- memcpy(onestr + PART_SIZE_COL, num, strlen(num));
- memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
- onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
- mvaddstr(prow, pcol, onestr);
- ++prow;
- }
+ mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
+ chunk_info[i]->offset, chunk_info[i]->size,
+ chunk_info[i]->end, chunk_info[i]->name,
+ chunk_info[i]->type, chunk_n[chunk_info[i]->type],
+ chunk_info[i]->subtype, chunk_info[i]->flags);
if (i == current_chunk)
attrset(A_NORMAL);
}
@@ -345,46 +105,44 @@ print_fbsd_chunks(void)
static void
print_command_summary()
{
- mvprintw(17, 0,
- "The following commands are valid here (upper or lower case):");
- mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
- mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
- mvprintw(21, 0, "The default target will be displayed in ");
-
- attrset(A_REVERSE);
- addstr("reverse video.");
- attrset(A_NORMAL);
- mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
+ mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
+ mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
+ mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen");
+ mvprintw(20, 0, "The currently selected partition is displayed in ");
+ attrset(A_REVERSE); addstr("reverse video."); attrset(A_NORMAL);
+ mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
move(0, 0);
}
-void
-partition_disks(void)
+static Disk *
+diskPartition(Disk *d)
{
- int sz, key = 0;
- Boolean partitioning;
+ char *p;
+ int key = 0;
+ Boolean chunking;
char *msg = NULL;
- PartInfo *p;
- PartType type;
+ char name[40];
dialog_clear();
- partitioning = TRUE;
+ chunking = TRUE;
+ strncpy(name, d->name, 40);
keypad(stdscr, TRUE);
- record_fbsd_chunks();
- while (partitioning) {
+ record_chunks(d);
+ while (chunking) {
clear();
- print_fbsd_chunks();
+ print_chunks(d);
print_command_summary();
if (msg) {
- attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ standout(); mvprintw(23, 0, msg); standend();
beep();
msg = NULL;
}
refresh();
+
key = toupper(getch());
switch (key) {
-
case KEY_UP:
case '-':
if (current_chunk != 0)
@@ -395,7 +153,7 @@ partition_disks(void)
case '+':
case '\r':
case '\n':
- if (fbsd_chunk_info[current_chunk + 1].d)
+ if (chunk_info[current_chunk + 1])
++current_chunk;
break;
@@ -404,138 +162,104 @@ partition_disks(void)
break;
case KEY_END:
- while (fbsd_chunk_info[current_chunk + 1].d)
+ while (chunk_info[current_chunk + 1])
++current_chunk;
break;
case KEY_F(1):
case '?':
- systemDisplayFile("partitioning.hlp");
+ systemDisplayFile("slice.hlp");
+ break;
+
+ case 'A':
+ All_FreeBSD(d);
+ record_chunks(d);
+ break;
+
+ case 'B':
+ if (chunk_info[current_chunk]->type != freebsd)
+ msg = "Can only scan for bad blocks in FreeBSD partition.";
+ else if (strncmp(name, "sd", 2) ||
+ !msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
+ chunk_info[current_chunk]->flags |= CHUNK_BAD144;
break;
case 'C':
- if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
- msg = "You can only do this in a master partition (see top of screen)";
- break;
- }
- sz = space_free(fbsd_chunk_info[current_chunk].c);
- if (sz <= FS_MIN_SIZE)
- msg = "Not enough space to create additional FreeBSD partition";
+ if (chunk_info[current_chunk]->type != unused)
+ msg = "Partition in use, delete it first or move to an unused one.";
else {
- char *val, *cp, tmp[20];
+ char *val, tmp[20];
int size;
- snprintf(tmp, 20, "%d", sz);
- val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
- if (val && (size = strtol(val, &cp, 0)) > 0) {
- struct chunk *tmp;
- u_long flags = 0;
-
- if (*cp && toupper(*cp) == 'M')
- size *= 2048;
-
- type = get_partition_type();
- if (type == PART_NONE)
- break;
- else if (type == PART_FILESYSTEM) {
- if ((p = get_mountpoint(NULL)) == NULL)
- break;
- else if (!strcmp(p->mountpoint, "/"))
- flags |= CHUNK_IS_ROOT;
- else
- flags &= ~CHUNK_IS_ROOT;
- }
- else
- p = NULL;
-
- tmp = Create_Chunk_DWIM(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c,
- size,
- part,
- (type == PART_SWAP) ?
- FS_SWAP : FS_BSDFFS,
- flags);
- if (!tmp)
- msgConfirm("Unable to create the partition. Too big?");
- else {
- tmp->private = p;
- tmp->private_free = safe_free;
- record_fbsd_chunks();
- }
+ snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
+ val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
+ if (val && (size = strtol(val, 0, 0)) > 0) {
+ Create_Chunk(d, chunk_info[current_chunk]->offset,
+ size,
+ freebsd,
+ 3,
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
+ record_chunks(d);
}
}
break;
- case 'D': /* delete */
- if (fbsd_chunk_info[current_chunk].type == PART_SLICE) {
- msg = MSG_NOT_APPLICABLE;
- break;
+ case 'D':
+ if (chunk_info[current_chunk]->type == unused)
+ msg = "Partition is already unused!";
+ else {
+ Delete_Chunk(d, chunk_info[current_chunk]);
+ record_chunks(d);
}
- Delete_Chunk(fbsd_chunk_info[current_chunk].d,
- fbsd_chunk_info[current_chunk].c);
- record_fbsd_chunks();
break;
- case 'M': /* mount */
- switch(fbsd_chunk_info[current_chunk].type) {
- case PART_SLICE:
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case PART_SWAP:
- msg = "You don't need to specify a mountpoint for a swap partition.";
- break;
-
- case PART_FILESYSTEM:
- p = get_mountpoint(fbsd_chunk_info[current_chunk].c);
- if (p) {
- p->newfs = FALSE;
- record_fbsd_chunks();
- }
- break;
-
- default:
- msgFatal("Bogus partition under cursor???");
- break;
+ case 'G': {
+ char *val, geometry[80];
+
+ snprintf(geometry, 80, "%lu/%lu/%lu",
+ d->bios_cyl, d->bios_hd, d->bios_sect);
+ val = msgGetInput(geometry,
+"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
+ if (val) {
+ d->bios_cyl = strtol(val, &val, 0);
+ d->bios_hd = strtol(val + 1, &val, 0);
+ d->bios_sect = strtol(val + 1, 0, 0);
}
+ }
break;
- case 'N': /* Set newfs options */
- if (fbsd_chunk_info[current_chunk].c->private &&
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
- getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'S':
+ /* Set Bootable */
+ chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
- case 'T': /* Toggle newfs state */
- if (fbsd_chunk_info[current_chunk].c->private)
- ((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
- else
- msg = MSG_NOT_APPLICABLE;
+ case 'U':
+ Free_Disk(d);
+ d = Open_Disk(name);
+ if (!d)
+ msgFatal("Can't reopen disk %s!", name);
+ record_chunks(d);
break;
case 'W':
- if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
- int i;
-
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
clear();
dialog_clear();
end_dialog();
DialogActive = FALSE;
- for (i = 0; Disks[i]; i++)
- slice_wizard(Disks[i]);
+ slice_wizard(d);
clear();
dialog_clear();
DialogActive = TRUE;
- record_fbsd_chunks();
+ record_chunks(d);
}
else
- msg = "A most prudent choice!";
+ msg = "Wise choice!";
break;
case 27: /* ESC */
- partitioning = FALSE;
+ chunking = FALSE;
break;
default:
@@ -544,31 +268,65 @@ partition_disks(void)
break;
}
}
+ p = CheckRules(d);
+ if (p) {
+ msgConfirm(p);
+ free(p);
+ }
+ clear();
+ refresh();
+ variable_set2(DISK_PARTITIONED, "yes");
+ return d;
}
-int
-write_disks(void)
+static int
+partitionHook(char *str)
{
- int i;
- extern u_char boot1[], boot2[];
- extern u_char mbr[], bteasy17[];
-
- dialog_clear();
- for (i = 0; Disks[i]; i++) {
- Set_Boot_Blocks(Disks[i], boot1, boot2);
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
- Set_Boot_Mgr(Disks[i], bteasy17);
- else {
- dialog_clear();
- if (i == 0 && !msgYesNo("Would you like to remove an existing boot manager?"))
- Set_Boot_Mgr(Disks[i], mbr);
+ Device *devs;
+
+ /* Clip garbage off the ends */
+ string_prune(str);
+ str = string_skipwhite(str);
+ /* Try and open all the disks */
+ while (str) {
+ char *cp;
+
+ cp = index(str, '\n');
+ if (cp)
+ *cp++ = 0;
+ if (!*str) {
+ beep();
+ return 0;
}
- dialog_clear();
- if (!msgYesNo("Last Chance! Are you sure you want to write out\nall these changes to disk?")) {
- Write_Disk(Disks[i]);
+ devs = deviceFind(str, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Unable to find disk %s!", str);
return 0;
}
+ else if (devs[1])
+ msgConfirm("Bizarre multiple match for %s!", str);
+ devs[0]->private = diskPartition((Disk *)devs[0]->private);
+ str = cp;
+ }
+ return devs ? 1 : 0;
+}
+
+extern DMenu MenuInstall;
+
+int
+diskPartitionEditor(char *str)
+{
+ int scroll, choice, curr, max;
+ extern DMenu MenuDiskDevices;
+ DMenu *menu;
+
+ menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
+ if (!menu) {
+ 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 0;
}
- return 1;
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+ free(menu);
+ return 0;
}
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index 1453cfd..a2eee9a 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.2 1995/05/08 21:39:34 jkh Exp $
+ * $Id: dist.c,v 1.3 1995/05/10 07:44:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -103,10 +103,8 @@ int
distSetSrc(char *str)
{
extern DMenu MenuSrcDistributions;
- int choice, scroll, curr, max;
- choice = scroll = curr = max;
- dmenuOpen(&MenuSrcDistributions, &choice, &scroll, &curr, &max);
+ dmenuOpenSimple(&MenuSrcDistributions);
if (SrcDists)
Dists |= DIST_SRC;
return 0;
@@ -116,109 +114,138 @@ static int
distSetXF86(char *str)
{
extern DMenu MenuXF86;
- int choice, scroll, curr, max;
- choice = scroll = curr = max;
- dmenuOpen(&MenuXF86, &choice, &scroll, &curr, &max);
+ dmenuOpenSimple(&MenuXF86);
return 0;
}
-static struct _dist {
+typedef struct _dist {
char *my_name;
+ unsigned int *my_mask;
unsigned int my_bit;
-} DistTable[] = {
-{ "bin", DIST_BIN },
-{ "games", DIST_GAMES },
-{ "manpages", DIST_MANPAGES },
-{ "proflibs", DIST_PROFLIBS },
-{ "dict", DIST_DICT },
-{ "src", DIST_SRC },
-{ "des", DIST_DES },
-{ "compat1x", DIST_COMPAT1X },
-{ "xf86311", DIST_XF86 },
-{ NULL, 0 },
+ struct _dist *my_dist;
+} Distribution;
+
+extern Distribution SrcDistTable[];
+extern Distribution XF86DistTable[];
+extern Distribution XF86FontDistTable[];
+extern Distribution XF86ServerDistTable[];
+
+
+/* The top-level distribution categories */
+static Distribution DistTable[] = {
+{ "bin", &Dist, DIST_BIN, NULL },
+{ "games", &Dist, DIST_GAMES, NULL },
+{ "manpages", &Dist, DIST_MANPAGES, NULL },
+{ "proflibs", &Dist, DIST_PROFLIBS, NULL },
+{ "dict", &Dist, DIST_DICT, NULL },
+{ "src/", &Dist, DIST_SRC, &SrcDistTable },
+{ "des", &Dist, DIST_DES, NULL },
+{ "compat1x", &Dist, DIST_COMPAT1X, NULL },
+{ "xf86311/", &Dist, DIST_XF86, &XF86DistTable },
+{ NULL },
};
-static struct _dist SrcDistTable[] = {
-{ "base", DIST_SRC_BASE },
-{ "gnu", DIST_SRC_GNU },
-{ "etc", DIST_SRC_ETC },
-{ "games", DIST_SRC_GAMES },
-{ "include", DIST_SRC_INCLUDE},
-{ "lib", DIST_SRC_LIB },
-{ "libexec", DIST_SRC_LIBEXEC},
-{ "lkm", DIST_SRC_LKM },
-{ "release", DIST_SRC_RELEASE},
-{ "sbin", DIST_SRC_SBIN },
-{ "share", DIST_SRC_SHARE },
-{ "sys", DIST_SRC_SYS },
-{ "ubin", DIST_SRC_UBIN },
-{ "usbin", DIST_SRC_USBIN },
+/* The /usr/src distribution */
+static Distribution SrcDistTable[] = {
+{ "base", &SrcDist, DIST_SRC_BASE, NULL },
+{ "gnu", &SrcDist, DIST_SRC_GNU, NULL },
+{ "etc", &SrcDist, DIST_SRC_ETC, NULL },
+{ "games", &SrcDist, DIST_SRC_GAMES, NULL },
+{ "include", &SrcDist, DIST_SRC_INCLUDE, NULL },
+{ "lib", &SrcDist, DIST_SRC_LIB, NULL },
+{ "libexec", &SrcDist, DIST_SRC_LIBEXEC, NULL },
+{ "lkm", &SrcDist, DIST_SRC_LKM, NULL },
+{ "release", &SrcDist, DIST_SRC_RELEASE, NULL },
+{ "sbin", &SrcDist, DIST_SRC_SBIN, NULL },
+{ "share", &SrcDist, DIST_SRC_SHARE, NULL },
+{ "sys", &SrcDist, DIST_SRC_SYS, NULL },
+{ "ubin", &SrcDist, DIST_SRC_UBIN, NULL },
+{ "usbin", &SrcDist, DIST_SRC_USBIN, NULL },
{ NULL, 0 },
};
-static struct _dist XFree86DistTable[] = {
-{ "bin", DIST_XF86_BIN },
-{ "lib", DIST_XF86_LIB },
-{ "doc", DIST_XF86_DOC },
-{ "man", DIST_XF86_MAN },
-{ "prog", DIST_XF86_PROG },
-{ "link", DIST_XF86_LINK },
-{ "pex", DIST_XF86_PEX },
-{ "lbx", DIST_XF86_LBX },
-{ "xicf", DIST_XF86_XINIT },
-{ "xdmcf", DIST_XF86_XDMCF },
-{ NULL, 0 },
+/* The XFree86 distribution */
+static Distribution XF86DistTable[] = {
+{ "bin", &XF86Dist, DIST_XF86_BIN, NULL },
+{ "lib", &XF86Dist, DIST_XF86_LIB, NULL },
+{ "doc", &XF86Dist, DIST_XF86_DOC, NULL },
+{ "xf86311/", &XF86Dist, DIST_XF86_FONTS, &XF86FontDistTable },
+{ "man", &XF86Dist, DIST_XF86_MAN, NULL },
+{ "prog", &XF86Dist, DIST_XF86_PROG, NULL },
+{ "link", &XF86Dist, DIST_XF86_LINK, NULL },
+{ "pex", &XF86Dist, DIST_XF86_PEX, NULL },
+{ "lbx", &XF86Dist, DIST_XF86_LBX, NULL },
+{ "xicf", &XF86Dist, DIST_XF86_XINIT, NULL },
+{ "xdmcf", &XF86Dist, DIST_XF86_XDMCF, NULL },
+{ "xf86311/", &XF86Dist, DIST_XF86_SERVER, &XF86ServerDistTable },
+{ NULL },
};
-static struct _dist XFree86ServerDistTable[] = {
-{ "8514", DIST_XF86_SERVER_8514 },
-{ "AGX", DIST_XF86_SERVER_AGX },
-{ "Mch3", DIST_XF86_SERVER_MACH32 },
-{ "Mch8", DIST_XF86_SERVER_MACH8 },
-{ "Mono", DIST_XF86_SERVER_MONO },
-{ "P9K", DIST_XF86_SERVER_P9000 },
-{ "S3", DIST_XF86_SERVER_S3 },
-{ "SVGA", DIST_XF86_SERVER_SVGA },
-{ "VGA16", DIST_XF86_SERVER_VGA16 },
-{ "W32", DIST_XF86_SERVER_W32 },
-{ "nest", DIST_XF86_SERVER_NEST },
-{ NULL, 0 },
+/* The XFree86 server distribution */
+static Distribution XF86ServerDistTable[] = {
+{ "X3118514", &XF86ServerDist,DIST_XF86_SERVER_8514, NULL },
+{ "X311AGX", &XF86ServerDist,DIST_XF86_SERVER_AGX, NULL },
+{ "X311Mch3", &XF86ServerDist,DIST_XF86_SERVER_MACH32,NULL },
+{ "X311Mch8", &XF86ServerDist,DIST_XF86_SERVER_MACH8, NULL },
+{ "X311Mono", &XF86ServerDist,DIST_XF86_SERVER_MONO, NULL },
+{ "X311P9K", &XF86ServerDist,DIST_XF86_SERVER_P9000, NULL },
+{ "X311S3", &XF86ServerDist,DIST_XF86_SERVER_S3, NULL },
+{ "X311SVGA", &XF86ServerDist,DIST_XF86_SERVER_SVGA, NULL },
+{ "X311VGA16", &XF86ServerDist,DIST_XF86_SERVER_VGA16, NULL },
+{ "X311W32", &XF86ServerDist,DIST_XF86_SERVER_W32, NULL },
+{ "X311nest", &XF86ServerDist,DIST_XF86_SERVER_NEST, NULL },
+{ NULL },
};
-static struct _dist XFree86FontDistTable[] = {
-{ "fnts", DIST_XF86_FONTS_MISC },
-{ "f100", DIST_XF86_FONTS_100 },
-{ "fscl", DIST_XF86_FONTS_SCALE },
-{ "fnon", DIST_XF86_FONTS_NON },
-{ "fsrv", DIST_XF86_FONTS_SERVER },
+/* The XFree86 font distribution */
+static Distribution XF86FontDistTable[] = {
+{ "X311fnts", &XF86FontDist, DIST_XF86_FONTS_MISC, NULL },
+{ "X311f100", &XF86FontDist, DIST_XF86_FONTS_100, NULL },
+{ "X311fscl", &XF86FontDist, DIST_XF86_FONTS_SCALE, NULL },
+{ "X311fnon", &XF86FontDist, DIST_XF86_FONTS_NON, NULL },
+{ "X311fsrv", &XF86FontDist, DIST_XF86_FONTS_SERVER, NULL },
+{ NULL },
};
-static Boolean
-dist_extract(char *name)
+static int
+distExtract(char *parent, Distribution *me)
{
- if (!strcmp(name, "src")) {
- }
- else if (!strcmp(name, "xf86311l")) {
- }
- else {
+ int i, status;
+ FILE *fp;
+
+ status = 0;
+ for (i = 0; me[i].my_name; i++) {
+ if (me[i].my_bit & *(me[i].my_mask)) {
+ if (me[i].my_dist)
+ status = distExtract(me[i].my_name, me[i].my_dist);
+ else {
+ fp = mediaOpen(parent, me[i].my_name);
+ if (fp) {
+ status = extract_dist(fp);
+ close(fp);
+ }
+ else {
+ if (getenv(NO_CONFIRMATION))
+ status = 0;
+ else
+ status = msgYesNo("Unable to retreive the %s distribution from %s.\nDo you want to retry that distribution later?");
+ }
+ }
+ if (!status) {
+ /*
+ * Extract was successful, remove ourselves from further
+ * consideration
+ */
+ *(me[i].my_mask) &= ~(me[i].my_bit);
+ }
+ }
}
- return FALSE;
+ return status;
}
-
+
void
distExtractAll(void)
{
- int i;
-
- while (Dists) {
- for (i = 0; DistTable[i].my_name; i++) {
- if (Dists & DistTable[i].my_bit) {
- if (dist_extract(DistTable[i].my_name))
- Dists &= ~DistTable[i].my_bit;
- else
- continue;
- }
- }
- }
+ distExtract(NULL, DistTable);
}
diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c
index 7c43ed2..d10167c 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.6 1995/05/10 08:00:47 jkh Exp $
+ * $Id: dmenu.c,v 1.7 1995/05/11 06:10:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -47,6 +47,16 @@
static DMenuItem shellAction = { NULL, NULL, DMENU_SHELL_ESCAPE, NULL, 0 };
+/* Traverse menu but give user no control over positioning */
+void
+dmenuOpenSimple(DMenu *menu)
+{
+ int choice, scroll, curr, max;
+
+ choice = scroll = curr = max = 0;
+ dmenuOpen(menu, &choice, &scroll, &curr, &max);
+}
+
/* Traverse over an internal menu */
void
dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
@@ -139,7 +149,8 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
items_free(nitems, curr, max);
return;
}
- if (dispatch(tmp, result) || menu->options & DMENU_SELECTION_RETURNS) {
+ if (dispatch(tmp, result) ||
+ menu->options & DMENU_SELECTION_RETURNS) {
items_free(nitems, curr, max);
return;
}
diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c
index 7fc4436..81c75b0 100644
--- a/usr.sbin/sysinstall/globals.c
+++ b/usr.sbin/sysinstall/globals.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
+ * $Id: globals.c,v 1.3 1995/05/08 21:39:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,8 +56,6 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
-DeviceType MediaType; /* Where we're installing from */
-char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index 8599c01..7f531f7 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.15 1995/05/11 06:47:44 jkh Exp $
+ * $Id: install.c,v 1.16 1995/05/11 09:01:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -48,136 +48,88 @@
#include <unistd.h>
Boolean SystemWasInstalled;
-struct disk *Disks[100]; /* some ridiculously large number */
-static int
-installHook(char *str)
+static void make_filesystems(void);
+static void cpio_extract(void);
+static void install_configuration_files(void);
+static void do_final_setup(void);
+
+int
+installCommit(char *str)
{
+ extern u_char boot1[], boot2[];
+ extern u_char mbr[], bteasy17[];
+ u_char *mbrContents;
+ Device **devs;
int i;
- extern DMenu MenuInstall;
- i = 0;
- /* Clip garbage off the ends */
- string_prune(str);
- str = string_skipwhite(str);
- /* Try and open all the disks */
- while (str) {
- char *cp;
+ if (!getenv(DISK_PARTITIONED)) {
+ msgConfirm("You need to partition your disk before you can proceed with\nthe installation.");
- cp = index(str, '\n');
- if (cp)
- *cp++ = 0;
- if (!*str) {
- beep();
- return 0;
- }
- Disks[i] = Open_Disk(str);
- if (!Disks[i])
- msgFatal("Unable to open disk %s!", str);
- ++i;
- str = cp;
+ return 0;
}
- Disks[i] = NULL;
- if (!i)
+ if (!getenv(DISK_LABELLED)) {
+ msgConfirm("You need to assign disk labels before you can proceed with\nthe installation.");
return 0;
-
- while (1) {
- /* Now go set up all the MBR partition information */
- for (i = 0; Disks[i]; i++)
- Disks[i] = device_slice_disk(Disks[i]);
-
- /* Whap partitions on all the FreeBSD slices created */
- partition_disks();
-
- /* Try and write it out */
- if (!write_disks()) {
- int scroll, choice, curr, max;
-
- make_filesystems();
- scroll = choice = curr = max = 0;
- dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
- chdir("/mnt");
- cpio_extract();
- chroot("/mnt");
- distExtractAll();
- install_configuration_files();
- do_final_setup();
- SystemWasInstalled = TRUE;
- break;
- }
- else {
- dialog_clear();
- if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
- for (i = 0; Disks[i]; i++)
- Free_Disk(Disks[i]);
- break;
- }
- }
}
- return SystemWasInstalled;
-}
-
-int
-installCustom(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "custom");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ if (!Dists) {
+ msgConfirm("You haven't told me what distributions to load yet!\nPlease select a distribution from the Distributions menu.");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installExpress(char *str)
-{
- int scroll, choice, curr, max;
- extern DMenu MenuDiskDevices;
- DMenu *menu;
- Device *devs;
-
- variable_set2("install_type", "express");
- menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
- if (!menu)
+ }
+ if (mediaVerifyStatus()) {
+ msgConfirm("Please correct installation media problems and try again!");
return 0;
- choice = scroll = curr = max = 0;
- dmenuOpen(menu, &choice, &scroll, &curr, &max);
- free(menu);
- free(devs);
- return SystemWasInstalled;
-}
-
-int
-installMaint(char *str)
-{
- msgConfirm("Sorry, maintainance mode is not implemented in this version.");
- return 0;
+ }
+ if (msgYesNo("Last Chance! Are you SURE you want continue the\ninstallation? If you're running this on an existing system, we STRONGLY\nencourage you to make proper backups before doing this.\nWe take no responsibility for lost disk contents!"))
+ return 0;
+ dialog_clear();
+ mbrContents = NULL;
+ if (!msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first."))
+ mbrContents = bteasy17;
+ else {
+ dialog_clear();
+ if (!msgYesNo("Would you like to remove an existing boot manager?"))
+ mbrContents = mbr;
+ }
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+ if (mbrContents) {
+ Set_Boot_Mgr((Disk *)Devices[i]->private, mbrContents);
+ mbrContents = NULL;
+ }
+ Set_Boot_Blocks((Disk *)Devices[i]->private, boot1, boot2);
+ msgNotify("Writing partition information to drive %s",
+ Devices[i]->name);
+ Write_Disk((Disk *)Devices[i]->private);
+ }
+ make_filesystems();
+ cpio_extract();
+ install_configuration_files();
+ do_final_setup();
+ return 1;
}
/* Go newfs and/or mount all the filesystems we've been asked to */
-void
+static void
make_filesystems(void)
{
int i;
+ Disk *disk;
+ Chunk *c1;
command_clear();
- for (i = 0; Disks[i]; i++) {
- struct chunk *c1;
-
- if (!Disks[i]->chunks)
- msgFatal("No chunk list found for %s!", Disks[i]->name);
- c1 = Disks[i]->chunks->part;
+ for (i = 0; Devices[i]; i++) {
+ if (Devices[i]->type != DEVICE_TYPE_DISK)
+ continue;
+
+ disk = (Disk *)Devices[i]->private;
+ if (!disk->chunks)
+ msgFatal("No chunk list found for %s!", disk->name);
+ c1 = disk->chunks->part;
while (c1) {
if (c1->type == freebsd) {
- struct chunk *c2 = c1->part;
+ Chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP &&
@@ -185,19 +137,12 @@ make_filesystems(void)
PartInfo *tmp = (PartInfo *)c2->private;
if (tmp->newfs)
- command_add(tmp->mountpoint,
- "%s %s", tmp->newfs_cmd, c2->name);
- if (strcmp(tmp->mountpoint, "/")) {
- command_add(tmp->mountpoint,
- "mkdir -p /mnt%s", tmp->mountpoint);
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt%s", c2->name,
- tmp->mountpoint);
- }
- else
- command_add(tmp->mountpoint,
- "mount /mnt/dev/%s /mnt", c2->name);
-
+ command_shell_add(tmp->mountpoint,
+ "%s %s", tmp->newfs_cmd,
+ c2->name);
+ if (strcmp(tmp->mountpoint, "/"))
+ command_func_add(tmp->mountpoint, Mkdir, NULL);
+ command_func_add(tmp->mountpoint, Mount, c2->name);
}
c2 = c2->next;
}
@@ -209,7 +154,7 @@ make_filesystems(void)
command_execute();
}
-void
+static void
cpio_extract(void)
{
int i, j, zpid, cpid, pfd[2];
@@ -253,13 +198,12 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
-void
+static void
install_configuration_files(void)
{
}
-void
+static void
do_final_setup(void)
{
}
-
diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c
new file mode 100644
index 0000000..9d769a0
--- /dev/null
+++ b/usr.sbin/sysinstall/label.c
@@ -0,0 +1,602 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: disks.c,v 1.17 1995/05/11 09:01:28 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 <ctype.h>
+#include <sys/disklabel.h>
+
+/*
+ * Everything to do with editing the contents of disk labels.
+ */
+
+/* A nice message we use a lot in the disklabel editor */
+#define MSG_NOT_APPLICABLE "That option is not applicable here"
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+#define MAX_CHUNKS 50
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* The smallest filesystem we're willing to create */
+#define FS_MIN_SIZE 2048
+
+
+/* All the chunks currently displayed on the screen */
+static struct {
+ struct disk *d;
+ struct chunk *c;
+ PartType type;
+} label_chunk_info[MAX_CHUNKS + 1];
+static int here;
+
+/* See if we're already using a desired partition name */
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; label_chunk_info[i].d; i++)
+ if (label_chunk_info[i].type == PART_FILESYSTEM
+ && label_chunk_info[i].c->private
+ && !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
+ return TRUE;
+ return FALSE;
+}
+
+/* How much space is in this FreeBSD slice? */
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+/* Snapshot the current situation into the displayed chunks structure */
+static void
+record_label_chunks()
+{
+ int i, j, p;
+ struct chunk *c1, *c2;
+ Device **devs;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("No disks found!");
+ return;
+ }
+
+ j = p = 0;
+ for (i = 0; devs[i]; i++) {
+ if (!((Disk *)devs[i]->private)->chunks)
+ msgFatal("No chunk list found for %s!", ((Disk *)devs[i]->private)->name);
+
+ /* Put the freebsd chunks first */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ label_chunk_info[j].type = PART_SLICE;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ ++j;
+ }
+ }
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++) {
+ /* Then buzz through and pick up the partitions */
+ for (c1 = ((Disk *)devs[i]->private)->chunks->part; c1; c1 = c1->next) {
+ if (c1->type == freebsd) {
+ for (c2 = c1->part; c2; c2 = c2->next) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ label_chunk_info[j].type = PART_SWAP;
+ else
+ label_chunk_info[j].type = PART_FILESYSTEM;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c2;
+ ++j;
+ }
+ }
+ }
+ else if (c1->type == fat) {
+ label_chunk_info[j].type = PART_FAT;
+ label_chunk_info[j].d = ((Disk *)devs[i]->private);
+ label_chunk_info[j].c = c1;
+ }
+ }
+ }
+ label_chunk_info[j].d = NULL;
+ label_chunk_info[j].c = NULL;
+ if (here >= j)
+ here = j ? j - 1 : 0;
+}
+
+/* A new partition entry */
+static PartInfo *
+new_part(char *mpoint, Boolean newfs)
+{
+ PartInfo *ret;
+
+ ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
+ strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
+ strcpy(ret->newfs_cmd, "newfs");
+ ret->newfs = newfs;
+ return ret;
+}
+
+/* Get the mountpoint for a partition and save it away */
+PartInfo *
+get_mountpoint(struct chunk *parent, struct chunk *me)
+{
+ char *val;
+ PartInfo *tmp;
+
+ val = msgGetInput(me && me->private ? ((PartInfo *)me->private)->mountpoint : NULL,
+ "Please specify a mount point for the partition");
+ if (val) {
+ /* Is it just the same value? */
+ if (me && me->private && !strcmp(((PartInfo *)me->private)->mountpoint, val))
+ return NULL;
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mount point for %s assigned!", val);
+ return NULL;
+ }
+ else if (*val != '/') {
+ msgConfirm("Mount point must start with a / character");
+ return NULL;
+ }
+ else if (!strcmp(val, "/")) {
+ if (parent) {
+ if (parent->flags & CHUNK_PAST_1024) {
+ msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return NULL;
+ }
+ else if (!(parent->flags & CHUNK_BSD_COMPAT)) {
+ msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a region. Please choose another partition for this.");
+ return NULL;
+ }
+ }
+ if (me)
+ me->flags |= CHUNK_IS_ROOT;
+ }
+ else if (me)
+ me->flags &= ~CHUNK_IS_ROOT;
+ safe_free(me ? me->private : NULL);
+ tmp = new_part(val, TRUE);
+ if (me) {
+ me->private = tmp;
+ me->private_free = safe_free;
+ }
+ return tmp;
+ }
+ return NULL;
+}
+
+/* Get the type of the new partiton */
+static PartType
+get_partition_type(void)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "FS",
+ "A file system",
+ "Swap",
+ "A swap partition.",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+/* If the user wants a special newfs command for this, set it */
+static void
+getNewfsCmd(PartInfo *p)
+{
+ char *val;
+
+ val = msgGetInput(p->newfs_cmd,
+ "Please enter the newfs command and options you'd like to use in\ncreating this file system.");
+ if (val)
+ strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
+}
+
+
+#define MAX_MOUNT_NAME 12
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
+#define PART_NEWFS_COL (PART_SIZE_COL + 7)
+#define PART_OFF 38
+
+/* How many mounted partitions to display in column before going to next */
+#define CHUNK_COLUMN_MAX 6
+
+/* stick this all up on the screen */
+static void
+print_label_chunks(void)
+{
+ int i, j, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Disklabel Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2,
+ "Size");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+ pcol = 0;
+
+ for (i = 0; label_chunk_info[i].d; i++) {
+ if (i == here)
+ attrset(A_REVERSE);
+ /* Is it a slice entry displayed at the top? */
+ if (label_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(label_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ label_chunk_info[i].d->name,
+ label_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */
+ else {
+ char onestr[PART_OFF], num[10], *mountpoint, *newfs;
+
+ /*
+ * We copy this into a blank-padded string so that it looks like
+ * a solid bar in reverse-video
+ */
+ memset(onestr, ' ', PART_OFF - 1);
+ onestr[PART_OFF - 1] = '\0';
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
+ pcol = PART_OFF;
+ prow = CHUNK_PART_START_ROW;
+ }
+ memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name,
+ strlen(label_chunk_info[i].c->name));
+ /* If it's a filesystem, display the mountpoint */
+ if (label_chunk_info[i].type == PART_FILESYSTEM) {
+ if (label_chunk_info[i].c->private == NULL) {
+ static int mnt = 0;
+ char foo[10];
+
+ /*
+ * Hmm! A partition that must have already been here.
+ * Fill in a fake mountpoint and register it
+ */
+ sprintf(foo, "/mnt%d", mnt++);
+ label_chunk_info[i].c->private = new_part(foo, FALSE);
+ label_chunk_info[i].c->private_free = safe_free;
+ }
+ mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
+ newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
+ }
+ else if (label_chunk_info[i].type == PART_SWAP) {
+ mountpoint = "swap";
+ newfs = " ";
+ }
+ else if (label_chunk_info[i].type == PART_FAT) {
+ mountpoint = "DOS FAT";
+ newfs = "*";
+ }
+ else {
+ mountpoint = "<unknown>";
+ newfs = "*";
+ }
+ for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
+ onestr[PART_MOUNT_COL + j] = mountpoint[j];
+ snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ?
+ label_chunk_info[i].c->size / 2048 : 0);
+ memcpy(onestr + PART_SIZE_COL, num, strlen(num));
+ memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
+ onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
+ mvaddstr(prow, pcol, onestr);
+ ++prow;
+ }
+ if (i == here)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ mvprintw(17, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
+ mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Finish Partitioning");
+ mvprintw(21, 0, "The default target will be displayed in ");
+
+ attrset(A_REVERSE);
+ addstr("reverse video.");
+ attrset(A_NORMAL);
+ mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to move.");
+ move(0, 0);
+}
+
+void
+diskLabelEditor(char *str)
+{
+ int sz, key = 0;
+ Boolean labeling;
+ char *msg = NULL;
+ PartInfo *p;
+ PartType type;
+
+ dialog_clear();
+ labeling = TRUE;
+ keypad(stdscr, TRUE);
+ record_label_chunks();
+
+ while (labeling) {
+ clear();
+ print_label_chunks();
+ print_command_summary();
+ if (msg) {
+ attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+
+ case KEY_UP:
+ case '-':
+ if (here != 0)
+ --here;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_HOME:
+ here = 0;
+ break;
+
+ case KEY_END:
+ while (label_chunk_info[here + 1].d)
+ ++here;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("disklabel.hlp");
+ break;
+
+ case 'C':
+ if (label_chunk_info[here].type != PART_SLICE) {
+ msg = "You can only do this in a master partition (see top of screen)";
+ break;
+ }
+ sz = space_free(label_chunk_info[here].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, *cp, tmp[20];
+ int size;
+
+ snprintf(tmp, 20, "%d", sz);
+ val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
+ if (val && (size = strtol(val, &cp, 0)) > 0) {
+ struct chunk *tmp;
+ u_long flags = 0;
+
+ if (*cp && toupper(*cp) == 'M')
+ size *= 2048;
+
+ type = get_partition_type();
+ if (type == PART_NONE)
+ break;
+ else if (type == PART_FILESYSTEM) {
+ if ((p = get_mountpoint(label_chunk_info[here].c, NULL)) == NULL)
+ break;
+ else if (!strcmp(p->mountpoint, "/"))
+ flags |= CHUNK_IS_ROOT;
+ else
+ flags &= ~CHUNK_IS_ROOT;
+ }
+ else
+ p = NULL;
+
+ tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
+ label_chunk_info[here].c,
+ size, part,
+ (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
+ flags);
+ if (!tmp)
+ msgConfirm("Unable to create the partition. Too big?");
+ else {
+ tmp->private = p;
+ tmp->private_free = safe_free;
+ record_label_chunks();
+ }
+ }
+ }
+ break;
+
+ case 'D': /* delete */
+ if (label_chunk_info[here].type == PART_SLICE) {
+ msg = MSG_NOT_APPLICABLE;
+ break;
+ }
+ else if (label_chunk_info[here].type == PART_FAT) {
+ msg = "Use the Disk Partition Editor to delete this";
+ break;
+ }
+ Delete_Chunk(label_chunk_info[here].d, label_chunk_info[here].c);
+ record_label_chunks();
+ break;
+
+ case 'M': /* mount */
+ switch(label_chunk_info[here].type) {
+ case PART_SLICE:
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case PART_SWAP:
+ msg = "You don't need to specify a mountpoint for a swap partition.";
+ break;
+
+ case PART_DOS:
+ case PART_FILESYSTEM:
+ p = get_mountpoint(NULL, label_chunk_info[here].c);
+ if (p) {
+ p->newfs = FALSE;
+ record_label_chunks();
+ }
+ break;
+
+ default:
+ msgFatal("Bogus partition under cursor???");
+ break;
+ }
+ break;
+
+ case 'N': /* Set newfs options */
+ if (label_chunk_info[here].c->private &&
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs)
+ getNewfsCmd(label_chunk_info[here].c->private);
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'T': /* Toggle newfs state */
+ if (label_chunk_info[here].type == PART_FILESYSTEM &&
+ label_chunk_info[here].c->private)
+ ((PartInfo *)label_chunk_info[here].c->private)->newfs =
+ !((PartInfo *)label_chunk_info[here].c->private)->newfs;
+ else
+ msg = MSG_NOT_APPLICABLE;
+ break;
+
+ case 'W':
+ if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
+ int i;
+ Device **devs;
+
+ clear();
+ dialog_clear();
+ end_dialog();
+ DialogActive = FALSE;
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("Can't find any disk devicse!");
+ break;
+ }
+ for (i = 0; ((Disk *)devs[i]->private); i++)
+ slice_wizard(((Disk *)devs[i]->private));
+ clear();
+ dialog_clear();
+ DialogActive = TRUE;
+ record_label_chunks();
+ }
+ else
+ msg = "A most prudent choice!";
+ break;
+
+ case 27: /* ESC */
+ labeling = FALSE;
+ break;
+
+ default:
+ beep();
+ msg = "Type F1 or ? for help";
+ break;
+ }
+ }
+ variable_set2(DISK_LABELLED, "yes");
+}
+
+
+
diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c
index c5b85cd..ce9ce46 100644
--- a/usr.sbin/sysinstall/main.c
+++ b/usr.sbin/sysinstall/main.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: main.c,v 1.4 1995/05/05 23:47:42 jkh Exp $
+ * $Id: main.c,v 1.5 1995/05/07 03:38:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,10 +63,12 @@ main(int argc, char **argv)
/* Default to English */
/* lang_set_English(NULL); */
+ /*
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
+ dialog_clear();
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? System will reboot."))
break;
}
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 4e9b72a..1b360f5 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.2 1995/04/29 19:33:02 jkh Exp $
+ * $Id: media.c,v 1.3 1995/05/01 21:56:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,37 +42,56 @@
*/
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a CD.
*/
int
mediaSetCDROM(char *str)
{
+ if (OnCDROM == TRUE)
+ return 1;
+ else {
+ dmenuOpenSimple(&MenuMediaCDROM);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set(MEDIA_TYPE, "cdrom");
+ return 1;
+ }
+ }
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a floppy
*/
int
mediaSetFloppy(char *str)
{
+ dmenuOpenSimple(&MenuMediaFloppy);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set2(MEDIA_TYPE, "floppy");
+ return 1;
+ }
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a DOS partition.
*/
int
mediaSetDOS(char *str)
{
+ Device **devs;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs)
+ msgConfirm("No disk devices found!");
return 0;
}
/*
- * Return 0 if we successfully found and set the installation type to
+ * Return 1 if we successfully found and set the installation type to
* be a tape drive.
*/
int
@@ -88,6 +107,11 @@ mediaSetTape(char *str)
int
mediaSetFTP(char *str)
{
+ dmenuOpenSimple(&MenuMediaFtp);
+ if (getenv(MEDIA_DEVICE)) {
+ variable_set2(MEDIA_TYPE, "ftp");
+ return 1;
+ }
return 0;
}
@@ -100,3 +124,85 @@ mediaSetFS(char *str)
{
return 0;
}
+
+Boolean
+mediaGetType(void)
+{
+ extern DMenu MenuMedia;
+ char *cp;
+
+ dmenuOpenSimple(&MenuMedia);
+ cp = getenv(MEDIA_TYPE);
+ if (!cp)
+ return FALSE;
+ return TRUE;
+}
+
+FILE *
+mediaOpen(char *parent, *char *me)
+{
+ char fname[FILENAME_MAX];
+ FILE *fp;
+
+ if (!getenv(MEDIA_TYPE)) {
+ if (!mediaGetType())
+ return NULL;
+ }
+ if (!getenv(MEDIA_DEVICE)) {
+ msgConfirm("No media device has been set up!?\nPlease configure a device from the media type menu.");
+ return NULL;
+ }
+ if (parent)
+ snprintf(fname, FILENAME_MAX, "%s%s", parent, me);
+ else
+ strncpy(fname, me, FILENAME_MAX);
+ /* XXX find a Device here XXX */
+}
+
+/* Various media "get" routines */
+Boolean
+mediaUFSGet(char *dist)
+{
+ return TRUE;
+}
+
+Boolean
+mediaCDROMGet(char *dist)
+{
+ return TRUE;
+}
+
+Boolean
+mediaTapeInit(void)
+{
+ return TRUE;
+}
+
+Boolean
+mediaTapeGet(char *dist)
+{
+ return TRUE;
+}
+
+void
+mediaTapeClose(void)
+{
+}
+
+Boolean
+mediaNetworkInit(void)
+{
+ return TRUE;
+}
+
+Boolean
+mediaNetworkGet(char *dist)
+{
+ return TRUE;
+}
+
+void
+mediaNetworkClose(void)
+{
+}
+
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index 40093ee..f2da40b 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.11 1995/05/11 06:10:54 jkh Exp $
+ * $Id: menus.c,v 1.12 1995/05/11 06:47:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,7 +52,9 @@
/* Forward decls for submenus */
extern DMenu MenuDocumentation;
-extern DMenu MenuLanguage;
+extern DMenu MenuOptions;
+extern DMenu MenuOptionsLanguage;
+extern DMenu MenuOptionsFtp;
extern DMenu MenuMedia;
extern DMenu MenuInstallType;
extern DMenu MenuInstallOptions;
@@ -62,7 +64,6 @@ extern DMenu MenuXF86SelectCore;
extern DMenu MenuXF86SelectServer;
extern DMenu MenuXF86SelectFonts;
extern DMenu MenuXF86;
-extern DMenu MenuInstallFtpOptions;
/* The initial installation menu */
DMenu MenuInitial = {
@@ -74,42 +75,42 @@ first character of the option name you're interested in. Invoke an\n\
option by pressing enter. If you'd like a shell, press ESC", /* prompt */
"Press F1 for usage instructions", /* help line */
"usage.hlp", /* help file */
-{ { "Usage", "Quick start - How to use this menu system.", /* U */
+ { { "Usage", "Quick start - How to use this menu system.", /* U */
DMENU_DISPLAY_FILE, (void *)"usage.hlp", 0, 0 },
- { "Doc", "More detailed documentation on FreeBSD.", /* D */
+ { "Doc", "More detailed documentation on FreeBSD.", /* D */
DMENU_SUBMENU, (void *)&MenuDocumentation, 0, 0 },
- { "Lang", "Select natural language options.", /* L */
- DMENU_SUBMENU, (void *)&MenuLanguage, 0, 0 },
- { "Install", "Begin installation", /* I */
+ { "Options", "Select options for this utility.", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0 },
+ { "Install", "Begin installation", /* I */
DMENU_CALL, (void *)installCustom, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main documentation menu */
DMenu MenuDocumentation = {
-DMENU_NORMAL_TYPE,
-"Documentation for FreeBSD 2.0.5", /* Title */
-"If you are at all unsure about the configuration of your hardware\n\
+ DMENU_NORMAL_TYPE,
+ "Documentation for FreeBSD 2.0.5", /* Title */
+ "If you are at all unsure about the configuration of your hardware\n\
or are looking to build a system specifically for FreeBSD, read the\n\
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.",
-"Confused? Press F1 for help.",
-"usage.hlp", /* help file */
-{ { "README", "Read this for a general description of FreeBSD", /* R */
+ "Confused? Press F1 for help.",
+ "usage.hlp", /* help file */
+ { { "README", "Read this for a general description of FreeBSD", /* R */
DMENU_DISPLAY_FILE, (void *)"README", 0, 0 },
- { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
+ { "Hardware", "The FreeBSD survival guide for PC hardware.", /* H */
DMENU_DISPLAY_FILE, (void *)"hardware.hlp", 0, 0 },
- { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
+ { "Install", "A step-by-step guide to installing FreeBSD.", /* I */
DMENU_DISPLAY_FILE, (void *)"install.hlp", 0, 0 },
- { "Copyright", "The FreeBSD Copyright notices.", /* C */
+ { "Copyright", "The FreeBSD Copyright notices.", /* C */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "Release", "The release notes for this version of FreeBSD.", /* R */
+ { "Release", "The release notes for this version of FreeBSD.", /* R */
DMENU_DISPLAY_FILE, (void *)"COPYRIGHT", 0, 0 },
- { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
+ { "FAQ", "Frequently Asked Questions about FreeBSD.", /* F */
DMENU_DISPLAY_FILE, (void *)"faq.hlp", 0, 0 },
- { NULL } },
+ { NULL } },
};
/*
@@ -119,451 +120,457 @@ answers in the FAQ.",
* name starts with `*', it's considered to be "ON" by default,
* otherwise off.
*/
-DMenu MenuLanguage = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Natural language selection", /* title */
-"Please specify the language you'd like to use by default.\n\n\
+DMenu MenuOptionsLanguage = {
+ DMENU_NORMAL_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 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. This feature is nonetheless considered\n\
to be in experimental status at this time.", /* prompt */
-"Press F1 for more information", /* help line */
-"language.hlp", /* help file */
-{ { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
+ "Press F1 for more information", /* help line */
+ "language.hlp", /* help file */
+ { { "Danish", "Danish language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Danish, 0, 0 },
- { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
+ { "Dutch", "Dutch language and character set (ISO-8859-1)", /* D */
DMENU_CALL, (void *)lang_set_Dutch, 0, 0 },
- { "English", "English language (system default)", /* E */
+ { "English", "English language (system default)", /* E */
DMENU_CALL, (void *)lang_set_English, 0, 0 },
- { "French", "French language and character set (ISO-8859-1)", /* F */
+ { "French", "French language and character set (ISO-8859-1)", /* F */
DMENU_CALL, (void *)lang_set_French, 0, 0 },
- { "German", "German language and character set (ISO-8859-1)", /* G */
+ { "German", "German language and character set (ISO-8859-1)", /* G */
DMENU_CALL, (void *)lang_set_German, 0, 0 },
- { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
+ { "Italian", "Italian language and character set (ISO-8859-1)", /* I */
DMENU_CALL, (void *)lang_set_Italian, 0, 0 },
- { "Japanese", "Japanese language and default character set (romaji)",/* J */
+ { "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0, 0 },
- { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
DMENU_CALL, (void *)lang_set_Norwegian, 0, 0 },
- { "Russian", "Russian language and character set (cp866-8x14)", /* R */
+ { "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0, 0 },
- { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
+ { "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Spanish, 0, 0 },
- { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
+ { "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
DMENU_CALL, (void *)lang_set_Swedish, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaCDROM = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose a CDROM type",
-"FreeBSD can be installed directly from a CDROM containing a valid\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose a CDROM type",
+ "FreeBSD can be installed directly from a CDROM containing a valid\n\
FreeBSD 2.0.5 distribution. If you're seeing this menu, it's because\n\
your CDROM drive was not properly auto-detected, or you did not launch\n\
this installation from the CD under DOS or Windows. If you think you are\n
seeing this dialog in error, you may wish to reboot FreeBSD with the\n\
-c boot flag (.. boot: /kernel -c) and check that your hardware and\n\
the kernel agree on reasonable values.",
-"Press F1 for more information on CDROM support",
-"media_cdrom.hlp",
-{ { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
+ "Press F1 for more information on CDROM support",
+ "media_cdrom.hlp",
+ { { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/matcd0a", 0, 0 },
- { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
+ { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/mcd0a", 0, 0 },
- { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
+ { "SCSI", "SCSI CDROM drive attached to supported SCSI controller",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/cd0a", 0, 0 },
- { "Sony", "Sony CDU31/33A or compatible CDROM drive",
+ { "Sony", "Sony CDU31/33A or compatible CDROM drive",
DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/scd0a", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuMediaFTP = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Please specify an FTP site",
-"FreeBSD is distributed from a number of sites on the Internet.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Please specify an FTP site",
+ "FreeBSD is distributed from a number of sites on the Internet.\n\
Please select the site closest to you or \"other\" if you'd like\n\
to specify another choice. Also note that not all sites carry\n\
every possible distribution! Distributions other than the basic\n\
binary set are only guaranteed to be available from the Primary site.\n\
If the first site selected doesn't respond, try one of the alternates.",
-"Select a site that's close!",
-"media_ftp.hlp",
-{ { "Primary", "ftp.freebsd.org",
+ "Select a site that's close!",
+ "media_ftp.hlp",
+ { { "Primary", "ftp.freebsd.org",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.freebsd.org/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Secondary", "freefall.cdrom.com",
+ { "Secondary", "freefall.cdrom.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://freefall.cdrom.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Australia", "ftp.physics.usyd.edu.au",
+ { "Australia", "ftp.physics.usyd.edu.au",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.physics.usyd.edu.au/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Finland", "nic.funet.fi",
+ { "Finland", "nic.funet.fi",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://nic.funet.fi/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "France", "ftp.ibp.fr",
+ { "France", "ftp.ibp.fr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ibp.fr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Germany", "ftp.uni-duisburg.de",
+ { "Germany", "ftp.uni-duisburg.de",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.uni-duisburg.de/pub/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Israel", "orgchem.weizmann.ac.il",
+ { "Israel", "orgchem.weizmann.ac.il",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://orgchem.weizmann.ac.il/pub/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan", "ftp.sra.co.jp",
+ { "Japan", "ftp.sra.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.sra.co.jp/pub/os/FreeBSD/distribution/2.0.5-ALPHA", 0, 0 },
- { "Japan-2", "ftp.mei.co.jp",
+ { "Japan-2", "ftp.mei.co.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-3", "ftp.waseda.ac.jp",
+ { "Japan-3", "ftp.waseda.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.waseda.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-4", "ftp.pu-toyama.ac.jp",
+ { "Japan-4", "ftp.pu-toyama.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-5", "ftpsv1.u-aizu.ac.jp",
+ { "Japan-5", "ftpsv1.u-aizu.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Japan-6", "tutserver.tutcc.tut.ac.jp",
+ { "Japan-6", "tutserver.tutcc.tut.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://tutserver.tutcc.tut.ac.jp/FreeBSD/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Japan-7", "ftp.ee.uec.ac.jp",
+ { "Japan-7", "ftp.ee.uec.ac.jp",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other/FreeBSD-2.0.5-ALPHA", 0, 0 },
- { "Korea", "ftp.cau.ac.kr",
+ { "Korea", "ftp.cau.ac.kr",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.cau.ac.kr/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Netherlands", "ftp.nl.net",
+ { "Netherlands", "ftp.nl.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nl.net/pub/os/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Russia", "ftp.kiae.su",
+ { "Russia", "ftp.kiae.su",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.kiae.su/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Sweden", "ftp.luth.se",
+ { "Sweden", "ftp.luth.se",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.luth.se/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Taiwan", "netbsd.csie.nctu.edu.tw",
+ { "Taiwan", "netbsd.csie.nctu.edu.tw",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Thailand", "ftp.nectec.or.th",
+ { "Thailand", "ftp.nectec.or.th",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.nectec.or.th/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK", "ftp.demon.co.uk",
+ { "UK", "ftp.demon.co.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-2", "src.doc.ic.ac.uk",
+ { "UK-2", "src.doc.ic.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "UK-3", "unix.hensa.ac.uk",
+ { "UK-3", "unix.hensa.ac.uk",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA", "ref.tfs.com",
+ { "USA", "ref.tfs.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ref.tfs.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-2", "ftp.dataplex.net",
+ { "USA-2", "ftp.dataplex.net",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.dataplex.net/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-3", "kryten.atinc.com",
+ { "USA-3", "kryten.atinc.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://kryten.atinc.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "USA-4", "ftp.neosoft.com",
+ { "USA-4", "ftp.neosoft.com",
DMENU_SET_VARIABLE, (void *)"mediaDevice=ftp://ftp.neosoft.com/systems/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { NULL } }
+ { NULL } }
};
/* The media selection menu */
DMenu MenuMedia = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Media",
-"FreeBSD can be installed from a variety of different installation\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Media",
+ "FreeBSD can be installed from a variety of different installation\n\
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.",
-"Press F1 for more information on the various media types",
-"media.hlp",
-{ { "CDROM", "Install from a FreeBSD CDROM",
+ "Press F1 for more information on the various media types",
+ "media.hlp",
+ { { "CDROM", "Install from a FreeBSD CDROM",
DMENU_CALL, (void *)mediaSetCDROM, 0, 0 },
- { "Floppy", "Install from a floppy disk set",
+ { "Floppy", "Install from a floppy disk set",
DMENU_CALL, (void *)mediaSetFloppy, 0, 0 },
- { "DOS", "Install from a DOS partition",
+ { "DOS", "Install from a DOS partition",
DMENU_CALL, (void *)mediaSetDOS, 0, 0 },
- { "Tape", "Install from SCSI or QIC tape",
+ { "Tape", "Install from SCSI or QIC tape",
DMENU_CALL, (void *)mediaSetTape, 0, 0 },
- { "FTP", "Install from an Internet FTP server",
+ { "FTP", "Install from an Internet FTP server",
DMENU_CALL, (void *)mediaSetFTP, 0, 0 },
- { "File System", "Install from a UFS or NFS mounted distribution",
+ { "File System", "Install from a UFS or NFS mounted distribution",
DMENU_CALL, (void *)mediaSetFS, 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The installation type menu */
DMenu MenuInstallType = {
-DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Installation Type",
-"As a convenience, we provide several `canned' installation types.\n\
+ DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Installation Type",
+ "As a convenience, we provide several `canned' installation types.\n\
These pick what we consider to be the most reasonable defaults for the\n\
type of system in question. If you would prefer to pick and choose\n\
the list of distributions yourself, simply select `custom'.",
-"Press F1 for more information on the various distributions",
-"dist_types.hlp",
-{ { "Developer", "Includes full sources, binaries and doc but no games.",
+ "Press F1 for more information on the various distributions",
+ "dist_types.hlp",
+ { { "Developer", "Includes full sources, binaries and doc but no games.",
DMENU_CALL, (void *)distSetDeveloper, 0, 0 },
- { "X-Developer", "Same as above, but includes XFree86.",
+ { "X-Developer", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXDeveloper, 0, 0 },
- { "User", "General user. Binaries and doc but no sources.",
+ { "User", "General user. Binaries and doc but no sources.",
DMENU_CALL, (void *)distSetUser, 0, 0 },
- { "X-User", "Same as above, but includes XFree86.",
+ { "X-User", "Same as above, but includes XFree86.",
DMENU_CALL, (void *)distSetXUser, 0, 0 },
- { "Minimal", "The smallest configuration possible.",
+ { "Minimal", "The smallest configuration possible.",
DMENU_CALL, (void *)distSetMinimum, 0, 0 },
- { "Everything", "The entire source and binary distribution.",
+ { "Everything", "The entire source and binary distribution.",
DMENU_CALL, (void *)distSetEverything, 0, 0 },
- { "Custom", "Specify your own distribution set",
+ { "Custom", "Specify your own distribution set",
DMENU_SUBMENU, (void *)&MenuDistributions, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"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_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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_SET_FLAG, (void *)&Dists, DIST_BIN, 0 },
- { "commercial", "Commercial demos and shareware",
+ { "commercial", "Commercial demos and shareware",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMMERCIAL, 0 },
- { "compat1x", "FreeBSD 1.x binary compatability package",
+ { "compat1x", "FreeBSD 1.x binary compatability package",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMPAT1X, 0 },
- { "DES", "DES encryption code and sources",
+ { "DES", "DES encryption code and sources",
DMENU_SET_FLAG, (void *)&Dists, DIST_DES, 0 },
- { "dict", "Spelling checker disctionary files",
+ { "dict", "Spelling checker disctionary files",
DMENU_SET_FLAG, (void *)&Dists, DIST_DICT, 0 },
- { "games", "Games and other amusements (non-commercial)",
+ { "games", "Games and other amusements (non-commercial)",
DMENU_SET_FLAG, (void *)&Dists, DIST_GAMES, 0 },
- { "info", "GNU info files",
+ { "info", "GNU info files",
DMENU_SET_FLAG, (void *)&Dists, DIST_INFO, 0 },
- { "*man", "System manual pages - strongly recommended",
+ { "*man", "System manual pages - strongly recommended",
DMENU_SET_FLAG, (void *)&Dists, DIST_MANPAGES, 0 },
- { "proflibs", "Profiled versions of the libraries",
+ { "proflibs", "Profiled versions of the libraries",
DMENU_SET_FLAG, (void *)&Dists, DIST_PROFLIBS, 0 },
- { "src", "Sources for everything but DES",
+ { "src", "Sources for everything but DES",
DMENU_CALL, (void *)distSetSrc, 0 },
- { "XFree86", "The XFree86 3.1.1L distribution",
+ { "XFree86", "The XFree86 3.1.1L distribution",
DMENU_SUBMENU, (void *)&MenuXF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuSrcDistributions = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select the sub-components of src you wish to install.",
-"Please check off those portions of the FreeBSD source tree\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Select the sub-components of src you wish to install.",
+ "Please check off those portions of the FreeBSD source tree\n\
you wish to install. A brief description of each source\n\
hierarchy is contained in parenthesis below.",
-"Press F1 for a more complete description of distributions.",
-"distribution_types.hlp",
-{ { "base", "Base src directory (top-level files in /usr/src)",
+ "Press F1 for a more complete description of distributions.",
+ "distribution_types.hlp",
+ { { "base", "Base src directory (top-level files in /usr/src)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_BASE, 0 },
- { "gnu", "/usr/src/gnu (user software from the GNU Project)",
+ { "gnu", "/usr/src/gnu (user software from the GNU Project)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GNU, 0 },
- { "etc", "/usr/src/etc (miscellaneous system files)",
+ { "etc", "/usr/src/etc (miscellaneous system files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_ETC, 0 },
- { "games", "/usr/src/games (games)",
+ { "games", "/usr/src/games (games)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_GAMES, 0 },
- { "include", "/usr/src/include (header files)",
+ { "include", "/usr/src/include (header files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_INCLUDE, 0 },
- { "lib", "/usr/src/lib (system libraries)",
+ { "lib", "/usr/src/lib (system libraries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIB, 0 },
- { "libexec", "/usr/src/libexec (various system programs)",
+ { "libexec", "/usr/src/libexec (various system programs)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LIBEXEC, 0 },
- { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
+ { "lkm", "/usr/src/lkm (Loadable Kernel Modules)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_LKM, 0 },
- { "release", "/usr/src/release (release-generation tools)",
+ { "release", "/usr/src/release (release-generation tools)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_RELEASE, 0 },
- { "sbin", "/usr/src/sbin (system binaries)",
+ { "sbin", "/usr/src/sbin (system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SBIN, 0 },
- { "share", "/usr/src/share (documents and shared files)",
+ { "share", "/usr/src/share (documents and shared files)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SHARE, 0 },
- { "sys", "/usr/src/sys (FreeBSD kernel)",
+ { "sys", "/usr/src/sys (FreeBSD kernel)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_SYS, 0 },
- { "ubin", "/usr/src/usr.bin (user binaries)",
+ { "ubin", "/usr/src/usr.bin (user binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_UBIN, 0 },
- { "usbin", "/usr/src/usr.sbin (aux system binaries)",
+ { "usbin", "/usr/src/usr.sbin (aux system binaries)",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_USBIN, 0 },
- { "XFree86", "XFree86 3.1.1L source + contrib distribution",
+ { "XFree86", "XFree86 3.1.1L source + contrib distribution",
DMENU_SET_FLAG, (void *)&SrcDists, DIST_SRC_XF86, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86 = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
Project, Inc. Our recommended sequence is to Select the desired\n\
release components, Configure XFree86 and then (optionally)\n\
Start it up!",
-"Press F1 to read the XFree86 release notes for FreeBSD",
-"XFree86.hlp",
-{ { "Select", "Select and load components of the XFree86 distribution",
+ "Press F1 to read the XFree86 release notes for FreeBSD",
+ "XFree86.hlp",
+ { { "Select", "Select and load components of the XFree86 distribution",
DMENU_SUBMENU, &MenuXF86Select, 0, 0 },
- { "Configure", "Configure an installed XFree86 distribution",
+ { "Configure", "Configure an installed XFree86 distribution",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config",
0, 0 },
- { "Start", "Try to start the server up",
+ { "Start", "Try to start the server up",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin startx",
0, 0 },
- { NULL } }
+ { NULL } }
};
DMenu MenuXF86Select = {
-DMENU_NORMAL_TYPE,
-"XFree86 3.1.1u1 Distribution",
-"Please select the components you need from the XFree86 3.1.1u1\n\
+ DMENU_NORMAL_TYPE,
+ "XFree86 3.1.1u1 Distribution",
+ "Please select the components you need from the XFree86 3.1.1u1\n\
distribution. Select what you need from the basic components set\n\
and at least one entry from the Server menu and the Font set menu\n",
-"Press F1 for a sample sequence",
-"XF86Select.hlp",
-{ { "Core", "Basic component menu (required)",
+ "Press F1 for a sample sequence",
+ "XF86Select.hlp",
+ { { "Core", "Basic component menu (required)",
DMENU_SUBMENU, &MenuXF86SelectCore, 0, 0 },
- { "Server", "X server menu",
+ { "Server", "X server menu",
DMENU_SUBMENU, &MenuXF86SelectServer, 0, 0 },
- { "Fonts", "Font set menu",
+ { "Fonts", "Font set menu",
DMENU_SUBMENU, &MenuXF86SelectFonts, 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectCore = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"XFree86 3.1.1 base distribution types",
-"Please check off the basic XFree86 components you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "XFree86 3.1.1 base distribution types",
+ "Please check off the basic XFree86 components you wish to install.\n\
Those deemed most generally useful are already checked off for you.",
-NULL,
-NULL,
-{ { "*bin", "X client applications and shared libs [4MB].",
+ NULL,
+ NULL,
+ { { "*bin", "X client applications and shared libs [4MB].",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_BIN, 0 },
- { "*lib", "Data files needed at runtime [0.6MB]",
+ { "*lib", "Data files needed at runtime [0.6MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LIB, 0 },
- { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
+ { "xicf", "Customizable xinit runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XINIT, 0 },
- { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
+ { "xdcf", "Customizable xdm runtime configuration file [0.1MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_XDMCF, 0 },
- { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
+ { "doc", "READMEs and XFree86 specific man pages [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_DOC, 0 },
- { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
+ { "*man", "Man pages (except XFree86 specific ones) [1.2MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_MAN, 0 },
- { "prog", "Programmer's header and library files [4MB]",
+ { "prog", "Programmer's header and library files [4MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PROG, 0 },
- { "link", "X Server reconfiguration kit [7.8MB]",
+ { "link", "X Server reconfiguration kit [7.8MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_LINK, 0 },
- { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
+ { "pex", "PEX fonts and libs needed by PEX apps [0.5MB]",
DMENU_SET_FLAG, (void *)&XF86Dists, DIST_XF86_PEX, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectFonts = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Font distribution selection.",
-"Please check off the individual font distributions you wish to\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "Font distribution selection.",
+ "Please check off the individual font distributions you wish to\n\
install. At the minimum, you should certainly install the standard\n\
75 DPI and misc fonts if you're also installing a server.",
-NULL,
-NULL,
-{ { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
+ NULL,
+ NULL,
+ { { "*fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_MISC, 0 },
- { "f100", "100 DPI fonts [1.8MB]",
+ { "f100", "100 DPI fonts [1.8MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_100, 0 },
- { "fscl", "Speedo and Type scalable fonts [1.6MB]",
+ { "fscl", "Speedo and Type scalable fonts [1.6MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SCALE, 0 },
- { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
+ { "non", "Japanese, Chinese and other non-english fonts [3.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_NON, 0 },
- { "server", "Font server [0.3MB]",
+ { "server", "Font server [0.3MB]",
DMENU_SET_FLAG, (void *)&XF86FontDists, DIST_XF86_FONTS_SERVER, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuXF86SelectServer = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"X Server selection.",
-"Please check off the types of X servers you wish to install.\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "X Server selection.",
+ "Please check off the types of X servers you wish to install.\n\
If you are unsure as which server will work for your graphics card,\n\
it is recommended that try the SVGA or VGA16 servers (the VGA16 and\n\
Mono servers are also particularly well-suited to most LCD displays).",
-"xservers.hlp",
-"Press F1 for more information on the various X server types",
-{ { "*SVGA", "Standard VGA or Super VGA display",
+ "xservers.hlp",
+ "Press F1 for more information on the various X server types",
+ { { "*SVGA", "Standard VGA or Super VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_SVGA, 0 },
- { "VGA16", "Standard 16 color VGA display",
+ { "VGA16", "Standard 16 color VGA display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_VGA16, 0 },
- { "Mono", "Standard Monochrome display",
+ { "Mono", "Standard Monochrome display",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MONO, 0 },
- { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
+ { "8514", "8-bit (256 color) IBM 8514 or compatible card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_8514, 0 },
- { "AGX", "8-bit AGX card",
+ { "AGX", "8-bit AGX card",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_AGX, 0 },
- { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
+ { "Mch3", "8 and 16-bit (65K color) for ATI Mach32 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH32, 0 },
- { "Mch8", "8-bit ATI Mach8 card.",
+ { "Mch8", "8-bit ATI Mach8 card.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_MACH8, 0 },
- { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
+ { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_P9000, 0 },
- { "S3", "8, 16 and 24-bit color for S3 based boards",
+ { "S3", "8, 16 and 24-bit color for S3 based boards",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_S3, 0 },
- { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
+ { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards.",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_W32, 0 },
- { "nest", "A nested server for testing purposes",
+ { "nest", "A nested server for testing purposes",
DMENU_SET_FLAG, (void *)&XF86ServerDists, DIST_XF86_SERVER_NEST, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuDiskDevices = {
-DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
-"Select Drive(s)",
-"Please select the drive, or drives, on which you wish to install\n\
+ DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
+ "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', or have multiple operating\n\
systems on your machine, you will have the option to install a boot\n\
manager later.",
-"Press F1 for more information on what you see here.",
-"drives.hlp",
-{ { NULL } },
+ "Press F1 for more information on what you see here.",
+ "drives.hlp",
+ { { NULL } },
};
/* The installation options menu */
-DMenu MenuInstallOptions = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options",
-"This menu controls how the FreeBSD installation will deal with various\n\
+DMenu MenuOptions = {
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options",
+ "This menu controls how the FreeBSD installation will deal with various\n\
error conditions, should they arise, and the degree to which you, the\n\
user, will be prompted for options.",
-NULL,
-NULL,
-{ { "Ftp Options", "Ftp options menu",
- DMENU_SUBMENU, (void *)&MenuInstallFtpOptions, 0, 0 },
- { "NFS Secure", "NFS server talks only on a secure port",
+ NULL,
+ NULL,
+ { { "Ftp Options", "Ftp options menu",
+ DMENU_SUBMENU, (void *)&MenuOptionsFtp, 0, 0 },
+ { "Language", "Select your preferred language",
+ DMENU_SUBMENU, (void *)&MenuOptionsLanguage, 0, 0 }
+ { "NFS Secure", "NFS server talks only on a secure port",
DMENU_SET_VARIABLE, (void *)"nfsServerSecure=yes", 0, 0 },
- { "NFS Slow", "User is using a slow PC or ethernet card",
+ { "NFS Slow", "User is using a slow PC or ethernet card",
DMENU_SET_VARIABLE, (void *)"nfsSlowPC=yes", 0, 0 },
- { "Extra Debugging", "Toggle the extra debugging flag",
+ { "Extra Debugging", "Toggle the extra debugging flag",
DMENU_SET_VARIABLE, (void *)"debug=yes", 0, 0 },
- { "No Debugging", "Turn the extra debugging flag off",
+ { "No Debugging", "Turn the extra debugging flag off",
DMENU_SET_VARIABLE, (void *)"debug=no", 0, 0 },
- { NULL } },
+ { NULL } },
};
DMenu MenuInstallFtpOptions = {
-DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
-"Choose Ftp Options",
-"In case of ftp failure, how would you like this installation\n\
+ DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS,
+ "Choose Ftp Options",
+ "In case of ftp failure, how would you like this installation\n\
to deal with it? You have one of several choices:",
-NULL,
-NULL,
-{ { "*Ftp Retry", "On transfer failure, retry same host",
+ NULL,
+ NULL,
+ { { "*Ftp Retry", "On transfer failure, retry same host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=loop", 0, 0 },
- { "Ftp Reselect", "On transfer failure, ask for another host",
+ { "Ftp Reselect", "On transfer failure, ask for another host",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=reselect", 0, 0 },
- { "Ftp Abort", "On transfer failure, abort installation",
+ { "Ftp Abort", "On transfer failure, abort installation",
DMENU_SET_VARIABLE, (void *)"ftpRetryType=abort", 0, 0 },
- { NULL } },
+ { NULL } },
};
/* The main installation menu */
DMenu MenuInstall = {
-DMENU_NORMAL_TYPE,
-"Choose Installation Options", /* title */
-"Before installation can continue, you need to specify a few items\n\
+ DMENU_NORMAL_TYPE,
+ "Choose Installation Options", /* title */
+ "Before installation can continue, you need to specify a few items\n\
of information regarding the type of distribution you wish to have\n\
and from where you wish to install it. There are also a number\n\
of options you can specify in the Options menu which will determine\n\
-how . If you do not wish to install FreeBSD at this time, you may\n\
+how. You may choose install FreeBSD at this time, you may\n\
select Cancel to leave this menu.",
-"You may also wish to read the install guide - press F1 to do so",
-"install.hlp",
-{ { "Media", "Choose Installation media type", /* M */
- DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
- { "Type", "Choose the type of installation you want", /* T */
+ "You may also wish to read the install guide - press F1 to do so",
+ "install.hlp",
+ { { "Distributions", "Choose the type of installation you want", /* T */
DMENU_SUBMENU, (void *)&MenuInstallType, 0, 0 },
- { "Options", "Specify installation options", /* O */
- DMENU_SUBMENU, (void *)&MenuInstallOptions, 0, 0},
- { "Proceed", "Proceed with installation", /* P */
+ { "Media", "Choose the installation media type", /* M */
+ DMENU_SUBMENU, (void *)&MenuMedia, 0, 0 },
+ { "Partition", "Go to the Disk Partition Editor", /* P */
+ DMENU_CALL, (void *)diskPartitionEditor, 0, 0 },
+ { "Label", "Label the contents of disk partitions", /* L */
+ DMENU_CALL, (void *)diskLabelEditor, 0, 0 },
+ { "GO!", "Start the whole show and go out for coffee!", /* P */
DMENU_CANCEL, (void *)NULL, 0, 0 },
- { NULL } },
+ { "Options", "Set special installation options", /* O */
+ DMENU_SUBMENU, (void *)&MenuOptions, 0, 0},
+ { NULL } },
};
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index f71ea32..73579e3 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.14 1995/05/08 21:39:40 jkh Exp $
+ * $Id: sysinstall.h,v 1.15 1995/05/10 07:45:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,11 +66,33 @@
#define VAR_VALUE_MAX 1024
/* device limits */
-#define DEV_NAME_MAX 128
+#define DEV_NAME_MAX 128 /* The maximum length of a device name */
+#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
+#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
+
+
+/* Internal flag variables */
+#define DISK_PARTITIONED "_diskPartitioned"
+#define DISK_LABELLED "_diskLabelled"
+#define TCP_CONFIGURED "_tcpConfigured"
+#define NO_CONFIRMATION "_noConfirmation"
+#define MEDIA_DEVICE "mediaDevice"
+#define MEDIA_TYPE "mediaType"
+
+#define VAR_HOSTNAME "hostname"
+#define VAR_DOMAINNAME "domainname"
+#define VAR_IPADDR "ip_addr"
+#define VAR_NAMESERVER "nameserver"
+
+#define VAR_IFCONFIG_ARGS "if_flags"
+#define VAR_NETMASK "netmask"
+#define VAR_GATEWAY "gateway"
/*** Types ***/
typedef unsigned int Boolean;
+typedef struct disk Disk;
+typedef struct chunk Chunk;
typedef enum {
DMENU_SHELL_ESCAPE, /* Fork a shell */
@@ -117,8 +139,6 @@ typedef enum {
DEVICE_TYPE_NETWORK,
DEVICE_TYPE_CDROM,
DEVICE_TYPE_TAPE,
- DEVICE_TYPE_SERIAL,
- DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
@@ -126,6 +146,11 @@ typedef enum {
typedef struct _device {
char name[DEV_NAME_MAX];
DeviceType type;
+ Boolean enabled;
+ int (*deviceInit)(void);
+ int (*deviceGet)(char *fname);
+ int (*deviceClose)(void);
+ void *devicePrivate;
} Device;
/* Some internal representations of partitions */
@@ -133,7 +158,8 @@ typedef enum {
PART_NONE,
PART_SLICE,
PART_SWAP,
- PART_FILESYSTEM
+ PART_FILESYSTEM,
+ PART_FAT,
} PartType;
/* The longest newfs command we'll hand to system() */
@@ -145,6 +171,8 @@ typedef struct _part_info {
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;
+typedef int (*commandFunc)(char *key, void *data);
+
/*** Externs ***/
extern int CpioFD; /* The file descriptor for our CPIO floppy */
@@ -161,7 +189,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists;/* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
-extern struct disk *Disks[]; /* The disks we're working on */
+extern Device *Devices[]; /* The devices we have to work with */
/*** Prototypes ***/
@@ -169,7 +197,8 @@ extern struct disk *Disks[]; /* The disks we're working on */
extern void command_clear(void);
extern void command_sort(void);
extern void command_execute(void);
-extern void command_add(char *key, char *fmt, ...);
+extern void command_shell_add(char *key, char *fmt, ...);
+extern void command_func_add(char *key, commandFunc func, void *data);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
@@ -177,17 +206,11 @@ extern Boolean dispatch(DMenuItem *tmp, char *name);
extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
/* devices.c */
-extern struct disk *device_slice_disk(struct disk *d);
-extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)());
+extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
+extern Device *deviceGetInfo(DeviceType which);
/* disks.c */
-extern void partition_disks(void);
-extern int write_disks(void);
-extern void make_filesystems(void);
-extern void cpio_extract(void);
-extern void extract_dists(void);
-extern void install_configuration_files(void);
-extern void do_final_setup(void);
+extern int diskPartitionEditor(Disk *disk);
/* dist.c */
extern int distSetDeveloper(char *str);
@@ -202,6 +225,7 @@ extern void distExtractAll(void);
/* dmenu.c */
extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
int *curr, int *max);
+extern void dmenuOpenSimple(DMenu *menu);
/* globals.c */
extern void globalsInit(void);
@@ -224,6 +248,9 @@ extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* label.c */
+extern void diskLabelEditor(char *str);
+
/* makedevs.c (auto-generated) */
extern const char termcap_vt100[];
extern const char termcap_cons25[];
@@ -294,7 +321,7 @@ extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
/* wizard.c */
-extern void slice_wizard(struct disk *d);
+extern void slice_wizard(Disk *d);
#endif
/* _SYSINSTALL_H_INCLUDE */
diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c
new file mode 100644
index 0000000..0c8ab34
--- /dev/null
+++ b/usr.sbin/sysinstall/tcpip.c
@@ -0,0 +1,326 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 1995
+ * Gary J Palmer. 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 Gary J Palmer
+ * for the FreeBSD Project.
+ * 4. The name of Gary J Palmer 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 GARY J PALMER ``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 GARY J PALMER 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <string.h>
+#include <dialog.h>
+#include "ui_objects.h"
+#include "dir.h"
+#include "dialog.priv.h"
+#include "colors.h"
+#include "rc.h"
+
+static char hostname[256], domainname[256],
+ ipaddr[32], netmask[32], gateway[32],
+ dns[32], extras[256];
+static int okbutton, cancelbutton;
+
+#define TCP_DIALOG_Y 0
+#define TCP_DIALOG_X 8
+#define TCP_DIALOG_WIDTH COLS - 16
+#define TCP_DIALOG_HEIGHT LINES - 2
+
+/* The names of the available interfaces, for the list */
+char *iface_names[MAX_INTERFACE];
+
+typedef struct _interface {
+ char *name;
+ Device *dev;
+} Interface;
+
+typedef struct _layout {
+ int y;
+ int x;
+ int len;
+ int maxlen;
+ char *prompt;
+ char *help;
+ void *var;
+ int type;
+ void *obj;
+} Layout;
+
+static Layout layout[] = {
+{ 2, 2, 25, 255,
+ "Host name:", "The name of your machine on a network, e.g. foo.bar.com",
+ hostname, STRINGOBJ, NULL },
+{ 2, 35, 20, 255,
+ "Domain name:",
+ "The name of the domain that your machine is in, e.g. bar.com",
+ domainname, STRINGOBJ, NULL },
+{ 5, 2, 18, 15,
+ "Gateway:",
+ "IP address of host forwarding packets to non-local hosts or nets",
+ gateway, STRINGOBJ, NULL },
+{ 5, 35, 18, 15,
+ "Name server:", "IP address of your local DNS server",
+ dns, STRINGOBJ, NULL },
+{ 8, 2, 10, 6,
+ "Interface:", "One of potentially several network interfaces",
+ ifaces, LISTOBJ, NULL },
+{ 14, 2, 18, 15,
+ "IP Address:",
+ "The IP address to be used for your host - use 127.0.0.1 for loopback",
+ ipaddr, STRINGOBJ, NULL },
+{ 14, 35, 18, 15,
+ "Netmask:",
+ "The netmask for your network, e.g. 0xffffff00 for a class C network",
+ netmask, STRINGOBJ, NULL },
+{ 16, 2, 50, 255,
+ "Extra options:",
+ "Any options to ifconfig you'd like to specify manually",
+ extras, STRINGOBJ, NULL },
+{ 18, 2, 0, 0,
+ "OK", "Select this if you are happy with these settings",
+ &okbutton, BUTTONOBJ, NULL },
+{ 18, 15, 0, 0,
+ "CANCEL", "Select this if you wish to cancel this screen",
+ &cancelbutton, BUTTONOBJ, NULL },
+{ NULL },
+};
+
+#define _validByte(b) ((b) > 0 && (b) < 255)
+
+static void
+feepout(char *msg)
+{
+ beep();
+ msgConfirm(msg);
+ dialog_clear();
+ refresh();
+}
+
+static int
+verifyIP(char *ip)
+{
+ int a, b, c, d;
+
+ if (ip && sscanf(ip, "%d.%d.%d.%d", &a, &b, &c, &d) == 4 &&
+ _validByte(a) && _validByte(b) && _validByte(c) &&
+ _validByte(d))
+ return 1;
+ else
+ return 0;
+}
+
+static int
+verifySettings(void)
+{
+ if (!hostname[0])
+ feepout("Must specify a host name of some sort!");
+ else if (!verifyIP(ipaddr))
+ feepout("Invalid or missing value for IP address");
+ else if (gateway[0] && !verifyIP(gateway))
+ feepout("Invalid gateway IP address specified");
+ else if (dns[0] && !verifyIP(dns))
+ feepout("Invalid name server IP address specified");
+ else if (netmask[0] < '0' || netmask[0] > '9')
+ feepout("Invalid or missing netmask");
+ else
+ return 1;
+ return 0;
+}
+
+/* Call this to initialize the TCP dialog */
+void
+/* This is it - how to get TCP setup values */
+void
+tcpOpenDialog(void)
+{
+ WINDOW *ds_win;
+ ComposeObj *obj = NULL;
+ ComposeObj *first, *last;
+ int n=0, quit=FALSE, cancel=FALSE, ret,
+ max;
+ char *tmp;
+
+ ds_win = newwin(LINES, COLS, 0, 0);
+ if (ds_win == 0) {
+ msgFatal("Cannot open TCP/IP dialog window!!");
+ exit(1);
+ }
+ draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X,
+ TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH,
+ dialog_attr, border_attr);
+ wattrset(ds_win, dialog_attr);
+ mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20,
+ " Network Configuration ");
+
+ bzero(ipaddr, sizeof(ipaddr));
+ bzero(netmask, sizeof(netmask));
+ bzero(extras, sizeof(extras));
+
+ tmp = getenv(VAR_HOSTNAME);
+ if (tmp)
+ strcpy(hostname, tmp);
+ else
+ bzero(hostname, sizeof(hostname));
+ tmp = getenv(VAR_DOMAINNAME);
+ if (tmp)
+ strcpy(domainname, tmp);
+ else
+ bzero(domainname, sizeof(domainname));
+ tmp = getenv(VAR_GATEWAY);
+ if (tmp)
+ strcpy(gateway, tmp);
+ else
+ bzero(gateway, sizeof(gateway));
+ tmp = getenv(VAR_NAMESERVER);
+ if (tmp)
+ strcpy(dns, tmp);
+ else
+ bzero(dns, sizeof(dns));
+
+#define lt layout[n]
+ while (lt.help != NULL) {
+ switch (lt.type) {
+ case STRINGOBJ:
+ lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
+ lt.len, lt.maxlen);
+ break;
+
+ case BUTTONOBJ:
+ lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
+ break;
+
+ case LISTOBJ:
+ lt.obj = NewListObj(ds_win, lt.prompt, lt.var, "lo0",
+ lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
+ 4, 12, 1);
+ default:
+ printf("Don't support this object yet!\n");
+ end_dialog();
+ exit(1);
+ }
+ AddObj(&obj, lt.type, (void *) lt.obj);
+ n++;
+ }
+ max = n-1;
+
+ last = obj;
+ while (last->next)
+ last = last->next;
+
+ /* find the first object in the list */
+ first = obj;
+ while (first->prev)
+ first = first->prev;
+
+ n = 0;
+ while (quit != TRUE) {
+ char help_line[80];
+ int i, len = strlen(lt.help);
+
+ for (i = 0; i < 79; i++)
+ help_line[i] = (i < len) ? lt.help[i] : ' ';
+ help_line[i] = '\0';
+ use_helpline(help_line);
+ display_helpline(ds_win, LINES - 1, COLS - 1);
+
+ ret = PollObj(&obj);
+
+ switch (ret) {
+ case SEL_ESC:
+ quit=TRUE;
+ cancel=TRUE;
+ break;
+
+ case KEY_UP:
+ if (obj->prev !=NULL ) {
+ obj = obj->prev;
+ --n;
+ }
+ else {
+ obj = last;
+ n = max;
+ }
+ break;
+
+ case KEY_DOWN:
+ if (obj->next != NULL) {
+ obj = obj->next;
+ ++n;
+ }
+ else {
+ obj = first;
+ n=0;
+ }
+ break;
+
+ case SEL_BUTTON:
+ if (verifySettings())
+ quit=TRUE;
+ break;
+
+ case SEL_CR:
+ case SEL_TAB:
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
+
+ case SEL_BACKTAB:
+ if (n)
+ --n;
+ else
+ n = max;
+ break;
+
+ default:
+ beep();
+ }
+
+ if (n == 1) {
+ if ((tmp = index(hostname, '.')) != NULL) {
+ strncpy(domainname, tmp + 1, strlen(tmp + 1));
+ RefreshStringObj(layout[1].obj);
+ }
+ }
+ }
+ if (!cancel) {
+ variable_set2("hostname", hostname);
+ variable_set2("domainname", domainname);
+ variable_set2("ip_addr", ipaddr);
+ variable_set2("ip_gateway", gateway);
+}
diff --git a/usr.sbin/sysinstall/wizard.c b/usr.sbin/sysinstall/wizard.c
index 88fd33b..dda8b57 100644
--- a/usr.sbin/sysinstall/wizard.c
+++ b/usr.sbin/sysinstall/wizard.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: tst01.c,v 1.8 1995/05/01 04:05:26 phk Exp $
+ * $Id: wizard.c,v 1.1 1995/05/04 23:36:23 jkh Exp $
*
*/
@@ -20,246 +20,246 @@
#include "libdisk.h"
u_char mbr[] = {
-250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
-242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
-131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
-203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
-205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
-51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
-85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
-114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
-108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
-121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
-116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
-1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
-208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,85,170
+ 250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
+ 242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28,
+ 131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254,
+ 203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14,
+ 205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12,
+ 51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61,
+ 85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97,
+ 114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32,
+ 108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115,
+ 121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97,
+ 116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
+ 1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144,
+ 208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,85,170
};
u_char bteasy17[] = {
-51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
-165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
-4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
-232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
-85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
-179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
-60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
-10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
-7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
-42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
-0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
-243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
-36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
-50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
-160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
-160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
-36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
-211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
-76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
-216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,85,170
+ 51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
+ 165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
+ 4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
+ 232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
+ 85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
+ 179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
+ 60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
+ 10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
+ 7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
+ 42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
+ 0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
+ 243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
+ 36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
+ 50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
+ 160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
+ 160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
+ 36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
+ 211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
+ 76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
+ 216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,85,170
};
int
scan_block(int fd, daddr_t block)
{
- u_char foo[512];
+ u_char foo[512];
- if (-1 == lseek(fd,block * 512,SEEK_SET))
- err(1,"lseek");
- if (512 != read(fd,foo, 512))
- return 1;
- return 0;
+ if (-1 == lseek(fd,block * 512,SEEK_SET))
+ err(1,"lseek");
+ if (512 != read(fd,foo, 512))
+ return 1;
+ return 0;
}
void
Scan_Disk(struct disk *d)
{
- char device[64];
- u_long l;
- int i,j,fd;
-
- strcpy(device,"/dev/r");
- strcat(device,d->name);
-
- fd = open(device,O_RDWR);
- if (fd < 0) {
- warn("open(%s) failed",device);
- return;
- }
- for(i=-1,l=0;;l++) {
- j = scan_block(fd,l);
- if (j != i) {
- if (i == -1) {
- printf("%c: %lu.",j ? 'B' : 'G', l);
- fflush(stdout);
- } else if (i == 0) {
- printf(".%lu\nB: %lu.",l-1,l);
- fflush(stdout);
- } else {
- printf(".%lu\nG: %lu.",l-1,l);
- fflush(stdout);
- }
- i = j;
- }
- }
- close(fd);
+ char device[64];
+ u_long l;
+ int i,j,fd;
+
+ strcpy(device,"/dev/r");
+ strcat(device,d->name);
+
+ fd = open(device,O_RDWR);
+ if (fd < 0) {
+ msgWarn("open(%s) failed", device);
+ return;
+ }
+ for(i=-1,l=0;;l++) {
+ j = scan_block(fd,l);
+ if (j != i) {
+ if (i == -1) {
+ printf("%c: %lu.",j ? 'B' : 'G', l);
+ fflush(stdout);
+ } else if (i == 0) {
+ printf(".%lu\nB: %lu.",l-1,l);
+ fflush(stdout);
+ } else {
+ printf(".%lu\nG: %lu.",l-1,l);
+ fflush(stdout);
+ }
+ i = j;
+ }
+ }
+ close(fd);
}
void
slice_wizard(struct disk *d)
{
- struct disk *db;
- char myprompt[BUFSIZ];
- char input[BUFSIZ];
- char *p,*q=0;
- char **cp,*cmds[200];
- int ncmd,i;
-
- sprintf(myprompt,"%s> ", d->name);
- while(1) {
- printf("--==##==--\n");
- Debug_Disk(d);
- p = CheckRules(d);
- if (p) {
- printf("%s",p);
- free(p);
- }
- printf(myprompt);
- fflush(stdout);
- q = p = fgets(input,sizeof(input),stdin);
- if(!p)
- break;
- for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
- if (**cp != '\0')
- cp++;
- ncmd = cp - cmds;
- if(!ncmd)
- continue;
- if (!strcasecmp(*cmds,"quit")) { break; }
- if (!strcasecmp(*cmds,"exit")) { break; }
- if (!strcasecmp(*cmds,"q")) { break; }
- if (!strcasecmp(*cmds,"x")) { break; }
- if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
- printf("delete = %d\n",
- Delete_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"allfreebsd")) {
- All_FreeBSD(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
- Set_Bios_Geom(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
- d = Set_Phys_Geom(d,
+ struct disk *db;
+ char myprompt[BUFSIZ];
+ char input[BUFSIZ];
+ char *p,*q=0;
+ char **cp,*cmds[200];
+ int ncmd,i;
+
+ sprintf(myprompt,"%s> ", d->name);
+ while(1) {
+ printf("--==##==--\n");
+ Debug_Disk(d);
+ p = CheckRules(d);
+ if (p) {
+ printf("%s",p);
+ free(p);
+ }
+ printf(myprompt);
+ fflush(stdout);
+ q = p = fgets(input,sizeof(input),stdin);
+ if(!p)
+ break;
+ for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
+ if (**cp != '\0')
+ cp++;
+ ncmd = cp - cmds;
+ if(!ncmd)
+ continue;
+ if (!strcasecmp(*cmds,"quit")) { break; }
+ if (!strcasecmp(*cmds,"exit")) { break; }
+ if (!strcasecmp(*cmds,"q")) { break; }
+ if (!strcasecmp(*cmds,"x")) { break; }
+ if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
+ printf("delete = %d\n",
+ Delete_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"allfreebsd")) {
+ All_FreeBSD(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
+ Set_Bios_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"phys") && ncmd == 4) {
+ d = Set_Phys_Geom(d,
+ strtol(cmds[1],0,0),
+ strtol(cmds[2],0,0),
+ strtol(cmds[3],0,0));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"collapse")) {
+ if (cmds[1])
+ while (Collapse_Chunk(d,
+ (struct chunk *)strtol(cmds[1],0,0)))
+ ;
+ else
+ Collapse_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"list")) {
+ cp = Disk_Names();
+ printf("Disks:");
+ for(i=0;cp[i];i++) {
+ printf(" %s",cp[i]);
+ free(cp[i]);
+ }
+ free(cp);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"create") && ncmd == 6) {
+
+ printf("Create=%d\n",
+ Create_Chunk(d,
strtol(cmds[1],0,0),
strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"collapse")) {
- if (cmds[1])
- while (Collapse_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)))
- ;
- else
- Collapse_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"list")) {
- cp = Disk_Names();
- printf("Disks:");
- for(i=0;cp[i];i++) {
- printf(" %s",cp[i]);
- free(cp[i]);
- }
- free(cp);
- continue;
- }
- if (!strcasecmp(*cmds,"create") && ncmd == 6) {
-
- printf("Create=%d\n",
- Create_Chunk(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0),
- strtol(cmds[4],0,0),
- strtol(cmds[5],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"read")) {
- db = d;
- if (ncmd > 1)
- d = Open_Disk(cmds[1]);
- else
- d = Open_Disk(d->name);
- if (d)
- Free_Disk(db);
- else
- d = db;
- continue;
- }
- if (!strcasecmp(*cmds,"scan")) {
- Scan_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"bteasy")) {
- Set_Boot_Mgr(d,bteasy17);
- continue;
- }
- if (!strcasecmp(*cmds,"mbr")) {
- Set_Boot_Mgr(d,mbr);
- continue;
- }
- if (!strcasecmp(*cmds,"boot")) {
- extern u_char boot1[],boot2[];
- Set_Boot_Blocks(d,boot1,boot2);
- continue;
- }
- if (!strcasecmp(*cmds,"write")) {
- printf("Write=%d\n",
- Write_Disk(d));
- Free_Disk(d);
- d = Open_Disk(d->name);
- continue;
- }
- if (strcasecmp(*cmds,"help"))
- printf("\007ERROR\n");
- printf("CMDS:\n");
- printf("allfreebsd\t\t");
- printf("bios cyl hd sect\n");
- printf("boot\t\t");
- printf("bteasy17\n");
- printf("collapse [pointer]\t\t");
- printf("create offset size enum subtype flags\n");
- printf("subtype(part): swap=1, ffs=7\t\t");
- printf("delete pointer\n");
- printf("list\t\t");
- printf("mbr\n");
- printf("phys cyl hd sect\t\t");
- printf("quit\n");
- printf("read [disk]\t\t");
- printf("scan\n");
- printf("write\t\t");
- printf("ENUM:\n\t");
- for(i=0;chunk_n[i];i++)
- printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
- printf("\n");
-
+ strtol(cmds[3],0,0),
+ strtol(cmds[4],0,0),
+ strtol(cmds[5],0,0)));
+ continue;
+ }
+ if (!strcasecmp(*cmds,"read")) {
+ db = d;
+ if (ncmd > 1)
+ d = Open_Disk(cmds[1]);
+ else
+ d = Open_Disk(d->name);
+ if (d)
+ Free_Disk(db);
+ else
+ d = db;
+ continue;
+ }
+ if (!strcasecmp(*cmds,"scan")) {
+ Scan_Disk(d);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"bteasy")) {
+ Set_Boot_Mgr(d,bteasy17);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"mbr")) {
+ Set_Boot_Mgr(d,mbr);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"boot")) {
+ extern u_char boot1[],boot2[];
+ Set_Boot_Blocks(d,boot1,boot2);
+ continue;
+ }
+ if (!strcasecmp(*cmds,"write")) {
+ printf("Write=%d\n",
+ Write_Disk(d));
+ Free_Disk(d);
+ d = Open_Disk(d->name);
+ continue;
}
+ if (strcasecmp(*cmds,"help"))
+ printf("\007ERROR\n");
+ printf("CMDS:\n");
+ printf("allfreebsd\t\t");
+ printf("bios cyl hd sect\n");
+ printf("boot\t\t");
+ printf("bteasy17\n");
+ printf("collapse [pointer]\t\t");
+ printf("create offset size enum subtype flags\n");
+ printf("subtype(part): swap=1, ffs=7\t\t");
+ printf("delete pointer\n");
+ printf("list\t\t");
+ printf("mbr\n");
+ printf("phys cyl hd sect\t\t");
+ printf("quit\n");
+ printf("read [disk]\t\t");
+ printf("scan\n");
+ printf("write\t\t");
+ printf("ENUM:\n\t");
+ for(i=0;chunk_n[i];i++)
+ printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");
+ printf("\n");
+
+ }
}
OpenPOWER on IntegriCloud