]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
added debug-shell to initrd in systemd version >= 240
authorOndrej Dubaj <odubaj@redhat.com>
Thu, 29 Aug 2019 12:31:06 +0000 (14:31 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 29 Aug 2019 15:06:59 +0000 (15:06 +0000)
modules.d/00systemd/module-setup.sh

index feec6ca5ae493ce81fd0eda936b3e20b64ec8987..f931d0ab5252660542a8c813afce5106ecf152e6 100755 (executable)
@@ -1,15 +1,21 @@
 #!/bin/bash
 
+getSystemdVersion() {
+    SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
+    # Check if the systemd version is a valid number
+    if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
+        dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
+        exit 1
+    fi
+
+    echo $SYSTEMD_VERSION
+}
+
 # called by dracut
 check() {
     [[ $mount_needs ]] && return 1
     if require_binaries $systemdutildir/systemd; then
-        SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
-        # Check if the systemd version is a valid number
-        if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
-            dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
-            exit 1
-        fi
+        SYSTEMD_VERSION=$(getSystemdVersion)
         (( $SYSTEMD_VERSION >= 198 )) && return 0
        return 255
     fi
@@ -36,6 +42,12 @@ install() {
         exit 1
     fi
 
+    if [ $(getSystemdVersion) -ge 240 ]; then
+    inst_multiple -o \
+        $systemdutildir/system-generators/systemd-debug-generator \
+        $systemdsystemunitdir/debug-shell.service
+    fi
+
     inst_multiple -o \
         $systemdutildir/systemd \
         $systemdutildir/systemd-coredump \