blob: 06c59c620b7574dc5775610364da8ea61cee9368 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!@DEFAULT_INIT_SHELL@
# shellcheck disable=SC2154
#
# zfs-share This script will network share zfs filesystems and volumes.
#
# chkconfig: 2345 30 99
# description: Run the `zfs share -a` or `zfs unshare -a` commands
# for controlling iSCSI, NFS, or CIFS network shares.
# probe: true
#
### BEGIN INIT INFO
# Provides: zfs-share
# Required-Start: $local_fs $network $remote_fs zfs-mount
# Required-Stop: $local_fs $network $remote_fs zfs-mount
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed
# Should-Stop: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed
# Short-Description: Network share ZFS datasets and volumes.
# Description: Run the `zfs share -a` or `zfs unshare -a` commands
# for controlling iSCSI, NFS, or CIFS network shares.
### END INIT INFO
#
# Released under the 2-clause BSD license.
#
# This script is based on debian/zfsutils.zfs.init from the
# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno.
# Source the common init script
. @sysconfdir@/zfs/zfs-functions
# ----------------------------------------------------
do_depend()
{
after sysfs zfs-mount zfs-zed
keyword -lxc -openvz -prefix -vserver
}
do_start()
{
check_boolean "$ZFS_SHARE" || exit 0
check_module_loaded "zfs" || exit 0
zfs_action "Sharing ZFS filesystems" "$ZFS" share -a
}
do_stop()
{
check_boolean "$ZFS_UNSHARE" || exit 0
check_module_loaded "zfs" || exit 0
zfs_action "Unsharing ZFS filesystems" "$ZFS" unshare -a
}
# ----------------------------------------------------
if @IS_SYSV_RC@
then
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
force-reload|reload|restart|status)
# no-op
;;
*)
[ -n "$1" ] && echo "Error: Unknown command $1."
echo "Usage: $0 {start|stop}"
exit 3
;;
esac
exit $?
else
# Create wrapper functions since Gentoo don't use the case part.
depend() { do_depend; }
start() { do_start; }
stop() { do_stop; }
fi
|