diff options
-rw-r--r-- | etc/rc.d/initdiskless | 18 | ||||
-rw-r--r-- | etc/rc.initdiskless | 18 | ||||
-rw-r--r-- | share/man/man8/diskless.8 | 21 |
3 files changed, 57 insertions, 0 deletions
diff --git a/etc/rc.d/initdiskless b/etc/rc.d/initdiskless index fcd947c..b6fb790 100644 --- a/etc/rc.d/initdiskless +++ b/etc/rc.d/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 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 diff --git a/share/man/man8/diskless.8 b/share/man/man8/diskless.8 index 45ddabb..ea59ead 100644 --- a/share/man/man8/diskless.8 +++ b/share/man/man8/diskless.8 @@ -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 |