File git-06-8640f848c6677f1149b9765a8c86135956604007.patch of Package aaa_base.24604

commit 8640f848c6677f1149b9765a8c86135956604007
Author: Michal Koutný <mkoutny@suse.com>
Date:   Thu Jul 18 12:30:33 2019 +0200

    Make systemd detection cgroup oblivious (bsc#1140647)
    
    systemd can work in three exclusive cgroup modes: legacy, hybrid and
    unified. The mode affects where and what cgroup hierarchies are mounted.
    
    Do not rely on that and detect running systemd as systemd itself does it
    (src/libsystemd/sd-daemon/sd-daemon.c, function sd_booted).

diff --git a/files/usr/bin/chkconfig b/files/usr/bin/chkconfig
index 99d0bb7..e4391f7 100755
--- a/files/usr/bin/chkconfig
+++ b/files/usr/bin/chkconfig
@@ -461,16 +461,8 @@ sub readable {
 # check if systemd is active
 #
 sub is_systemd_active {
-    my $cgroup_dev;
-    my $systemd_dev;
-    my $st;
-
     use File::stat;
-    $st = lstat("/sys/fs/cgroup") or return 0;
-    $cgroup_dev = $st->dev;
-    $st = lstat("/sys/fs/cgroup/systemd") or return 0;
-    $systemd_dev = $st->dev;
-    return 0 if ($cgroup_dev == $systemd_dev);
+    lstat("/run/systemd/system") or return 0;
     -e $systemd_binary_path or return 0;
     return 1;
 }
diff --git a/files/usr/sbin/service b/files/usr/sbin/service
index 83e5352..24cc6cc 100755
--- a/files/usr/sbin/service
+++ b/files/usr/sbin/service
@@ -7,7 +7,7 @@ VERSION="18.02.16"
 
 sd_booted()
 {
-    test -d /sys/fs/cgroup/systemd/
+    test -e /run/systemd/system/
 }
 
 #
openSUSE Build Service is sponsored by