diff options
author | jkh <jkh@FreeBSD.org> | 1997-01-22 00:15:51 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-01-22 00:15:51 +0000 |
commit | c7ed70aaebb41be1a4b6a1ede797609d522a0906 (patch) | |
tree | 8012598730759d3b92126925bca2c1f215af4fbc /usr.sbin | |
parent | 04a08427c7d068d0a067bff780df51d9da1fbbae (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.sbin/sade/globals.c | 2 | ||||
-rw-r--r-- | usr.sbin/sade/install.c | 63 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 1 | ||||
-rw-r--r-- | usr.sbin/sysinstall/cdrom.c | 98 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/floppy.c | 22 | ||||
-rw-r--r-- | usr.sbin/sysinstall/globals.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 63 | ||||
-rw-r--r-- | usr.sbin/sysinstall/nfs.c | 19 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 1 |
10 files changed, 95 insertions, 180 deletions
diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index 5b4010d..afe55b3 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -44,6 +44,7 @@ int DebugFD; /* Where diagnostic output goes */ Boolean Fake; /* Only pretend to be useful */ Boolean RunningAsInit; /* Are we running as init? */ +Boolean Chrooted; /* Yow, have we chrooted yet? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ @@ -67,4 +68,5 @@ globalsInit(void) VarHead = NULL; mediaDevice = NULL; RunningAsInit = FALSE; + Chrooted = FALSE; } diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index c42b084..682d814 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -230,6 +230,8 @@ installInitial(void) msgConfirm("Unable to chroot to /mnt - this is bad!"); return DITEM_FAILURE; } + else + Chrooted = TRUE; chdir("/"); variable_set2(RUNNING_ON_ROOT, "yes"); @@ -441,21 +443,6 @@ installExpress(dialogMenuItem *self) if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE) return i; - if (!Dists) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice->init(mediaDevice)) - return DITEM_FAILURE | DITEM_REDRAW; - if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) { i |= DITEM_LEAVE_MENU; /* Give user the option of one last configuration spree */ @@ -495,24 +482,6 @@ installNovice(dialogMenuItem *self) if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) return DITEM_FAILURE; - while (1) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuDistributions, FALSE)) - return DITEM_FAILURE | DITEM_RESTORE; - - if (Dists) - break; - - if (msgYesNo("No distributions selected. Revisit the distributions menu?")) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice && (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)) - return DITEM_FAILURE | DITEM_RESTORE; - - if (!mediaDevice->init(mediaDevice)) - return DITEM_FAILURE | DITEM_RESTORE; - if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) { dialog_clear_norefresh(); msgConfirm("Installation completed with some errors. You may wish to\n" @@ -669,43 +638,29 @@ int installCommit(dialogMenuItem *self) { int i; - char *str; Boolean need_bin; if (!Dists) { - if (!msgYesNo("No distributions are selected for installation! Do you\n" - "want to do this now?")) { - if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists) - return DITEM_FAILURE | DITEM_RESTORE; - } - else + if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists) return DITEM_FAILURE | DITEM_RESTORE; } +media: if (!mediaDevice) { - if (!msgYesNo("You need to select a media type first. Do you want\n" - "to do this now?")) { - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; - } - else - return DITEM_FAILURE | DITEM_RESTORE; + if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) + return DITEM_FAILURE | DITEM_RESTORE; } if (!mediaDevice->init(mediaDevice)) { if (!msgYesNo("Unable to initialize selected media. Would you like to\n" - "adjust your media configuration?")) { - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; + "adjust your media configuration and try again?")) { + mediaDevice = NULL; + goto media; } else return DITEM_FAILURE | DITEM_RESTORE; } - str = variable_get(SYSTEM_STATE); - if (isDebug()) - msgDebug("installCommit: System state is `%s'\n", str); - if (RunningAsInit) { /* Do things we wouldn't do to a multi-user system */ if (DITEM_STATUS((i = installInitial())) == DITEM_FAILURE) diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 3ef68e6..3de34c9 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -313,6 +313,7 @@ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ +extern Boolean Chrooted; /* Yow, are we chrooted yet? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 5315320..5c8c285 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.c @@ -51,13 +51,7 @@ #include <sys/mount.h> #undef CD9660 -/* - * This 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. - */ -static int cdromMounted; +static Boolean cdromMounted; Boolean mediaInitCDROM(Device *dev) @@ -66,8 +60,9 @@ mediaInitCDROM(Device *dev) Attribs *cd_attr; char *cp; Boolean readInfo = TRUE; + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; - if (cdromMounted != CD_UNMOUNTED) + if (cdromMounted) return TRUE; bzero(&args, sizeof(args)); @@ -76,44 +71,41 @@ mediaInitCDROM(Device *dev) cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS); cp = NULL; - /* If this cdrom's not already mounted or can't be mounted, yell */ - if (!file_readable("/cdrom/cdrom.inf")) { - Mkdir("/cdrom"); - if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { - if (errno == EINVAL) { - msgConfirm("The CD in your drive looks more like an Audio CD than a FreeBSD release."); - cdromMounted = CD_UNMOUNTED; - return FALSE; - } - else if (errno != EBUSY) { - msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); - cdromMounted = CD_UNMOUNTED; - return FALSE; - } + + Mkdir(mountpoint); + + if (mount(MOUNT_CD9660, mountpoint, MNT_RDONLY, (caddr_t) &args) == -1) { + if (errno == EINVAL) { + msgConfirm("The CD in your drive looks more like an Audio CD than a FreeBSD release."); + return FALSE; + } + else if (errno != EBUSY) { + msgConfirm("Error mounting %s on %s: %s (%u)", dev->devname, mountpoint, strerror(errno), errno); + return FALSE; } - if (!file_readable("/cdrom/cdrom.inf")) { - if (msgYesNo("Warning: The CD currently in the drive is either not a FreeBSD\n" - "CD or it is an older (pre 2.1.5) FreeBSD CD which does not\n" - "have a version number on it. Do you wish to use this CD anyway?") != 0) { - unmount("/cdrom", MNT_FORCE); - cdromMounted = CD_UNMOUNTED; - return FALSE; - } - else - readInfo = FALSE; + cdromMounted = TRUE; + } + + if (!file_readable(string_concat(mountpoint, "/cdrom.inf"))) { + if (msgYesNo("Warning: The CD currently in the drive is either not a FreeBSD\n" + "CD or it is an older (pre 2.1.5) FreeBSD CD which does not\n" + "have a version number on it. Do you wish to use this CD anyway?") != 0) { + unmount(mountpoint, MNT_FORCE); + return FALSE; } - cdromMounted = CD_WE_MOUNTED_IT; + else + readInfo = FALSE; } - else - cdromMounted = CD_ALREADY_MOUNTED; - if (readInfo && (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)))) { + + if (readInfo && + (DITEM_STATUS(attr_parse_file(cd_attr, string_concat(mountpoint, "/cdrom.inf"))) == DITEM_FAILURE || + !(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME)))) { if (!cp) - msgConfirm("Unable to find a /cdrom/cdrom.inf file.\n" + msgConfirm("Unable to find a %s/cdrom.inf file.\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."); + "try again.", mountpoint); else msgConfirm("Warning: The version of the FreeBSD CD currently in the drive\n" "(%s) does not match the version of the boot floppy\n" @@ -124,12 +116,12 @@ mediaInitCDROM(Device *dev) "installation media.", cp, variable_get(VAR_RELNAME)); if (msgYesNo("Would you like to try and use this CDROM anyway?") != 0) { - unmount("/cdrom", MNT_FORCE); - cdromMounted = CD_UNMOUNTED; + unmount(mountpoint, MNT_FORCE); + cdromMounted = FALSE; return FALSE; } } - msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname); + msgDebug("Mounted FreeBSD CDROM from device %s\n", dev->devname); return TRUE; } @@ -140,31 +132,31 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe) if (isDebug()) msgDebug("Request for %s from CDROM\n", file); - snprintf(buf, PATH_MAX, "/cdrom/%s", file); + snprintf(buf, PATH_MAX, "/dist/%s", file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/cdrom/dists/%s", file); + snprintf(buf, PATH_MAX, "/dist/dists/%s", file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/cdrom/%s/%s", variable_get(VAR_RELNAME), file); + snprintf(buf, PATH_MAX, "/dist/%s/%s", variable_get(VAR_RELNAME), file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/cdrom/%s/dists/%s", variable_get(VAR_RELNAME), file); + snprintf(buf, PATH_MAX, "/dist/%s/dists/%s", variable_get(VAR_RELNAME), file); return fopen(buf, "r"); } void mediaShutdownCDROM(Device *dev) { - if (cdromMounted == CD_UNMOUNTED) + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; + + if (!cdromMounted) return; - msgDebug("Unmounting %s from /cdrom\n", dev->devname); - if (unmount("/cdrom", MNT_FORCE) != 0) { - msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno)); - cdromMounted = CD_ALREADY_MOUNTED; /* Guess somebody else got it */ - } + msgDebug("Unmounting %s from %s\n", dev->devname, mountpoint); + if (unmount(mountpoint, MNT_FORCE) != 0) + msgConfirm("Could not unmount the CDROM from %s: %s", mountpoint, strerror(errno)); else { msgDebug("Unmount of CDROM successful\n"); - cdromMounted = CD_UNMOUNTED; + cdromMounted = FALSE; } } diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index cd52f68..cded28c 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -509,8 +509,8 @@ distExtract(char *parent, Distribution *me) if (fp == (FILE *)0) msgConfirm("Failed to find %s on this media. Reinitializing media.", buf); else - msgConfirm("failed to retreive piece file %s: %s.\n" - "Reinitializing media.", buf, resid ? "I/O error" : "Timeout or user interrupt"); + msgConfirm("failed to retreive piece file %s.\n" + "%s: Reinitializing media.", buf, resid ? "I/O error" : "Timeout or user interrupt"); mediaDevice->shutdown(mediaDevice); if (!mediaDevice->init(mediaDevice)) goto punt; 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"); diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index 5b4010d..afe55b3 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -44,6 +44,7 @@ int DebugFD; /* Where diagnostic output goes */ Boolean Fake; /* Only pretend to be useful */ Boolean RunningAsInit; /* Are we running as init? */ +Boolean Chrooted; /* Yow, have we chrooted yet? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ @@ -67,4 +68,5 @@ globalsInit(void) VarHead = NULL; mediaDevice = NULL; RunningAsInit = FALSE; + Chrooted = FALSE; } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index c42b084..682d814 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -230,6 +230,8 @@ installInitial(void) msgConfirm("Unable to chroot to /mnt - this is bad!"); return DITEM_FAILURE; } + else + Chrooted = TRUE; chdir("/"); variable_set2(RUNNING_ON_ROOT, "yes"); @@ -441,21 +443,6 @@ installExpress(dialogMenuItem *self) if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE) return i; - if (!Dists) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice->init(mediaDevice)) - return DITEM_FAILURE | DITEM_REDRAW; - if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) { i |= DITEM_LEAVE_MENU; /* Give user the option of one last configuration spree */ @@ -495,24 +482,6 @@ installNovice(dialogMenuItem *self) if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) return DITEM_FAILURE; - while (1) { - dialog_clear_norefresh(); - if (!dmenuOpenSimple(&MenuDistributions, FALSE)) - return DITEM_FAILURE | DITEM_RESTORE; - - if (Dists) - break; - - if (msgYesNo("No distributions selected. Revisit the distributions menu?")) - return DITEM_FAILURE | DITEM_RESTORE; - } - - if (!mediaDevice && (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)) - return DITEM_FAILURE | DITEM_RESTORE; - - if (!mediaDevice->init(mediaDevice)) - return DITEM_FAILURE | DITEM_RESTORE; - if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) { dialog_clear_norefresh(); msgConfirm("Installation completed with some errors. You may wish to\n" @@ -669,43 +638,29 @@ int installCommit(dialogMenuItem *self) { int i; - char *str; Boolean need_bin; if (!Dists) { - if (!msgYesNo("No distributions are selected for installation! Do you\n" - "want to do this now?")) { - if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists) - return DITEM_FAILURE | DITEM_RESTORE; - } - else + if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists) return DITEM_FAILURE | DITEM_RESTORE; } +media: if (!mediaDevice) { - if (!msgYesNo("You need to select a media type first. Do you want\n" - "to do this now?")) { - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; - } - else - return DITEM_FAILURE | DITEM_RESTORE; + if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) + return DITEM_FAILURE | DITEM_RESTORE; } if (!mediaDevice->init(mediaDevice)) { if (!msgYesNo("Unable to initialize selected media. Would you like to\n" - "adjust your media configuration?")) { - if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) - return DITEM_FAILURE | DITEM_RESTORE; + "adjust your media configuration and try again?")) { + mediaDevice = NULL; + goto media; } else return DITEM_FAILURE | DITEM_RESTORE; } - str = variable_get(SYSTEM_STATE); - if (isDebug()) - msgDebug("installCommit: System state is `%s'\n", str); - if (RunningAsInit) { /* Do things we wouldn't do to a multi-user system */ if (DITEM_STATUS((i = installInitial())) == DITEM_FAILURE) diff --git a/usr.sbin/sysinstall/nfs.c b/usr.sbin/sysinstall/nfs.c index 1a7af4f..38b2e05 100644 --- a/usr.sbin/sysinstall/nfs.c +++ b/usr.sbin/sysinstall/nfs.c @@ -46,6 +46,7 @@ Boolean NFSMounted; Boolean mediaInitNFS(Device *dev) { + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; Device *netDevice = (Device *)dev->private; if (NFSMounted) @@ -54,19 +55,20 @@ mediaInitNFS(Device *dev) if (netDevice && !netDevice->init(netDevice)) return FALSE; - if (Mkdir("/dist")) + if (Mkdir(mountpoint)) return FALSE; msgNotify("Mounting %s over NFS.", dev->name); - if (vsystem("mount_nfs %s %s %s /dist", + if (vsystem("mount_nfs %s %s %s %s", variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "", - variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name)) { - msgConfirm("Error mounting %s on /dist: %s (%u)", dev->name, strerror(errno), errno); - netDevice->shutdown(netDevice); + variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name, mountpoint)) { + msgConfirm("Error mounting %s on %s: %s.", dev->name, mountpoint, strerror(errno)); + if (netDevice) + netDevice->shutdown(netDevice); return FALSE; } NFSMounted = TRUE; - msgDebug("Mounted NFS device %s onto /dist\n", dev->name); + msgDebug("Mounted NFS device %s onto %s\n", dev->name, mountpoint); return TRUE; } @@ -94,11 +96,12 @@ void mediaShutdownNFS(Device *dev) { /* Device *netdev = (Device *)dev->private; */ + char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist"; if (!NFSMounted) return; - msgNotify("Unmounting NFS partition on /dist"); - if (unmount("/dist", MNT_FORCE) != 0) + msgNotify("Unmounting NFS partition on %s", mountpoint); + if (unmount(mountpoint, MNT_FORCE) != 0) msgConfirm("Could not unmount the NFS partition: %s", strerror(errno)); msgDebug("Unmount of NFS partition successful\n"); /* if (netdev) netdev->shutdown(netdev); */ diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 3ef68e6..3de34c9 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -313,6 +313,7 @@ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ +extern Boolean Chrooted; /* Yow, are we chrooted yet? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ |