[Midnightbsd-cvs] src [11633] trunk/etc/rc.d: move zfs in boot order
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jul 8 13:44:02 EDT 2018
Revision: 11633
http://svnweb.midnightbsd.org/src/?rev=11633
Author: laffer1
Date: 2018-07-08 13:44:00 -0400 (Sun, 08 Jul 2018)
Log Message:
-----------
move zfs in boot order
Modified Paths:
--------------
trunk/etc/rc.d/FILESYSTEMS
trunk/etc/rc.d/var
trunk/etc/rc.d/zfs
Added Paths:
-----------
trunk/etc/rc.d/zfsbe
Modified: trunk/etc/rc.d/FILESYSTEMS
===================================================================
--- trunk/etc/rc.d/FILESYSTEMS 2018-07-08 16:59:22 UTC (rev 11632)
+++ trunk/etc/rc.d/FILESYSTEMS 2018-07-08 17:44:00 UTC (rev 11633)
@@ -3,7 +3,7 @@
# $MidnightBSD$
# PROVIDE: FILESYSTEMS
-# REQUIRE: root mountcritlocal cleanvar zfs
+# REQUIRE: root mountcritlocal cleanvar
# This is a dummy dependency, for services which require file systems
# to be mounted before starting. It also serves as the default early /
Modified: trunk/etc/rc.d/var
===================================================================
--- trunk/etc/rc.d/var 2018-07-08 16:59:22 UTC (rev 11632)
+++ trunk/etc/rc.d/var 2018-07-08 17:44:00 UTC (rev 11633)
@@ -25,11 +25,12 @@
# SUCH DAMAGE.
#
# $MidnightBSD$
-#
# PROVIDE: var
-# REQUIRE: mountcritlocal zfs
+# REQUIRE: mountcritlocal
+# NFS /var is not supported, unless NFS /var is part of diskless NFS /
+
. /etc/rc.subr
name="var"
Modified: trunk/etc/rc.d/zfs
===================================================================
--- trunk/etc/rc.d/zfs 2018-07-08 16:59:22 UTC (rev 11632)
+++ trunk/etc/rc.d/zfs 2018-07-08 17:44:00 UTC (rev 11633)
@@ -1,10 +1,10 @@
#!/bin/sh
#
# $MidnightBSD$
-#
# PROVIDE: zfs
-# REQUIRE: mountcritlocal
+# REQUIRE: zfsbe
+# BEFORE: FILESYSTEMS var
. /etc/rc.subr
Added: trunk/etc/rc.d/zfsbe
===================================================================
--- trunk/etc/rc.d/zfsbe (rev 0)
+++ trunk/etc/rc.d/zfsbe 2018-07-08 17:44:00 UTC (rev 11633)
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# $MidnightBSD$
+
+# PROVIDE: zfsbe
+# REQUIRE: mountcritlocal
+
+# Handle boot environment subordinate filesystems
+# that may have canmount property set to noauto.
+# For these filesystems mountpoint relative to /
+# must be the same as their dataset name relative
+# to BE root dataset.
+
+. /etc/rc.subr
+
+name="zfsbe"
+rcvar="zfs_enable"
+start_cmd="be_start"
+stop_cmd="be_stop"
+required_modules="zfs"
+
+mount_subordinate()
+{
+ local _be
+
+ _be=$1
+ zfs list -rH -o mountpoint,name,canmount,mounted -s mountpoint -t filesystem $_be | \
+ while read _mp _name _canmount _mounted ; do
+ # skip filesystems that must not be mounted
+ [ "$_canmount" = "off" ] && continue
+ # skip filesystems that are already mounted
+ [ "$_mounted" = "yes" ] && continue
+ case "$_mp" in
+ "none" | "legacy" | "/" | "/$_be")
+ # do nothing for filesystems with unset or legacy mountpoint
+ # or those that would be mounted over /
+ ;;
+ "/$_be/"*)
+ # filesystems with mountpoint relative to BE
+ mount -t zfs $_name ${_mp#/$_be}
+ ;;
+ *)
+ # filesystems with mountpoint elsewhere
+ zfs mount $_name
+ ;;
+ esac
+ done
+}
+
+be_start()
+{
+ if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
+ :
+ else
+ mount -p | while read _dev _mp _type _rest; do
+ [ $_mp = "/" ] || continue
+ if [ $_type = "zfs" ] ; then
+ mount_subordinate $_dev
+ fi
+ break
+ done
+ fi
+}
+
+be_stop()
+{
+}
+
+load_rc_config $name
+run_rc_command "$1"
Property changes on: trunk/etc/rc.d/zfsbe
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list