Index: head/etc/rc.d/zfs =================================================================== --- head/etc/rc.d/zfs (revision 307181) +++ head/etc/rc.d/zfs (revision 307182) @@ -1,67 +1,67 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: zfs -# REQUIRE: mountcritlocal +# REQUIRE: zfsbe # BEFORE: FILESYSTEMS var . /etc/rc.subr name="zfs" desc="Mount and share ZFS datasets" rcvar="zfs_enable" start_cmd="zfs_start" stop_cmd="zfs_stop" required_modules="zfs" zfs_start_jail() { if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then zfs mount -a fi } zfs_start_main() { zfs mount -va zfs share -a if [ ! -r /etc/zfs/exports ]; then touch /etc/zfs/exports fi } zfs_start() { if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then zfs_start_jail else zfs_start_main fi } zfs_stop_jail() { if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then zfs unmount -a fi } zfs_stop_main() { zfs unshare -a zfs unmount -a } zfs_stop() { if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then zfs_stop_jail else zfs_stop_main fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/zfsbe =================================================================== --- head/etc/rc.d/zfsbe (nonexistent) +++ head/etc/rc.d/zfsbe (revision 307182) @@ -0,0 +1,71 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# 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: head/etc/rc.d/zfsbe ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property