]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - etc/rc.d/zfs
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / etc / rc.d / zfs
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: zfs
7 # REQUIRE: mountcritlocal
8
9 . /etc/rc.subr
10
11 name="zfs"
12 rcvar="zfs_enable"
13 start_cmd="zfs_start"
14 stop_cmd="zfs_stop"
15 required_modules="zfs"
16
17 zfs_start_jail()
18 {
19         if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
20                 zfs mount -a
21         fi
22 }
23
24 zfs_start_main()
25 {
26         zfs mount -a
27         zfs share -a
28         if [ ! -r /etc/zfs/exports ]; then
29                 touch /etc/zfs/exports
30         fi
31 }
32
33 zfs_start()
34 {
35         if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
36                 zfs_start_jail
37         else
38                 zfs_start_main
39         fi
40 }
41
42 zfs_stop_jail()
43 {
44         if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
45                 zfs unmount -a
46         fi
47 }
48
49 zfs_stop_main()
50 {
51         zfs unshare -a
52         zfs unmount -a
53 }
54
55 zfs_stop()
56 {
57         if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
58                 zfs_stop_jail
59         else
60                 zfs_stop_main
61         fi
62 }
63
64 load_rc_config $name
65 run_rc_command "$1"