From b8db4ad194c9901892b9e4a5b1623013d596e762 Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 30 Jun 2003 21:47:06 +0000 Subject: 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 --- etc/rc.initdiskless | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'etc/rc.initdiskless') 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 -- cgit v1.1