diff options
author | jkh <jkh@FreeBSD.org> | 1996-07-12 11:14:15 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-07-12 11:14:15 +0000 |
commit | 9b9952dd90c3f90e52a9ed9353801ce3313f83dd (patch) | |
tree | 8d69a0c48a81d30304bc275196093185da0c25df | |
parent | 95254df1ef3ce9c7e4c30fc83748a3faeb5d7b32 (diff) | |
download | FreeBSD-src-9b9952dd90c3f90e52a9ed9353801ce3313f83dd.zip FreeBSD-src-9b9952dd90c3f90e52a9ed9353801ce3313f83dd.tar.gz |
Fix something I broke with CDROM installation (well, I knew my first
test CD would turn at least one bug up :-).
-rw-r--r-- | release/sysinstall/cdrom.c | 15 | ||||
-rw-r--r-- | release/sysinstall/dist.c | 4 | ||||
-rw-r--r-- | release/sysinstall/install.c | 10 | ||||
-rw-r--r-- | release/sysinstall/main.c | 16 | ||||
-rw-r--r-- | usr.sbin/sade/install.c | 10 | ||||
-rw-r--r-- | usr.sbin/sade/main.c | 16 | ||||
-rw-r--r-- | usr.sbin/sysinstall/cdrom.c | 15 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 10 | ||||
-rw-r--r-- | usr.sbin/sysinstall/main.c | 16 |
10 files changed, 66 insertions, 50 deletions
diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c index 8abd089..465ae34 100644 --- a/release/sysinstall/cdrom.c +++ b/release/sysinstall/cdrom.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: cdrom.c,v 1.16 1996/06/14 18:23:26 jkh Exp $ + * $Id: cdrom.c,v 1.17 1996/07/08 08:54:22 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -71,6 +71,7 @@ mediaInitCDROM(Device *dev) struct iso_args args; Attribs *cd_attr; char *cp; + Boolean dontRead; if (cdromMounted != CD_UNMOUNTED) return TRUE; @@ -82,8 +83,9 @@ mediaInitCDROM(Device *dev) args.fspec = dev->devname; args.flags = 0; - cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS); + cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS); cp = NULL; + dontRead = FALSE; /* If this cdrom's not already mounted or can't be mounted, yell */ if (!file_readable("/cdrom/cdrom.inf")) { if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { @@ -97,16 +99,17 @@ mediaInitCDROM(Device *dev) unmount("/cdrom", MNT_FORCE); return FALSE; } + dontRead = TRUE; } cdromMounted = CD_WE_MOUNTED_IT; } else cdromMounted = CD_ALREADY_MOUNTED; - if (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE || - !(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME))) { + if (!dontRead && (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE || + !(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME)))) { unmount("/cdrom", MNT_FORCE); if (!cp) - msgConfirm("I/O error trying to read the contents of /cdrom/cdrom.inf.\n" + msgConfirm("Unable to find a /cdrom/cdrom.inf file.\n" "Either this is not a FreeBSD CDROM, there is a problem with\n" "the CDROM driver or something is wrong with your hardware.\n" "Please fix this problem (check the console logs on VTY2) and\n" @@ -118,10 +121,8 @@ mediaInitCDROM(Device *dev) "to set the boot floppy version string to match that of the CD\n" "before selecting it as an installation media."); cdromMounted = CD_UNMOUNTED; - safe_free(cd_attr); return FALSE; } - safe_free(cd_attr); msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname); return TRUE; } diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c index 79b7218..765f075 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.64 1996/07/09 16:57:14 jkh Exp $ + * $Id: dist.c,v 1.65 1996/07/10 11:38:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -366,8 +366,6 @@ distExtract(char *parent, Distribution *me) /* First try to get the distribution as a single file */ snprintf(buf, 512, "%s/%s.tgz", path, dist); - if (isDebug()) - msgDebug("Trying to get large piece: %s\n", buf); /* * Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors * are not considered too significant. diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 473a861..d17ca01 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.111 1996/07/09 07:17:03 jkh Exp $ + * $Id: install.c,v 1.112 1996/07/09 14:28:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -373,6 +373,12 @@ installNovice(dialogMenuItem *self) if (!mediaDevice) { dialog_clear(); + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } msgConfirm("Finally, you must specify an installation medium."); if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) return DITEM_FAILURE | DITEM_RECREATE; @@ -711,7 +717,7 @@ installFilesystems(dialogMenuItem *self) } else { if (!upgrade) { - msgConfirm("Warning: Root device is selected read-only. It will be assumed\n" + msgConfirm("Warning: Using existing root partition. It will be assumed\n" "that you have the appropriate device entries already in /dev."); } msgNotify("Checking integrity of existing %s filesystem.", dname); diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c index 8c20589..647efd3 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.22 1996/06/26 09:09:28 jkh Exp $ + * $Id: main.c,v 1.23 1996/07/02 01:03:44 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -86,17 +86,17 @@ main(int argc, char **argv) /* Probe for all relevant devices on the system */ deviceGetAll(); - /* Try to set ourselves up as a CDROM if we can do that first */ - if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { - /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ - if (!mediaDevice->init(mediaDevice)) - mediaDevice = NULL; - } - /* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */ if (!RunningAsInit) { int i, start_arg; + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } + if (!strstr(argv[0], "sysinstall")) start_arg = 0; else diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 473a861..d17ca01 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.111 1996/07/09 07:17:03 jkh Exp $ + * $Id: install.c,v 1.112 1996/07/09 14:28:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -373,6 +373,12 @@ installNovice(dialogMenuItem *self) if (!mediaDevice) { dialog_clear(); + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } msgConfirm("Finally, you must specify an installation medium."); if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) return DITEM_FAILURE | DITEM_RECREATE; @@ -711,7 +717,7 @@ installFilesystems(dialogMenuItem *self) } else { if (!upgrade) { - msgConfirm("Warning: Root device is selected read-only. It will be assumed\n" + msgConfirm("Warning: Using existing root partition. It will be assumed\n" "that you have the appropriate device entries already in /dev."); } msgNotify("Checking integrity of existing %s filesystem.", dname); diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index 8c20589..647efd3 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.22 1996/06/26 09:09:28 jkh Exp $ + * $Id: main.c,v 1.23 1996/07/02 01:03:44 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -86,17 +86,17 @@ main(int argc, char **argv) /* Probe for all relevant devices on the system */ deviceGetAll(); - /* Try to set ourselves up as a CDROM if we can do that first */ - if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { - /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ - if (!mediaDevice->init(mediaDevice)) - mediaDevice = NULL; - } - /* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */ if (!RunningAsInit) { int i, start_arg; + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } + if (!strstr(argv[0], "sysinstall")) start_arg = 0; else diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 8abd089..465ae34 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.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: cdrom.c,v 1.16 1996/06/14 18:23:26 jkh Exp $ + * $Id: cdrom.c,v 1.17 1996/07/08 08:54:22 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -71,6 +71,7 @@ mediaInitCDROM(Device *dev) struct iso_args args; Attribs *cd_attr; char *cp; + Boolean dontRead; if (cdromMounted != CD_UNMOUNTED) return TRUE; @@ -82,8 +83,9 @@ mediaInitCDROM(Device *dev) args.fspec = dev->devname; args.flags = 0; - cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS); + cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS); cp = NULL; + dontRead = FALSE; /* If this cdrom's not already mounted or can't be mounted, yell */ if (!file_readable("/cdrom/cdrom.inf")) { if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { @@ -97,16 +99,17 @@ mediaInitCDROM(Device *dev) unmount("/cdrom", MNT_FORCE); return FALSE; } + dontRead = TRUE; } cdromMounted = CD_WE_MOUNTED_IT; } else cdromMounted = CD_ALREADY_MOUNTED; - if (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE || - !(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME))) { + if (!dontRead && (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE || + !(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME)))) { unmount("/cdrom", MNT_FORCE); if (!cp) - msgConfirm("I/O error trying to read the contents of /cdrom/cdrom.inf.\n" + msgConfirm("Unable to find a /cdrom/cdrom.inf file.\n" "Either this is not a FreeBSD CDROM, there is a problem with\n" "the CDROM driver or something is wrong with your hardware.\n" "Please fix this problem (check the console logs on VTY2) and\n" @@ -118,10 +121,8 @@ mediaInitCDROM(Device *dev) "to set the boot floppy version string to match that of the CD\n" "before selecting it as an installation media."); cdromMounted = CD_UNMOUNTED; - safe_free(cd_attr); return FALSE; } - safe_free(cd_attr); msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname); return TRUE; } diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 79b7218..765f075 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.64 1996/07/09 16:57:14 jkh Exp $ + * $Id: dist.c,v 1.65 1996/07/10 11:38:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -366,8 +366,6 @@ distExtract(char *parent, Distribution *me) /* First try to get the distribution as a single file */ snprintf(buf, 512, "%s/%s.tgz", path, dist); - if (isDebug()) - msgDebug("Trying to get large piece: %s\n", buf); /* * Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors * are not considered too significant. diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 473a861..d17ca01 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.111 1996/07/09 07:17:03 jkh Exp $ + * $Id: install.c,v 1.112 1996/07/09 14:28:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -373,6 +373,12 @@ installNovice(dialogMenuItem *self) if (!mediaDevice) { dialog_clear(); + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } msgConfirm("Finally, you must specify an installation medium."); if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) return DITEM_FAILURE | DITEM_RECREATE; @@ -711,7 +717,7 @@ installFilesystems(dialogMenuItem *self) } else { if (!upgrade) { - msgConfirm("Warning: Root device is selected read-only. It will be assumed\n" + msgConfirm("Warning: Using existing root partition. It will be assumed\n" "that you have the appropriate device entries already in /dev."); } msgNotify("Checking integrity of existing %s filesystem.", dname); diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index 8c20589..647efd3 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.22 1996/06/26 09:09:28 jkh Exp $ + * $Id: main.c,v 1.23 1996/07/02 01:03:44 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -86,17 +86,17 @@ main(int argc, char **argv) /* Probe for all relevant devices on the system */ deviceGetAll(); - /* Try to set ourselves up as a CDROM if we can do that first */ - if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { - /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ - if (!mediaDevice->init(mediaDevice)) - mediaDevice = NULL; - } - /* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */ if (!RunningAsInit) { int i, start_arg; + /* Try to set ourselves up as a CDROM if we can do that first */ + if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) { + /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ + if (!mediaDevice->init(mediaDevice)) + mediaDevice = NULL; + } + if (!strstr(argv[0], "sysinstall")) start_arg = 0; else |