]> git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/zfsutils.zfs-share.init
Remove useless option file
[mirror_zfs-debian.git] / debian / zfsutils.zfs-share.init
1 #!/bin/sh
2
3 ### BEGIN INIT INFO
4 # Provides: shareiscsi sharenfs sharesmb zfs-share
5 # Required-Start: $local_fs $network $remote_fs
6 # Required-Stop: $local_fs $network $remote_fs
7 # Default-Start: 2 3 4 5
8 # Default-Stop: 0 1 6
9 # Should-Start: iscsi iscsitarget istgt nfs-kernel-server samba
10 # Should-Stop: iscsi iscsitarget istgt nfs-kernel-server samba
11 # Short-Description: Network share ZFS datasets.
12 # Description: Run the `zfs share -a` or `zfs unmount -a` commands
13 # for controlling iSCSI, NFS, or CIFS network shares.
14 ### END INIT INFO
15
16 PATH=/sbin:/bin:/usr/sbin:/usr/bin
17
18 . /lib/lsb/init-functions
19 # Do not source /lib/init/*.sh as they are not public APIs after getting rid
20 # of /lib/init/rw. However, this line may help when doing back port to older
21 # releases.
22 #
23 #. /lib/init/vars.sh
24
25 [ -f /etc/default/zfs ] && . /etc/default/zfs
26
27 do_start()
28 {
29 log_begin_msg "Sharing ZFS filesystems"
30 log_progress_msg "filesystems"
31 zfs share -a
32 RET=$?
33
34 if [ $RET != 0 ] ; then
35 log_end_msg $RET
36 exit $RET
37 fi
38
39 log_end_msg 0
40 }
41
42 do_stop()
43 {
44 log_begin_msg "Unsharing ZFS filesystems"
45 log_progress_msg "filesystems"
46 zfs unshare -a
47 RET=$?
48
49 # Ignore a non-zero `zfs` result so that a busy ZFS instance
50 # does not hang the system during shutdown.
51 if [ $RET != 0 ] ; then
52 log_end_msg $RET
53 fi
54
55 log_end_msg 0
56 }
57
58 case "$1" in
59 (start)
60 case "$ZFS_SHARE" in
61 ([Oo][Ff][Ff]|[Nn][Oo]|'')
62 exit 0
63 ;;
64 esac
65 do_start
66 ;;
67 (stop)
68 case "$ZFS_UNSHARE" in
69 ([Oo][Ff][Ff]|[Nn][Oo]|'')
70 exit 0
71 ;;
72 esac
73 do_stop
74 ;;
75 (force-reload|reload|restart|status)
76 # no-op
77 ;;
78
79 (*)
80 [ -n "$1" ] && echo "Error: Unknown command $1."
81 echo "Usage: $0 {start|stop}"
82 exit 3
83 ;;
84 esac