summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-20 00:13:14 +0000
committerjkh <jkh@FreeBSD.org>1995-05-20 00:13:14 +0000
commitd63a70f78f99e9b0953e4e2c7d7e5fbd2688991b (patch)
tree17f8429322ec34f38e307047479022b2fee69866 /usr.sbin
parent7afb459d6e5fe9e4b29d919b1467381493d054ed (diff)
downloadFreeBSD-src-d63a70f78f99e9b0953e4e2c7d7e5fbd2688991b.zip
FreeBSD-src-d63a70f78f99e9b0953e4e2c7d7e5fbd2688991b.tar.gz
This doesn't work - the extract code is half-baked. I commit it only
so that Gary can sync to it before I go to bed.. :)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/devices.c45
-rw-r--r--usr.sbin/sade/globals.c5
-rw-r--r--usr.sbin/sade/install.c17
-rw-r--r--usr.sbin/sade/menus.c32
-rw-r--r--usr.sbin/sade/sade.h7
-rw-r--r--usr.sbin/sysinstall/devices.c45
-rw-r--r--usr.sbin/sysinstall/dist.c5
-rw-r--r--usr.sbin/sysinstall/globals.c5
-rw-r--r--usr.sbin/sysinstall/install.c17
-rw-r--r--usr.sbin/sysinstall/media.c35
-rw-r--r--usr.sbin/sysinstall/menus.c32
-rw-r--r--usr.sbin/sysinstall/sysinstall.h7
12 files changed, 150 insertions, 102 deletions
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index 41a74a3..dffe69e 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.18 1995/05/18 13:18:34 jkh Exp $
+ * $Id: devices.c,v 1.19 1995/05/19 02:31:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -93,6 +93,8 @@ static struct {
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0a", "Floppy disk drive (unit A)" },
{ DEVICE_TYPE_FLOPPY, "fd1a", "Floppy disk drive (unit B)" },
+ { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP device" },
+ { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP 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" },
@@ -105,8 +107,6 @@ static struct {
{ DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet cards (Isolan/Novell NE2100/NE32-VL)" },
{ DEVICE_TYPE_NETWORK, "ze", "IBM/National Semiconductor PCMCIA ethernet" },
{ DEVICE_TYPE_NETWORK, "zp", "3Com PCMCIA Etherlink III" },
- { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP device" },
- { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP device" },
{ NULL },
};
@@ -124,9 +124,8 @@ new_device(char *name)
}
static int
-deviceTry(char *name)
+deviceTry(char *name, char *try)
{
- char try[FILENAME_MAX];
int fd;
snprintf(try, FILENAME_MAX, "/dev/%s", name);
@@ -134,7 +133,7 @@ deviceTry(char *name)
if (fd > 0)
return fd;
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
- fd = open(try, O_RDWR);
+ fd = open(try, O_RDONLY);
return fd;
}
@@ -181,15 +180,18 @@ deviceGetAll(void)
* second stage of the installation.
*/
for (i = 0; device_names[i].name; i++) {
+ char try[FILENAME_MAX];
+
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_CDROM;
Devices[numDevs]->description = device_names[i].description;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE; /* XXX check for FreeBSD disk later XXX */
Devices[numDevs]->init = mediaInitCDROM;
Devices[numDevs]->get = mediaGetCDROM;
@@ -202,12 +204,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_TAPE:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_TAPE;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE;
Devices[numDevs]->init = mediaInitTape;
Devices[numDevs]->get = mediaGetTape;
@@ -219,12 +222,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_FLOPPY:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_FLOPPY;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE;
Devices[numDevs]->init = mediaInitFloppy;
Devices[numDevs]->get = mediaGetFloppy;
@@ -236,12 +240,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_NETWORK:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = FALSE;
Devices[numDevs]->init = mediaInitNetwork;
Devices[numDevs]->get = mediaGetNetwork;
@@ -283,6 +288,7 @@ deviceGetAll(void)
CHECK_DEVS;
Devices[numDevs] = new_device(ifptr->ifr_name);
Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->devname = NULL;
Devices[numDevs]->enabled = FALSE;
Devices[numDevs]->init = mediaInitNetwork;
Devices[numDevs]->get = mediaGetNetwork;
@@ -322,6 +328,17 @@ deviceFind(char *name, DeviceType class)
return j ? found : NULL;
}
+int
+deviceCount(Device **devs)
+{
+ int i;
+
+ if (!devs)
+ return 0;
+ for (i = 0; devs[i]; i++);
+ return i;
+}
+
/*
* 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
diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c
index a0713c5..15a346e 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.4 1995/05/16 02:53:09 jkh Exp $
+ * $Id: globals.c,v 1.5 1995/05/16 11:37:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,6 +56,7 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
+Device *mediaDevice; /* Where we're installing from */
/*
* Yes, I know some of these are already automatically initialized as
@@ -72,5 +73,5 @@ globalsInit(void)
OnVTY = FALSE;
DialogActive = FALSE;
VarHead = NULL;
+ mediaDevice = NULL;
}
-
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index b039ec0..0ca1cfe 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.30 1995/05/19 15:56:01 jkh Exp $
+ * $Id: install.c,v 1.31 1995/05/19 21:30:33 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -76,14 +76,18 @@ preInstallCheck(void)
return TRUE;
}
-int
-installCommit(char *str)
+static void
+installInitial(void)
{
extern u_char boot1[], boot2[];
extern u_char mbr[], bteasy17[];
u_char *mbrContents;
Device **devs;
int i;
+ static Boolean alreadyDone = FALSE;
+
+ if (alreadyDone)
+ return;
/* If things aren't kosher, or we refuse to proceed, bail. */
if (!preInstallCheck()
@@ -126,6 +130,13 @@ installCommit(char *str)
}
}
}
+ alreadyDone = TRUE;
+}
+
+int
+installCommit(char *str)
+{
+ installInitial();
make_filesystems();
copy_self();
cpio_extract();
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 8d4abd5..cbabda4 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.16 1995/05/18 09:02:00 jkh Exp $
+ * $Id: menus.c,v 1.17 1995/05/19 16:58:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,6 +70,8 @@ option by pressing enter. If you'd like a shell, press ESC", /* prompt */
DMENU_SUBMENU, (void *)&MenuOptions, 0, 0 },
{ "Proceed", "Go to the installation menu", /* P */
DMENU_SUBMENU, (void *)&MenuInstall, 0, 0 },
+ { "Quit", "Exit this installation utility", /* Q */
+ DMENU_CANCEL, NULL, 0, 0 },
{ NULL } },
};
@@ -148,24 +150,12 @@ DMenu MenuMediaCDROM = {
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 are seeing this menu, it's either\n\
-because you haven't booted directly from the CDROM in DOS/Windows or\n\
-your CDROM was not detected. If you feel that you are seeing this dialog\n\
-in error, you may wish to reboot FreeBSD with the -c boot flag (see the\n\
-hardware guide in the Documentation menu for more info) and check that your\n\
-CDROM controller and the kernel agree on reasonable values. Please also\n\
-note that FreeBSD does NOT currently support IDE CDROM drives!",
- "Press F1 for more information on CDROM support",
- "media_cdrom.hlp",
- { { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/matcd0a", 0, 0 },
- { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/mcd0a", 0, 0 },
- { "SCSI", "SCSI CDROM drive attached to supported SCSI controller", /* S */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/cd0a", 0, 0 },
- { "Sony", "Sony CDU31/33A or compatible CDROM drive", /* S */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/scd0a", 0, 0 },
- { NULL } },
+FreeBSD 2.0.5 distribution. If you are seeing this menu it's because\n\
+more than one CDROM drive on your system was found. Please select one\n\
+of the following CDROM drives as your installation drive.",
+ "Press F1 to read the installation guide",
+ "install.hlp",
+ { { NULL } },
};
DMenu MenuMediaFloppy = {
@@ -181,9 +171,9 @@ scripts.",
"Please select the floppy drive you want to use",
NULL,
{ { "A", "Floppy drive A", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/fd0a", 0, 0 },
+ DMENU_SET_VARIABLE, (void *)"mediaDevice=fd0a", 0, 0 },
{ "B", "Floppy drive B", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/fd1a", 0, 0 },
+ DMENU_SET_VARIABLE, (void *)"mediaDevice=fd1a", 0, 0 },
{ NULL } },
};
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 25c6645..7c67fe4 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.19 1995/05/18 15:29:45 jkh Exp $
+ * $Id: sysinstall.h,v 1.20 1995/05/19 16:58:57 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -76,8 +76,6 @@
#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"
@@ -146,6 +144,7 @@ typedef enum {
typedef struct _device {
char name[DEV_NAME_MAX];
char *description;
+ char *devname;
DeviceType type;
Boolean enabled;
Boolean (*init)(struct _device *);
@@ -185,6 +184,7 @@ extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
extern Variable *VarHead; /* The head of the variable chain */
+extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists; /* Which XFree86 dists we want */
@@ -230,6 +230,7 @@ extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
extern void deviceGetAll(void);
extern Device **deviceFind(char *name, DeviceType type);
+extern int deviceCount(Device **devs);
/* disks.c */
extern int diskPartitionEditor(char *unused);
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
index 41a74a3..dffe69e 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.18 1995/05/18 13:18:34 jkh Exp $
+ * $Id: devices.c,v 1.19 1995/05/19 02:31:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -93,6 +93,8 @@ static struct {
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0a", "Floppy disk drive (unit A)" },
{ DEVICE_TYPE_FLOPPY, "fd1a", "Floppy disk drive (unit B)" },
+ { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP device" },
+ { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP 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" },
@@ -105,8 +107,6 @@ static struct {
{ DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet cards (Isolan/Novell NE2100/NE32-VL)" },
{ DEVICE_TYPE_NETWORK, "ze", "IBM/National Semiconductor PCMCIA ethernet" },
{ DEVICE_TYPE_NETWORK, "zp", "3Com PCMCIA Etherlink III" },
- { DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP device" },
- { DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP device" },
{ NULL },
};
@@ -124,9 +124,8 @@ new_device(char *name)
}
static int
-deviceTry(char *name)
+deviceTry(char *name, char *try)
{
- char try[FILENAME_MAX];
int fd;
snprintf(try, FILENAME_MAX, "/dev/%s", name);
@@ -134,7 +133,7 @@ deviceTry(char *name)
if (fd > 0)
return fd;
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
- fd = open(try, O_RDWR);
+ fd = open(try, O_RDONLY);
return fd;
}
@@ -181,15 +180,18 @@ deviceGetAll(void)
* second stage of the installation.
*/
for (i = 0; device_names[i].name; i++) {
+ char try[FILENAME_MAX];
+
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_CDROM;
Devices[numDevs]->description = device_names[i].description;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE; /* XXX check for FreeBSD disk later XXX */
Devices[numDevs]->init = mediaInitCDROM;
Devices[numDevs]->get = mediaGetCDROM;
@@ -202,12 +204,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_TAPE:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_TAPE;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE;
Devices[numDevs]->init = mediaInitTape;
Devices[numDevs]->get = mediaGetTape;
@@ -219,12 +222,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_FLOPPY:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_FLOPPY;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = TRUE;
Devices[numDevs]->init = mediaInitFloppy;
Devices[numDevs]->get = mediaGetFloppy;
@@ -236,12 +240,13 @@ deviceGetAll(void)
break;
case DEVICE_TYPE_NETWORK:
- fd = deviceTry(device_names[i].name);
- if (fd > 0) {
+ fd = deviceTry(device_names[i].name, try);
+ if (fd >= 0) {
close(fd);
CHECK_DEVS;
Devices[numDevs] = new_device(device_names[i].name);
Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->devname = strdup(try);
Devices[numDevs]->enabled = FALSE;
Devices[numDevs]->init = mediaInitNetwork;
Devices[numDevs]->get = mediaGetNetwork;
@@ -283,6 +288,7 @@ deviceGetAll(void)
CHECK_DEVS;
Devices[numDevs] = new_device(ifptr->ifr_name);
Devices[numDevs]->type = DEVICE_TYPE_NETWORK;
+ Devices[numDevs]->devname = NULL;
Devices[numDevs]->enabled = FALSE;
Devices[numDevs]->init = mediaInitNetwork;
Devices[numDevs]->get = mediaGetNetwork;
@@ -322,6 +328,17 @@ deviceFind(char *name, DeviceType class)
return j ? found : NULL;
}
+int
+deviceCount(Device **devs)
+{
+ int i;
+
+ if (!devs)
+ return 0;
+ for (i = 0; devs[i]; i++);
+ return i;
+}
+
/*
* 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
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index 2f8c9a9..40806c8 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.9 1995/05/19 17:11:07 jkh Exp $
+ * $Id: dist.c,v 1.10 1995/05/19 17:19:39 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -241,11 +241,14 @@ distExtract(char *parent, Distribution *me)
}
}
}
+ mediaClose();
return status;
}
void
distExtractAll(void)
{
+ if (!mediaVerify())
+ return;
distExtract(NULL, DistTable);
}
diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c
index a0713c5..15a346e 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.4 1995/05/16 02:53:09 jkh Exp $
+ * $Id: globals.c,v 1.5 1995/05/16 11:37:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,6 +56,7 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
+Device *mediaDevice; /* Where we're installing from */
/*
* Yes, I know some of these are already automatically initialized as
@@ -72,5 +73,5 @@ globalsInit(void)
OnVTY = FALSE;
DialogActive = FALSE;
VarHead = NULL;
+ mediaDevice = NULL;
}
-
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index b039ec0..0ca1cfe 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.30 1995/05/19 15:56:01 jkh Exp $
+ * $Id: install.c,v 1.31 1995/05/19 21:30:33 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -76,14 +76,18 @@ preInstallCheck(void)
return TRUE;
}
-int
-installCommit(char *str)
+static void
+installInitial(void)
{
extern u_char boot1[], boot2[];
extern u_char mbr[], bteasy17[];
u_char *mbrContents;
Device **devs;
int i;
+ static Boolean alreadyDone = FALSE;
+
+ if (alreadyDone)
+ return;
/* If things aren't kosher, or we refuse to proceed, bail. */
if (!preInstallCheck()
@@ -126,6 +130,13 @@ installCommit(char *str)
}
}
}
+ alreadyDone = TRUE;
+}
+
+int
+installCommit(char *str)
+{
+ installInitial();
make_filesystems();
copy_self();
cpio_extract();
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 1250f52..e371c81 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.5 1995/05/16 11:37:18 jkh Exp $
+ * $Id: media.c,v 1.6 1995/05/17 14:39:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -51,13 +51,23 @@
int
mediaSetCDROM(char *str)
{
+ Device *devs;
+ int cnt;
+
if (OnCDROM == TRUE)
return 1;
else {
- dmenuOpenSimple(&MenuMediaCDROM);
- if (getenv(MEDIA_DEVICE)) {
- variable_set2(MEDIA_TYPE, "cdrom");
- return 1;
+ devs = deviceFind(NULL, MEDIA_TYPE_CDROM);
+ cnt = deviceCount(devs);
+ if (!cnt) {
+ msgConfirm("No CDROM devices found! Please check that your system's\nconfiguration is correct and that the CDROM drive is of a supported\ntype. For more information, consult the hardware guide\nin the Doc menu.");
+ return 0;
+ }
+ else if (cnt > 1) {
+ /* put up a menu */
+ }
+ else {
+ mediaDevice = devs[0];
}
}
return 0;
@@ -133,19 +143,14 @@ mediaOpen(char *parent, char *me)
{
char fname[FILENAME_MAX];
- 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.");
+ if (!mediaVerify())
return NULL;
- }
+
if (parent)
snprintf(fname, FILENAME_MAX, "%s%s", parent, me);
else
strncpy(fname, me, FILENAME_MAX);
- /* XXX find a Device here XXX */
+ /* XXX mediaDevice points to where we want to get it from */
return NULL;
}
@@ -171,8 +176,8 @@ mediaGetType(void)
Boolean
mediaVerify(void)
{
- if (!getenv(MEDIA_TYPE) || !getenv(MEDIA_DEVICE)) {
- msgConfirm("Media type or device not set! Please select a media type\nfrom the Installation menu before proceeding.");
+ if (!mediaDevice) {
+ msgConfirm("Media type not set! Please select a media type\nfrom the Installation menu before proceeding.");
return FALSE;
}
return TRUE;
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index 8d4abd5..cbabda4 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.16 1995/05/18 09:02:00 jkh Exp $
+ * $Id: menus.c,v 1.17 1995/05/19 16:58:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,6 +70,8 @@ option by pressing enter. If you'd like a shell, press ESC", /* prompt */
DMENU_SUBMENU, (void *)&MenuOptions, 0, 0 },
{ "Proceed", "Go to the installation menu", /* P */
DMENU_SUBMENU, (void *)&MenuInstall, 0, 0 },
+ { "Quit", "Exit this installation utility", /* Q */
+ DMENU_CANCEL, NULL, 0, 0 },
{ NULL } },
};
@@ -148,24 +150,12 @@ DMenu MenuMediaCDROM = {
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 are seeing this menu, it's either\n\
-because you haven't booted directly from the CDROM in DOS/Windows or\n\
-your CDROM was not detected. If you feel that you are seeing this dialog\n\
-in error, you may wish to reboot FreeBSD with the -c boot flag (see the\n\
-hardware guide in the Documentation menu for more info) and check that your\n\
-CDROM controller and the kernel agree on reasonable values. Please also\n\
-note that FreeBSD does NOT currently support IDE CDROM drives!",
- "Press F1 for more information on CDROM support",
- "media_cdrom.hlp",
- { { "Matsushita", "Panasonic \"Sound Blaster\" CDROM.", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/matcd0a", 0, 0 },
- { "Mitsumi", "Mitsumi FX-001 series drive (not IDE)", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/mcd0a", 0, 0 },
- { "SCSI", "SCSI CDROM drive attached to supported SCSI controller", /* S */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/cd0a", 0, 0 },
- { "Sony", "Sony CDU31/33A or compatible CDROM drive", /* S */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/scd0a", 0, 0 },
- { NULL } },
+FreeBSD 2.0.5 distribution. If you are seeing this menu it's because\n\
+more than one CDROM drive on your system was found. Please select one\n\
+of the following CDROM drives as your installation drive.",
+ "Press F1 to read the installation guide",
+ "install.hlp",
+ { { NULL } },
};
DMenu MenuMediaFloppy = {
@@ -181,9 +171,9 @@ scripts.",
"Please select the floppy drive you want to use",
NULL,
{ { "A", "Floppy drive A", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/fd0a", 0, 0 },
+ DMENU_SET_VARIABLE, (void *)"mediaDevice=fd0a", 0, 0 },
{ "B", "Floppy drive B", /* M */
- DMENU_SET_VARIABLE, (void *)"mediaDevice=/dev/fd1a", 0, 0 },
+ DMENU_SET_VARIABLE, (void *)"mediaDevice=fd1a", 0, 0 },
{ NULL } },
};
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 25c6645..7c67fe4 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.19 1995/05/18 15:29:45 jkh Exp $
+ * $Id: sysinstall.h,v 1.20 1995/05/19 16:58:57 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -76,8 +76,6 @@
#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"
@@ -146,6 +144,7 @@ typedef enum {
typedef struct _device {
char name[DEV_NAME_MAX];
char *description;
+ char *devname;
DeviceType type;
Boolean enabled;
Boolean (*init)(struct _device *);
@@ -185,6 +184,7 @@ extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
extern Variable *VarHead; /* The head of the variable chain */
+extern Device *mediaDevice; /* Where we're getting our distribution from */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists; /* Which XFree86 dists we want */
@@ -230,6 +230,7 @@ extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
extern void deviceGetAll(void);
extern Device **deviceFind(char *name, DeviceType type);
+extern int deviceCount(Device **devs);
/* disks.c */
extern int diskPartitionEditor(char *unused);
OpenPOWER on IntegriCloud