Subject: [PATCH 4/5] guix-install.sh: Fix detection of SysV init system.

From: Vincent Legoll <[email-masked]>
Date: Sun, 20 Dec 2020 18:28:38 +0100

Checking the presence of a regular file & not symlink (/etc/init.d/cron)
is not sufficient.

Detect a sysvinit system by running `/sbin/init --version' and checking the
output contains the string "SysV".

* etc/guix-install.sh (chk_init_sys): fix sysvinit system detection.
---
 etc/guix-install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index d40d90b377..307c42d3fb 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -150,7 +150,7 @@ chk_init_sys()
         _msg "${INF}init system is: systemd"
         INIT_SYS="systemd"
         return 0
-    elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then
+    elif /sbin/init --version 2>/dev/null | grep -q SysV; then
         _msg "${INF}init system is: sysv-init"
         INIT_SYS="sysv-init"
         return 0
-- 
2.29.2