etc/init.d: decide which variant to use at build time.
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
.
Reference: https://github.com/openzfs/zfs/issues/8063
Reference: https://github.com/openzfs/zfs/issues/8204
Reference: https://github.com/openzfs/zfs/pull/8359
Signed-off-by: Benda Xu <orv@debian.org>
This commit is contained in:
parent
8f2f6cd2ac
commit
ff72a0e15e
|
@ -18,6 +18,7 @@ subst_sed_cmd = \
|
|||
-e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \
|
||||
-e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \
|
||||
-e 's|@DEFAULT_INIT_SHELL[@]|$(DEFAULT_INIT_SHELL)|g' \
|
||||
-e 's|@IS_SYSV_RC[@]|$(IS_SYSV_RC)|g' \
|
||||
-e 's|@LIBFETCH_DYNAMIC[@]|$(LIBFETCH_DYNAMIC)|g' \
|
||||
-e 's|@LIBFETCH_SONAME[@]|$(LIBFETCH_SONAME)|g' \
|
||||
-e 's|@PYTHON[@]|$(PYTHON)|g' \
|
||||
|
|
|
@ -578,13 +578,15 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
|||
|
||||
AC_MSG_CHECKING([default shell])
|
||||
case "$VENDOR" in
|
||||
gentoo) DEFAULT_INIT_SHELL="/sbin/openrc-run";;
|
||||
alpine) DEFAULT_INIT_SHELL="/sbin/openrc-run";;
|
||||
*) DEFAULT_INIT_SHELL="/bin/sh" ;;
|
||||
gentoo|alpine) DEFAULT_INIT_SHELL=/sbin/openrc-run
|
||||
IS_SYSV_RC=false ;;
|
||||
*) DEFAULT_INIT_SHELL=/bin/sh
|
||||
IS_SYSV_RC=true ;;
|
||||
esac
|
||||
|
||||
AC_MSG_RESULT([$DEFAULT_INIT_SHELL])
|
||||
AC_SUBST(DEFAULT_INIT_SHELL)
|
||||
AC_SUBST(IS_SYSV_RC)
|
||||
|
||||
AC_MSG_CHECKING([default nfs server init script])
|
||||
AS_IF([test "$VENDOR" = "debian"],
|
||||
|
|
|
@ -307,7 +307,7 @@ do_start()
|
|||
|
||||
# ----------------------------------------------------
|
||||
|
||||
if [ ! -e /sbin/openrc-run ]
|
||||
if @IS_SYSV_RC@
|
||||
then
|
||||
case "$1" in
|
||||
start)
|
||||
|
|
|
@ -104,7 +104,7 @@ do_stop()
|
|||
|
||||
# ----------------------------------------------------
|
||||
|
||||
if [ ! -e /sbin/openrc-run ]
|
||||
if @IS_SYSV_RC@
|
||||
then
|
||||
case "$1" in
|
||||
start)
|
||||
|
|
|
@ -114,7 +114,7 @@ do_stop()
|
|||
|
||||
# ----------------------------------------------------
|
||||
|
||||
if [ ! -e /sbin/openrc-run ]
|
||||
if @IS_SYSV_RC@
|
||||
then
|
||||
case "$1" in
|
||||
start)
|
||||
|
|
|
@ -57,7 +57,8 @@ do_stop()
|
|||
|
||||
# ----------------------------------------------------
|
||||
|
||||
if [ ! -e /sbin/openrc-run ]; then
|
||||
if @IS_SYSV_RC@
|
||||
then
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
|
|
|
@ -93,7 +93,8 @@ do_reload()
|
|||
|
||||
# ----------------------------------------------------
|
||||
|
||||
if [ ! -e /sbin/openrc-run ]; then
|
||||
if @IS_SYSV_RC@
|
||||
then
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
|
|
Loading…
Reference in New Issue