Make this file more generally usable:

Trigger not only on diskless booting sysctls being set, but also
on the existence of the file "/etc/diskless".  But do not try to
extract IP# related keywords in that case.

Add a general "remount" facility to allow non-NFS remounting.
This commit is contained in:
phk 2004-03-09 23:06:50 +00:00
parent 01eed200f9
commit ae10eb5198
2 changed files with 70 additions and 38 deletions

View File

@ -49,12 +49,18 @@
# /<sub_directory_name>. For example, if /conf/base/etc exists then a
# memory filesystem will be created for /etc.
#
# If a subdirectory contains the file 'remount' the contents of the file
# is a mount command used to remount the subdirectory prior to it being
# copied. An example contents could be: "mount -o ro /dev/ad0s3". Note
# that the directory to be mounted on is supplied by this script.
#
# If a subdirectory contains the file 'diskless_remount' the contents of
# the file is used to remount the subdirectory prior to it being copied to
# the memory filesystem. For example, if /conf/base/etc/diskless_remount
# contains the string 'my.server.com:/etc' then my.server.com:/etc will be
# mounted in place of the subdirectory. This allows you to avoid making
# duplicates of system directories in /conf.
# duplicates of system directories in /conf. Special processing is done
# to allow specifications relative to the root filesystem.
#
# If a subdirectory contains the file 'md_size', the contents of the
# file is used to determine the size of the memory filesystem, in 512
@ -79,7 +85,7 @@
# Those filesystems should not be specified in /conf. At least not yet.
dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
[ ${dlv:=0} -eq 0 ] && exit 0
[ ${dlv:=0} -eq 0 ] && [ ! -f /etc/diskless ] && exit 0
# chkerr:
#
@ -130,23 +136,25 @@ create_md() {
bootp_ifc=""
bootp_ipa=""
bootp_ipbca=""
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
if [ ${dlv:=0} -ne 0 ] ; then
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
fi
# Figure out our NFS root path
#
@ -188,6 +196,14 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
eval md_size_$subdir=`cat $j/md_size`
fi
# remount
#
if [ -d $j -a -f $j/remount ]; then
nfspt=`/bin/cat $j/remount`
$nfspt $j
chkerr $? "$nfspt $j"
fi
# NFS remount
#
if [ -d $j -a -f $j/diskless_remount ]; then

View File

@ -49,12 +49,18 @@
# /<sub_directory_name>. For example, if /conf/base/etc exists then a
# memory filesystem will be created for /etc.
#
# If a subdirectory contains the file 'remount' the contents of the file
# is a mount command used to remount the subdirectory prior to it being
# copied. An example contents could be: "mount -o ro /dev/ad0s3". Note
# that the directory to be mounted on is supplied by this script.
#
# If a subdirectory contains the file 'diskless_remount' the contents of
# the file is used to remount the subdirectory prior to it being copied to
# the memory filesystem. For example, if /conf/base/etc/diskless_remount
# contains the string 'my.server.com:/etc' then my.server.com:/etc will be
# mounted in place of the subdirectory. This allows you to avoid making
# duplicates of system directories in /conf.
# duplicates of system directories in /conf. Special processing is done
# to allow specifications relative to the root filesystem.
#
# If a subdirectory contains the file 'md_size', the contents of the
# file is used to determine the size of the memory filesystem, in 512
@ -79,7 +85,7 @@
# Those filesystems should not be specified in /conf. At least not yet.
dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
[ ${dlv:=0} -eq 0 ] && exit 0
[ ${dlv:=0} -eq 0 ] && [ ! -f /etc/diskless ] && exit 0
# chkerr:
#
@ -130,23 +136,25 @@ create_md() {
bootp_ifc=""
bootp_ipa=""
bootp_ipbca=""
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
if [ ${dlv:=0} -ne 0 ] ; then
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
fi
# Figure out our NFS root path
#
@ -188,6 +196,14 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
eval md_size_$subdir=`cat $j/md_size`
fi
# remount
#
if [ -d $j -a -f $j/remount ]; then
nfspt=`/bin/cat $j/remount`
$nfspt $j
chkerr $? "$nfspt $j"
fi
# NFS remount
#
if [ -d $j -a -f $j/diskless_remount ]; then