summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/floppy.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-01-22 00:15:51 +0000
committerjkh <jkh@FreeBSD.org>1997-01-22 00:15:51 +0000
commitc7ed70aaebb41be1a4b6a1ede797609d522a0906 (patch)
tree8012598730759d3b92126925bca2c1f215af4fbc /usr.sbin/sysinstall/floppy.c
parent04a08427c7d068d0a067bff780df51d9da1fbbae (diff)
downloadFreeBSD-src-c7ed70aaebb41be1a4b6a1ede797609d522a0906.zip
FreeBSD-src-c7ed70aaebb41be1a4b6a1ede797609d522a0906.tar.gz
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.
Diffstat (limited to 'usr.sbin/sysinstall/floppy.c')
-rw-r--r--usr.sbin/sysinstall/floppy.c22
1 files changed, 13 insertions, 9 deletions
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");
OpenPOWER on IntegriCloud