]>
Commit | Line | Data |
---|---|---|
38e2e9ce | 1 | #!@DEFAULT_INIT_SHELL@ |
ae66d3aa | 2 | # shellcheck disable=SC2154 |
2a34db1b TF |
3 | # |
4 | # zfs-share This script will network share zfs filesystems and volumes. | |
5 | # | |
6 | # chkconfig: 2345 30 99 | |
7 | # description: Run the `zfs share -a` or `zfs unshare -a` commands | |
8 | # for controlling iSCSI, NFS, or CIFS network shares. | |
9 | # probe: true | |
10 | # | |
11 | ### BEGIN INIT INFO | |
12 | # Provides: zfs-share | |
3a1f2d53 | 13 | # Required-Start: $local_fs $network $remote_fs zfs-mount |
14 | # Required-Stop: $local_fs $network $remote_fs zfs-mount | |
2a34db1b TF |
15 | # Default-Start: 2 3 4 5 |
16 | # Default-Stop: 0 1 6 | |
38e2e9ce AS |
17 | # Should-Start: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed |
18 | # Should-Stop: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed | |
2a34db1b TF |
19 | # Short-Description: Network share ZFS datasets and volumes. |
20 | # Description: Run the `zfs share -a` or `zfs unshare -a` commands | |
21 | # for controlling iSCSI, NFS, or CIFS network shares. | |
22 | ### END INIT INFO | |
23 | # | |
24 | # Released under the 2-clause BSD license. | |
25 | # | |
adc851d9 AZ |
26 | # This script is based on debian/zfsutils.zfs.init from the |
27 | # Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno. | |
2a34db1b TF |
28 | |
29 | # Source the common init script | |
30 | . @sysconfdir@/zfs/zfs-functions | |
31 | ||
32 | # ---------------------------------------------------- | |
33 | ||
34 | do_depend() | |
35 | { | |
3f1cc17c | 36 | after sysfs zfs-mount zfs-zed |
2a34db1b TF |
37 | keyword -lxc -openvz -prefix -vserver |
38 | } | |
39 | ||
40 | do_start() | |
41 | { | |
57732964 | 42 | check_boolean "$ZFS_SHARE" || exit 0 |
2a34db1b | 43 | |
48511ea6 | 44 | check_module_loaded "zfs" || exit 0 |
2a34db1b TF |
45 | |
46 | zfs_action "Sharing ZFS filesystems" "$ZFS" share -a | |
47 | } | |
48 | ||
49 | do_stop() | |
50 | { | |
57732964 | 51 | check_boolean "$ZFS_UNSHARE" || exit 0 |
2a34db1b | 52 | |
48511ea6 | 53 | check_module_loaded "zfs" || exit 0 |
2a34db1b TF |
54 | |
55 | zfs_action "Unsharing ZFS filesystems" "$ZFS" unshare -a | |
56 | } | |
57 | ||
58 | # ---------------------------------------------------- | |
59 | ||
162cc80b BX |
60 | if @IS_SYSV_RC@ |
61 | then | |
2a34db1b TF |
62 | case "$1" in |
63 | start) | |
64 | do_start | |
65 | ;; | |
66 | stop) | |
67 | do_stop | |
68 | ;; | |
69 | force-reload|reload|restart|status) | |
70 | # no-op | |
71 | ;; | |
72 | *) | |
73 | [ -n "$1" ] && echo "Error: Unknown command $1." | |
74 | echo "Usage: $0 {start|stop}" | |
75 | exit 3 | |
76 | ;; | |
77 | esac | |
78 | ||
79 | exit $? | |
80 | else | |
81 | # Create wrapper functions since Gentoo don't use the case part. | |
82 | depend() { do_depend; } | |
83 | start() { do_start; } | |
84 | stop() { do_stop; } | |
85 | fi |