mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
162cc80b81
Let Debian use the sysv-rc variant of the script, even when OpenRC is
installed. Unlike on Gentoo, OpenRC on Debian consumes both the
sysv-rc scripts and OpenRC ones. ZFS initscripts on Debian should be
the sysv-rc version to provide most compatibility and to integrate
with the rest of initscripts for dependency tracking.
Restrict the substitution in the Makefile to the dedicated list.
This construct is inspired by Mo Zhou's detection of the execution
shell and follows the strategy of Peter in 6ef28c526b
.
As of 2024, the initscripts are mostly relevant on Debian, Gentoo and
their derivatives.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Benda Xu <orv@debian.org>
Issue #8063
Issue #8204
Issue #8359
Closes #15977
86 lines
2.1 KiB
Plaintext
Executable File
86 lines
2.1 KiB
Plaintext
Executable File
#!@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
|