mirror_zfs/etc/init.d/zfs-share.in
Turbo Fredriksson 57732964d3 Init script fixes
* Fix regression - "OVERLAY_MOUNTS" should have been "DO_OVERLAY_MOUNTS".
* Fix update-rc.d commands in postinst.  Thanx to subzero79@GitHub.
* Fix make sure a filesystem exists before trying to mount in mount_fs()
* Fix local variable usage.
* Fix to read_mtab():
  * Strip control characters (space - \040) from /proc/mounts GLOBALY,
    not just first occurrence.
  * Don't replace unprintable characters ([/-. ]) for use in the variable
    name with underscore. No need, just remove them all together.
* Add check_boolean() to check if a user configure option is
  set ('yes', 'Yes', 'YES' or any combination there of) OR '1'.
  Anything else is considered 'unset'.
* Add a ZFS_POOL_IMPORT to the default config.
  * This is a semi colon separated list of pools to import ONLY.
  * This is intended for systems which have _a lot_ of pools (from
    a SAN for example) and it would be to many to put in the
    ZFS_POOL_EXCEPTIONS variable..
* Add a config option "ZPOOL_IMPORT_OPTS" for adding additional options
  to "zpool import".
* Add documentation and the chance of overriding the ZPOOL_CACHE
  variable in the config file.
* Remove "sort" from find_pools() and setup_snapshot_booting().
  Sometimes not available, and not really necessary.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Issue #3816
2015-09-29 11:42:24 -07:00

86 lines
2.2 KiB
Plaintext
Executable File

#!@SHELL@
#
# 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 zfs-zed
# Required-Stop: $local_fs $network $remote_fs zfs-mount zfs-zed
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: iscsi iscsitarget istgt scst @NFS_SRV@ samba samba4 zfs-mount zfs-zed
# Should-Stop: iscsi iscsitarget istgt scst @NFS_SRV@ 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.
#
# The original script that acted as a template for this script came from
# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a
# licensing stansa) in the commit dated Mar 24, 2011:
# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a
# 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 [ ! -e /etc/gentoo-release ]; 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