2 # shellcheck disable=SC2154
4 # zfs-share This script will network share zfs filesystems and volumes.
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.
13 # Required-Start: $local_fs $network $remote_fs zfs-mount
14 # Required-Stop: $local_fs $network $remote_fs zfs-mount
15 # Default-Start: 2 3 4 5
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
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.
24 # Released under the 2-clause BSD license.
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.
29 # Source the common init script
30 . @sysconfdir@/zfs/zfs-functions
32 # ----------------------------------------------------
36 after sysfs zfs-mount zfs-zed
37 keyword -lxc -openvz -prefix -vserver
42 check_boolean "$ZFS_SHARE" || exit 0
44 check_module_loaded "zfs" || exit 0
46 zfs_action "Sharing ZFS filesystems" "$ZFS" share -a
51 check_boolean "$ZFS_UNSHARE" || exit 0
53 check_module_loaded "zfs" || exit 0
55 zfs_action "Unsharing ZFS filesystems" "$ZFS" unshare -a
58 # ----------------------------------------------------
60 if [ ! -e /sbin/openrc-run ]; then
68 force-reload|reload|restart|status)
72 [ -n "$1" ] && echo "Error: Unknown command $1."
73 echo "Usage: $0 {start|stop}"
80 # Create wrapper functions since Gentoo don't use the case part.
81 depend() { do_depend; }