diff options
-rw-r--r-- | release/Makefile | 3 | ||||
-rw-r--r-- | release/sysinstall/attr.c | 8 | ||||
-rw-r--r-- | release/sysinstall/cdrom.c | 40 | ||||
-rw-r--r-- | usr.sbin/sysinstall/cdrom.c | 40 |
4 files changed, 79 insertions, 12 deletions
diff --git a/release/Makefile b/release/Makefile index cc8375b..6eafe8a 100644 --- a/release/Makefile +++ b/release/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.219 1996/06/07 11:46:18 jkh Exp $ +# $Id: Makefile,v 1.220 1996/06/08 22:55:25 jkh Exp $ # # How to roll a release: # @@ -431,6 +431,7 @@ cdrom.1: find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \ fi \ done + echo "CD_VERSION = ${BUILDNAME}" > ${CD}/cdrom.inf # Various "subroutine" and other supporting targets. diff --git a/release/sysinstall/attr.c b/release/sysinstall/attr.c index b65cd0c..a09ef4b 100644 --- a/release/sysinstall/attr.c +++ b/release/sysinstall/attr.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: attr.c,v 1.5 1996/04/13 13:31:22 jkh Exp $ + * $Id: attr.c,v 1.6 1996/04/23 01:29:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -44,13 +44,15 @@ int attr_parse_file(Attribs *attr, char *file) { - int fd; + int fd, status; if ((fd = open(file, O_RDONLY)) == -1) { msgConfirm("Cannot open the information file `%s': %s (%d)", file, strerror(errno), errno); return DITEM_FAILURE; } - return attr_parse(attr, fd); + status = attr_parse(attr, fd); + close(fd); + return status; } int diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c index 4f2aca2..c8992f6 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.13 1996/04/23 01:29:10 jkh Exp $ + * $Id: cdrom.c,v 1.14 1996/06/08 07:02:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -69,6 +69,8 @@ Boolean mediaInitCDROM(Device *dev) { struct iso_args args; + Attribs *cd_attr; + char *cp; if (cdromMounted != CD_UNMOUNTED) return TRUE; @@ -80,18 +82,48 @@ mediaInitCDROM(Device *dev) args.fspec = dev->devname; args.flags = 0; + cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS); + cp = NULL; /* If this cdrom's not already mounted or can't be mounted, yell */ - if (!directory_exists("/cdrom/dists")) { + if (!file_readable("/cdrom/cdrom.inf")) { if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); return FALSE; } - else + else if (file_readable("/cdrom/cdrom.inf")) cdromMounted = CD_WE_MOUNTED_IT; + else { + unmount("/cdrom", MNT_FORCE); + msgConfirm("The CD currently in the drive is not a recent FreeBSD CDROM -\n" + "ignoring it.\n\n" + "If this is in error, please correct this problem now before\n" + "attempting to use the CDROM as installation media."); + return FALSE; + } } else cdromMounted = CD_ALREADY_MOUNTED; - msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname); + 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))) { + unmount("/cdrom", MNT_FORCE); + if (!cp) + msgConfirm("I/O error trying to read the contents of /cdrom/cdrom.inf.\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" + "try again."); + else + msgConfirm("The version of the FreeBSD CD currently in the drive (%s)\n" + "does not match the version of this boot floppy (%s).\n" + "If this is intentional, then please visit the Options editor\n" + "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/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 4f2aca2..c8992f6 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.13 1996/04/23 01:29:10 jkh Exp $ + * $Id: cdrom.c,v 1.14 1996/06/08 07:02:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -69,6 +69,8 @@ Boolean mediaInitCDROM(Device *dev) { struct iso_args args; + Attribs *cd_attr; + char *cp; if (cdromMounted != CD_UNMOUNTED) return TRUE; @@ -80,18 +82,48 @@ mediaInitCDROM(Device *dev) args.fspec = dev->devname; args.flags = 0; + cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS); + cp = NULL; /* If this cdrom's not already mounted or can't be mounted, yell */ - if (!directory_exists("/cdrom/dists")) { + if (!file_readable("/cdrom/cdrom.inf")) { if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); return FALSE; } - else + else if (file_readable("/cdrom/cdrom.inf")) cdromMounted = CD_WE_MOUNTED_IT; + else { + unmount("/cdrom", MNT_FORCE); + msgConfirm("The CD currently in the drive is not a recent FreeBSD CDROM -\n" + "ignoring it.\n\n" + "If this is in error, please correct this problem now before\n" + "attempting to use the CDROM as installation media."); + return FALSE; + } } else cdromMounted = CD_ALREADY_MOUNTED; - msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname); + 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))) { + unmount("/cdrom", MNT_FORCE); + if (!cp) + msgConfirm("I/O error trying to read the contents of /cdrom/cdrom.inf.\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" + "try again."); + else + msgConfirm("The version of the FreeBSD CD currently in the drive (%s)\n" + "does not match the version of this boot floppy (%s).\n" + "If this is intentional, then please visit the Options editor\n" + "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; } |