diff options
author | jkh <jkh@FreeBSD.org> | 1996-03-18 15:28:10 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-03-18 15:28:10 +0000 |
commit | 6e8165c16a87270a576fb00bc626ad6c02849c41 (patch) | |
tree | bbbb1da098bedb9748f8fa6faa46c10cb2c30d4a /usr.sbin/sysinstall/cdrom.c | |
parent | e938ba728f7b191c0b62d04b1b01689391c2751a (diff) | |
download | FreeBSD-src-6e8165c16a87270a576fb00bc626ad6c02849c41.zip FreeBSD-src-6e8165c16a87270a576fb00bc626ad6c02849c41.tar.gz |
Lots of fixes:
1. Revamp package installer to use new dependency lists and also
pkg_add's new `read from stdin' mode to prevent a copy of the package
from hitting the disk unnecessarily.
2. More fixes for running "not as init" - don't get upset if CDROM already
mounted, do the right thing instead.
3. If running as init, assume first-time install and _don't show the
(W)rite option in the fdisk screen.
4. Many other little tweaks, some of which will have to wait for fuller testing
until I can create a boot floppy (testing certain system-destroying
features of sysinstall can be a royal pain). Expect some more commits.
Diffstat (limited to 'usr.sbin/sysinstall/cdrom.c')
-rw-r--r-- | usr.sbin/sysinstall/cdrom.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 8179e0e..7752df0 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.9 1995/12/07 10:33:32 peter Exp $ + * $Id: cdrom.c,v 1.10 1996/03/02 07:31:50 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -58,9 +58,15 @@ #include <sys/mount.h> #undef CD9660 -/* This isn't static, like the others, since it's often useful to know whether or not we have a CDROM - available in some of the other installation screens. */ -Boolean cdromMounted; +/* + * This isn't static, like the others, since it's often useful to know whether + * or not we have a CDROM available in some of the other installation screens. + * This also isn't a boolean like the others since we have 3 states for it: + * 0 = cdrom isn't mounted, 1 = cdrom is mounted and we mounted it, 2 = cdrom + * was already mounted when we came in and we should leave it that way when + * we leave. + */ +int cdromMounted; Boolean mediaInitCDROM(Device *dev) @@ -79,7 +85,9 @@ mediaInitCDROM(Device *dev) args.fspec = dev->devname; args.flags = 0; - if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { + if (directory_exists("/cdrom/dists")) + cdromMounted = 2; + else if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { dialog_clear(); msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); return FALSE; @@ -104,7 +112,7 @@ mediaInitCDROM(Device *dev) return FALSE; } } - cdromMounted = TRUE; + cdromMounted = 1; msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname); return TRUE; } @@ -131,7 +139,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe) void mediaShutdownCDROM(Device *dev) { - if (!RunningAsInit || !cdromMounted) + if (!RunningAsInit || !cdromMounted || cdromMounted == 2) return; msgDebug("Unmounting %s from /cdrom\n", dev->devname); if (unmount("/cdrom", MNT_FORCE) != 0) { @@ -139,6 +147,6 @@ mediaShutdownCDROM(Device *dev) msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno)); } msgDebug("Unmount successful\n"); - cdromMounted = FALSE; + cdromMounted = 0; return; } |