blob: 3c852017aa418afa36fdfcfe3302dca06929c59f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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"
|