From c7ed70aaebb41be1a4b6a1ede797609d522a0906 Mon Sep 17 00:00:00 2001 From: jkh Date: Wed, 22 Jan 1997 00:15:51 +0000 Subject: Argh! Moving the media initialization to before the disk scribbling section was a good thing, since it made it possible to detect media problems *before* the installation started, but it also caused various things to be mounted BEFORE the chroot() call, which definitely messes things up. Fix this by detecting the pre-chroot() case and mounting into a subdir. --- usr.sbin/sysinstall/floppy.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'usr.sbin/sysinstall/floppy.c') diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c index c146f49..e29d376 100644 --- a/usr.sbin/sysinstall/floppy.c +++ b/usr.sbin/sysinstall/floppy.c @@ -117,14 +117,16 @@ mediaInitFloppy(Device *dev) { struct msdosfs_args dosargs; struct ufs_args u_args; + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; if (floppyMounted) return TRUE; - if (Mkdir("/dist")) { - msgConfirm("Unable to make directory mountpoint for %s!", dev->devname); + if (Mkdir(mountpoint)) { + msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname); return FALSE; } + msgDebug("Init floppy called for %s distribution.\n", distWanted ? distWanted : "some"); if (!distWanted) msgConfirm("Please insert floppy for %s", dev->description); @@ -139,14 +141,14 @@ mediaInitFloppy(Device *dev) memset(&u_args, 0, sizeof(u_args)); u_args.fspec = dev->devname; - if (mount(MOUNT_MSDOS, "/dist", MNT_RDONLY, (caddr_t)&dosargs) == -1) { - if (mount(MOUNT_UFS, "/dist", MNT_RDONLY, (caddr_t)&u_args) == -1) { - if (distWanted != (char *)1) - msgConfirm("Error mounting floppy %s (%s) on /dist : %s", dev->name, dev->devname, strerror(errno)); + if (mount(MOUNT_MSDOS, mountpoint, MNT_RDONLY, (caddr_t)&dosargs) == -1) { + if (mount(MOUNT_UFS, mountpoint, MNT_RDONLY, (caddr_t)&u_args) == -1) { + msgConfirm("Error mounting floppy %s (%s) on %s : %s", dev->name, dev->devname, mountpoint, + strerror(errno)); return FALSE; } } - msgDebug("initFloppy: mounted floppy %s successfully on /dist\n", dev->devname); + msgDebug("initFloppy: mounted floppy %s successfully on %s\n", dev->devname, mountpoint); floppyMounted = TRUE; distWanted = NULL; return TRUE; @@ -186,9 +188,11 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe) void mediaShutdownFloppy(Device *dev) { + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; + if (floppyMounted) { - if (unmount("/dist", MNT_FORCE) != 0) - msgDebug("Umount of floppy on /dist failed: %s (%d)\n", strerror(errno), errno); + if (unmount(mountpoint, MNT_FORCE) != 0) + msgDebug("Umount of floppy on %s failed: %s (%d)\n", mountpoint, strerror(errno), errno); else { floppyMounted = FALSE; msgDebug("Floppy unmounted successfully.\n"); -- cgit v1.1