aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rc/rc.conf1
-rwxr-xr-xlibexec/rc/rc.d/zfsbe18
2 files changed, 19 insertions, 0 deletions
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 1d01b551dc6a..4d9406cf73c5 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -64,6 +64,7 @@ rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
# ZFS support
zfs_enable="NO" # Set to YES to automatically mount ZFS file systems
+zfs_bootonce_activate="NO" # Set YES to make successful bootonce BE permanent
# ZFSD support
zfsd_enable="NO" # Set to YES to automatically start the ZFS fault
diff --git a/libexec/rc/rc.d/zfsbe b/libexec/rc/rc.d/zfsbe
index 3c852017aa41..e0a30c5a16b4 100755
--- a/libexec/rc/rc.d/zfsbe
+++ b/libexec/rc/rc.d/zfsbe
@@ -48,6 +48,21 @@ mount_subordinate()
done
}
+activate_bootonce()
+{
+ local _dev
+ local _bootonce
+ local _be
+
+ _dev=$1
+ _be=${_dev##*/}
+
+ _bootonce="`kenv -q zfs-bootonce`"
+ if [ "$_bootonce" = "zfs:${_dev}:" ] ; then
+ bectl activate $_be
+ fi
+}
+
be_start()
{
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
@@ -57,6 +72,9 @@ be_start()
[ $_mp = "/" ] || continue
if [ $_type = "zfs" ] ; then
mount_subordinate $_dev
+ if checkyesno zfs_bootonce_activate; then
+ activate_bootonce $_dev
+ fi
fi
break
done