]> git.proxmox.com Git - mirror_zfs.git/commitdiff
etc/init.d: decide which variant to use at build time. master
authorBenda Xu <heroxbd@gmail.com>
Mon, 8 Apr 2024 23:52:24 +0000 (07:52 +0800)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 23:52:24 +0000 (16:52 -0700)
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 6ef28c526ba7.

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

config/Substfiles.am
config/zfs-build.m4
etc/init.d/README.md
etc/init.d/zfs-import.in
etc/init.d/zfs-load-key.in
etc/init.d/zfs-mount.in
etc/init.d/zfs-share.in
etc/init.d/zfs-zed.in

index 38e870b2f501a5ce07fa676cf09d3cace68dcae2..18422bf643010d702ee4295d48682918b859cd16 100644 (file)
@@ -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' \
index 5f36569fe25b6348e0c9882866cee8e0bc76ab6a..bb5a85d815d1a95c9df2b7eb04b21bc91b72c80b 100644 (file)
@@ -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"],
index 2de05042ce63f1ee9d670dc71ca763983ee92ff3..da780fdc1222bbc9f210ff405c7a68a646008690 100644 (file)
@@ -7,11 +7,7 @@ DESCRIPTION
 
   They have been tested successfully on:
 
-    * Debian GNU/Linux Wheezy
-    * Debian GNU/Linux Jessie
-    * Ubuntu Trusty
-    * CentOS 6.0
-    * CentOS 6.6
+    * Debian GNU/Linux Bookworm
     * Gentoo
 
 SUPPORT
index a9a0604f81acedfef943e01c71efdf08f642c94e..ff169eb96d86e79d2c98ca4cafb0ba843298e2e4 100755 (executable)
@@ -307,7 +307,7 @@ do_start()
 
 # ----------------------------------------------------
 
-if [ ! -e /sbin/openrc-run ]
+if @IS_SYSV_RC@
 then
        case "$1" in
                start)
index 53c7766b793a833fdf3363a3bb38a23e5cf5fc6e..27dfeeb0bcc572c7bdf71a1f5e704de4db0bd7f9 100755 (executable)
@@ -104,7 +104,7 @@ do_stop()
 
 # ----------------------------------------------------
 
-if [ ! -e /sbin/openrc-run ]
+if @IS_SYSV_RC@
 then
        case "$1" in
                start)
index a0825f19fcdd8421c0513f1b1afea27a30fa4c88..6a3ca5f869089584c8709e8e2561e60c6de3eb72 100755 (executable)
@@ -114,7 +114,7 @@ do_stop()
 
 # ----------------------------------------------------
 
-if [ ! -e /sbin/openrc-run ]
+if @IS_SYSV_RC@
 then
        case "$1" in
                start)
index 88978071cbf644f994f1121276c4f1586a12c0df..06c59c620b7574dc5775610364da8ea61cee9368 100755 (executable)
@@ -57,7 +57,8 @@ do_stop()
 
 # ----------------------------------------------------
 
-if [ ! -e /sbin/openrc-run ]; then
+if @IS_SYSV_RC@
+then
        case "$1" in
                start)
                        do_start
index e9cf8867403c14d09b09b96d62d2958c0b62a290..3d40600cea5ddaec89bf4c7ca979e89e5a246dcd 100755 (executable)
@@ -93,7 +93,8 @@ do_reload()
 
 # ----------------------------------------------------
 
-if [ ! -e /sbin/openrc-run ]; then
+if @IS_SYSV_RC@
+then
        case "$1" in
                start)
                        do_start