summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/cdrom.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-06-11 05:06:32 +0000
committerjkh <jkh@FreeBSD.org>1996-06-11 05:06:32 +0000
commitf27ab1365acf02701e1f0a28f6c6b42aaeb92384 (patch)
tree24ad94c120c94d6886a598cbbb915b7c03601d03 /usr.sbin/sysinstall/cdrom.c
parentdf9def768af6733f8619f95a69e1620370985bce (diff)
downloadFreeBSD-src-f27ab1365acf02701e1f0a28f6c6b42aaeb92384.zip
FreeBSD-src-f27ab1365acf02701e1f0a28f6c6b42aaeb92384.tar.gz
Come up with a scheme for stamping the FreeBSD version number on CDs,
allowing sysinstall to automagically detect, mount and select an appropriate FreeBSD CDROM as the installation media. Defining "appropriate" also requires that you check the version numbers since an older FreeBSD CD could be in the drive, which is the purpose of this patch.
Diffstat (limited to 'usr.sbin/sysinstall/cdrom.c')
-rw-r--r--usr.sbin/sysinstall/cdrom.c40
1 files changed, 36 insertions, 4 deletions
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;
}
OpenPOWER on IntegriCloud