summaryrefslogtreecommitdiffstats
path: root/etc/rc.initdiskless
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2008-05-15 11:00:23 +0000
committerbms <bms@FreeBSD.org>2008-05-15 11:00:23 +0000
commit664e023b090c85aa49494361ed2774e64696736e (patch)
tree12b7c3cb9105fe7435b048137835e1563ad224de /etc/rc.initdiskless
parentb1f1ca6b46a9cc9e1fdfc3521881af7bfaffb673 (diff)
downloadFreeBSD-src-664e023b090c85aa49494361ed2774e64696736e.zip
FreeBSD-src-664e023b090c85aa49494361ed2774e64696736e.tar.gz
Add support for /conf/T/M/remount_optional.
The rc.initdiskless functionality is used by NanoBSD to allow configuration files to live on a separate configuration slice, which acts as NVRAM, whilst the system image is mounted read-only. Normally, if the remount command fails during boot, this is regarded as a fatal error. If /conf/T/M/remount_optional is present, this error is non-fatal. If the file is not present, the default behaviour is unchanged. This is very useful for people building live CD images using FreeBSD, where the NVRAM lives somewhere completely differently from the system image, and may be present on removable media which is not present during the initial boot.
Diffstat (limited to 'etc/rc.initdiskless')
-rw-r--r--etc/rc.initdiskless8
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless
index 744d767..eb9468f 100644
--- a/etc/rc.initdiskless
+++ b/etc/rc.initdiskless
@@ -69,6 +69,10 @@
# /conf/1.2.3.4/foo/remount contains "mount -o ro /dev/ad0s3",
# then /dev/ad0s3 will be be mounted on /conf/1.2.3.4/foo/
#
+# /conf/T/M/remount_optional
+# If this file exists, then failure to execute the mount
+# command contained in /conf/T/M/remount is non-fatal.
+#
# /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
@@ -147,8 +151,12 @@ log() {
#
# checks error code and drops into shell on failure.
# if shell exits, terminates script as well as /etc/rc.
+# if remount_optional exists under the mountpoint, skip this check.
#
chkerr() {
+ lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 )
+ mountpoint="$(lastitem $2)"
+ [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due to remount_optional" ; return )
case $1 in
0)
;;
OpenPOWER on IntegriCloud