diff options
author | bms <bms@FreeBSD.org> | 2008-09-09 18:40:50 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2008-09-09 18:40:50 +0000 |
commit | 67bb59274cc710813155e764f1422a3b264c1725 (patch) | |
tree | 33d8b5d247e10d3f62a61c512054a74e0b47b08f /etc | |
parent | c30fff54190f893ece2e107d0412e0cf782f47fc (diff) | |
download | FreeBSD-src-67bb59274cc710813155e764f1422a3b264c1725.zip FreeBSD-src-67bb59274cc710813155e764f1422a3b264c1725.tar.gz |
Add support to rc.initdiskless for /conf/T/M/remount_subdir.
This allows the location of the configuration data to be relocated
within the filesystem containing it. A nullfs mount is used in order
to achieve this.
Obtained from: XORP, Inc.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.initdiskless | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless index eb9468f..b35817f 100644 --- a/etc/rc.initdiskless +++ b/etc/rc.initdiskless @@ -73,6 +73,16 @@ # If this file exists, then failure to execute the mount # command contained in /conf/T/M/remount is non-fatal. # +# /conf/T/M/remount_subdir +# If this file exists, then the behaviour of /conf/T/M/remount +# changes as follows: +# 1. /conf/T/M/remount is invoked to mount the root of the +# filesystem where the configuration data exists on a +# temporary mountpoint. +# 2. /conf/T/M/remount_subdir is then invoked to mount a +# *subdirectory* of the filesystem mounted by +# /conf/T/M/remount on /conf/T/M/. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -296,10 +306,33 @@ for i in ${templates} ; do # remount. Beware, the command is in the file itself! if [ -f $j/remount ]; then - nfspt=`/bin/cat $j/remount` - $nfspt $j - chkerr $? "$nfspt $j" - to_umount="$j ${to_umount}" # XXX hope it is really a mount! + if [ -f $j/remount_subdir ]; then + k="/conf.tmp/$i/$subdir" + [ -d $k ] || continue + + # Mount the filesystem root where the config data is + # on the temporary mount point. + nfspt=`/bin/cat $j/remount` + $nfspt $k + chkerr $? "$nfspt $k" + + # Now use a nullfs mount to get the data where we + # really want to see it. + remount_subdir=`/bin/cat $j/remount_subdir` + remount_subdir_cmd="mount -t nullfs $k/$remount_subdir" + + $remount_subdir_cmd $j + chkerr $? "$remount_subdir_cmd $j" + + # XXX check order -- we must force $k to be unmounted + # after j, as j depends on k. + to_umount="$j $k ${to_umount}" + else + nfspt=`/bin/cat $j/remount` + $nfspt $j + chkerr $? "$nfspt $j" + to_umount="$j ${to_umount}" # XXX hope it is really a mount! + fi fi # NFS remount |