diff options
Diffstat (limited to 'usr.sbin/sysinstall/floppy.c')
-rw-r--r-- | usr.sbin/sysinstall/floppy.c | 22 |
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"); |