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
This commit is contained in:
Brooks Davis 2003-06-30 21:47:06 +00:00
parent a3367e4f2e
commit a83659958b
3 changed files with 57 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -271,6 +271,27 @@ For example, the file might contain:
.Pp
.Dl 10.0.0.1:/etc
.Pp
Alternativly, if the server contains several independent roots, the file
might contain:
.Pp
.Dl 10.0.0.1:/usr/diskless/4.7-RELEASE/etc
.Pp
This would work, but if you copied
.Pa /usr/diskless/4.7-RELEASE
to
.Pa /usr/diskless/4.8-RELEASE
and upgraded the installation, you would need to modify the
.Pa diskless_remount
files to reflect that move.
To avoid that, paths in
.Pa diskless_remount
files begining with
.Pa /
have the actual path of the client's root prepended to them so the file
could instead contain:
.Pp
.Dl /etc
.Pp
The
.Nm
scripts create memory file systems to hold the overriden