summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/cdrom.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-01-06 11:10:25 +0000
committerjkh <jkh@FreeBSD.org>1997-01-06 11:10:25 +0000
commit273faad7110c1222f6f9e7d232dbcb90fa76fa28 (patch)
tree92207fb5ae95c2ba7b07bbc1c2449fb3f37f3254 /usr.sbin/sysinstall/cdrom.c
parentf9fe9c12ffcbbda26f384c4be1b8631c30a305c5 (diff)
downloadFreeBSD-src-273faad7110c1222f6f9e7d232dbcb90fa76fa28.zip
FreeBSD-src-273faad7110c1222f6f9e7d232dbcb90fa76fa28.tar.gz
Do a better job of CDROM detection.
Use consistent spelling throughout. Remove unmount in fixit_common() since that's bogus in the CDROM case and properly "shut down" the media device instead.
Diffstat (limited to 'usr.sbin/sysinstall/cdrom.c')
-rw-r--r--usr.sbin/sysinstall/cdrom.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c
index 9756102..438c2e6 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.30 1996/12/12 16:55:37 jkh Exp $
+ * $Id: cdrom.c,v 1.31 1997/01/01 12:36:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -65,7 +65,7 @@ mediaInitCDROM(Device *dev)
struct iso_args args;
Attribs *cd_attr;
char *cp;
- Boolean dontRead;
+ Boolean readInfo = TRUE;
if (cdromMounted != CD_UNMOUNTED)
return TRUE;
@@ -76,7 +76,6 @@ mediaInitCDROM(Device *dev)
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")) {
Mkdir("/cdrom");
@@ -97,15 +96,17 @@ mediaInitCDROM(Device *dev)
"CD or it is an older (pre 2.1.5) FreeBSD CD which does not\n"
"have a version number on it. Do you wish to use this CD anyway?") != 0) {
unmount("/cdrom", MNT_FORCE);
+ cdromMounted = CD_UNMOUNTED;
return FALSE;
}
- dontRead = TRUE;
+ else
+ readInfo = FALSE;
}
cdromMounted = CD_WE_MOUNTED_IT;
}
else
cdromMounted = CD_ALREADY_MOUNTED;
- if (!dontRead && (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE ||
+ if (readInfo && (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 (cdromMounted != CD_ALREADY_MOUNTED)
unmount("/cdrom", MNT_FORCE);
@@ -117,12 +118,18 @@ mediaInitCDROM(Device *dev)
"try again.");
else
msgConfirm("Warning: The version of the FreeBSD CD currently in the drive\n"
- "(%s) does not match the version of this boot floppy\n"
+ "(%s) does not match the version of the boot floppy\n"
"(%s).\n\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.", cp, variable_get(VAR_RELNAME));
- return FALSE;
+ "If this is intentional, to avoid this message in the future\n"
+ "please visit the Options editor to set the boot floppy version\n"
+ "string to match that of the CD before selecting it as your\n"
+ "installation media.", cp, variable_get(VAR_RELNAME));
+
+ if (msgYesNo("Would you like to try and use this CDROM anyway?") != 0) {
+ unmount("/cdrom", MNT_FORCE);
+ cdromMounted = CD_UNMOUNTED;
+ return FALSE;
+ }
}
msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname);
return TRUE;
@@ -151,8 +158,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
void
mediaShutdownCDROM(Device *dev)
{
- /* Only undo it if we did it */
- if (cdromMounted != CD_WE_MOUNTED_IT)
+ if (cdromMounted == CD_UNMOUNTED)
return;
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
if (unmount("/cdrom", MNT_FORCE) != 0) {
@@ -160,7 +166,7 @@ mediaShutdownCDROM(Device *dev)
cdromMounted = CD_ALREADY_MOUNTED; /* Guess somebody else got it */
}
else {
- msgDebug("Unmount successful\n");
+ msgDebug("Unmount of CDROM successful\n");
cdromMounted = CD_UNMOUNTED;
}
}
OpenPOWER on IntegriCloud