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.
This commit is contained in:
Jordan K. Hubbard 1996-06-11 05:06:32 +00:00
parent 7966b47a3e
commit 3ee8cec854
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16291
4 changed files with 79 additions and 12 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}