summaryrefslogtreecommitdiffstats
path: root/etc/rc.initdiskless
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2003-06-30 21:47:06 +0000
committerbrooks <brooks@FreeBSD.org>2003-06-30 21:47:06 +0000
commitb8db4ad194c9901892b9e4a5b1623013d596e762 (patch)
tree419507d929c9ce1101ff0f4a60101ee004eb33f4 /etc/rc.initdiskless
parente812a8fe756a5ad0e03cf19023ae6a98e01d45fa (diff)
downloadFreeBSD-src-b8db4ad194c9901892b9e4a5b1623013d596e762.zip
FreeBSD-src-b8db4ad194c9901892b9e4a5b1623013d596e762.tar.gz
Allow diskless_remount files to contain path beginning with / which will
be mounted relative to the NFS root mountpoint. Reviewed by: dillon at backplane.com MFC After: 3 days
Diffstat (limited to 'etc/rc.initdiskless')
-rw-r--r--etc/rc.initdiskless18
1 files changed, 18 insertions, 0 deletions
diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless
index fcd947c..b6fb790 100644
--- a/etc/rc.initdiskless
+++ b/etc/rc.initdiskless
@@ -149,6 +149,17 @@ for i in ${iflist} ; do
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
+# Figure out our NFS root path
+#
+set `mount -t nfs`
+while [ $# -ge 1 ] ; do
+ if [ "$2" = "on" -a "$3" = "/" ]; then
+ nfsroot="$1"
+ break
+ fi
+ shift
+done
+
# Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca},
# and /conf/${bootp_ipa}. For each subdirectory found within these
# directories:
@@ -164,6 +175,10 @@ echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
# might contain 'myserver:/etc'. NFS remounts allow you to avoid
# having to dup your system directories in /conf. Your server must
# be sure to export those filesystems -alldirs, however.
+# If the diskless_remount file contains a string beginning with a
+# '/' it is assumed that the local nfsroot should be prepended to
+# it before attemping to the remount. This allows the root to be
+# relocated without needing to change the remount files.
#
for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
for j in /conf/$i/* ; do
@@ -178,6 +193,9 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
#
if [ -d $j -a -f $j/diskless_remount ]; then
nfspt=`/bin/cat $j/diskless_remount`
+ if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then
+ nfspt="${nfsroot}${nfspt}"
+ fi
mount_nfs $nfspt $j
chkerr $? "mount_nfs $nfspt $j"
fi
OpenPOWER on IntegriCloud