1#!@DEFAULT_INIT_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 12# Required-Start: $local_fs $network $remote_fs zfs-mount 13# Required-Stop: $local_fs $network $remote_fs zfs-mount 14# Default-Start: 2 3 4 5 15# Default-Stop: 0 1 6 16# Should-Start: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed 17# Should-Stop: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed 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# This script is based on debian/zfsutils.zfs.init from the 26# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno. 27 28# Source the common init script 29. @sysconfdir@/zfs/zfs-functions 30 31# ---------------------------------------------------- 32 33do_depend() 34{ 35 after sysfs zfs-mount zfs-zed 36 keyword -lxc -openvz -prefix -vserver 37} 38 39do_start() 40{ 41 check_boolean "$ZFS_SHARE" || exit 0 42 43 check_module_loaded "zfs" || exit 0 44 45 zfs_action "Sharing ZFS filesystems" "$ZFS" share -a 46} 47 48do_stop() 49{ 50 check_boolean "$ZFS_UNSHARE" || exit 0 51 52 check_module_loaded "zfs" || exit 0 53 54 zfs_action "Unsharing ZFS filesystems" "$ZFS" unshare -a 55} 56 57# ---------------------------------------------------- 58 59if [ ! -e /sbin/openrc-run ]; then 60 case "$1" in 61 start) 62 do_start 63 ;; 64 stop) 65 do_stop 66 ;; 67 force-reload|reload|restart|status) 68 # no-op 69 ;; 70 *) 71 [ -n "$1" ] && echo "Error: Unknown command $1." 72 echo "Usage: $0 {start|stop}" 73 exit 3 74 ;; 75 esac 76 77 exit $? 78else 79 # Create wrapper functions since Gentoo don't use the case part. 80 depend() { do_depend; } 81 start() { do_start; } 82 stop() { do_stop; } 83fi 84