]> git.proxmox.com Git - mirror_zfs.git/blame - etc/init.d/zfs-share.in
zfs filesystem skipped by df -h
[mirror_zfs.git] / etc / init.d / zfs-share.in
CommitLineData
2a34db1b
TF
1#!@SHELL@
2#
3# zfs-share This script will network share zfs filesystems and volumes.
4#
5# chkconfig: 2345 30 99
6# description: Run the `zfs share -a` or `zfs unshare -a` commands
7# for controlling iSCSI, NFS, or CIFS network shares.
8# probe: true
9#
10### BEGIN INIT INFO
11# Provides: zfs-share
3f1cc17c
JL
12# Required-Start: $local_fs $network $remote_fs zfs-mount zfs-zed
13# Required-Stop: $local_fs $network $remote_fs zfs-mount zfs-zed
2a34db1b
TF
14# Default-Start: 2 3 4 5
15# Default-Stop: 0 1 6
3f1cc17c
JL
16# Should-Start: iscsi iscsitarget istgt scst @NFS_SRV@ samba samba4 zfs-mount zfs-zed
17# Should-Stop: iscsi iscsitarget istgt scst @NFS_SRV@ samba samba4 zfs-mount zfs-zed
2a34db1b
TF
18# Short-Description: Network share ZFS datasets and volumes.
19# Description: Run the `zfs share -a` or `zfs unshare -a` commands
20# for controlling iSCSI, NFS, or CIFS network shares.
21### END INIT INFO
22#
23# Released under the 2-clause BSD license.
24#
25# The original script that acted as a template for this script came from
26# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
27# licensing stansa) in the commit dated Mar 24, 2011:
28# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
29
30# Source the common init script
31. @sysconfdir@/zfs/zfs-functions
32
33# ----------------------------------------------------
34
35do_depend()
36{
3f1cc17c 37 after sysfs zfs-mount zfs-zed
2a34db1b
TF
38 keyword -lxc -openvz -prefix -vserver
39}
40
41do_start()
42{
57732964 43 check_boolean "$ZFS_SHARE" || exit 0
2a34db1b 44
48511ea6 45 check_module_loaded "zfs" || exit 0
2a34db1b
TF
46
47 zfs_action "Sharing ZFS filesystems" "$ZFS" share -a
48}
49
50do_stop()
51{
57732964 52 check_boolean "$ZFS_UNSHARE" || exit 0
2a34db1b 53
48511ea6 54 check_module_loaded "zfs" || exit 0
2a34db1b
TF
55
56 zfs_action "Unsharing ZFS filesystems" "$ZFS" unshare -a
57}
58
59# ----------------------------------------------------
60
c53fb011 61if [ ! -e /sbin/openrc-run ]; 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 $?
80else
81 # Create wrapper functions since Gentoo don't use the case part.
82 depend() { do_depend; }
83 start() { do_start; }
84 stop() { do_stop; }
85fi