summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/nfs.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/nfs.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/nfs.c')
-rw-r--r--usr.sbin/sysinstall/nfs.c19
1 files changed, 11 insertions, 8 deletions
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); */
OpenPOWER on IntegriCloud