Blame 0173-Check-for-systemd-before-installing-systemd-specific.patch

Harald Hoyer 453682
From 2da041d6727e1dac8e751e305c7dc4cf01e34ed5 Mon Sep 17 00:00:00 2001
Harald Hoyer 453682
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 453682
Date: Mon, 16 Nov 2015 09:41:26 +0100
Harald Hoyer 453682
Subject: [PATCH] Check for systemd before installing systemd specific files
Harald Hoyer 453682
Harald Hoyer 453682
https://bugzilla.redhat.com/show_bug.cgi?id=1282010
Harald Hoyer 453682
---
Harald Hoyer 453682
 dracut.sh                              | 16 +++++++++-------
Harald Hoyer 453682
 modules.d/90crypt/module-setup.sh      | 21 ++++++++++++---------
Harald Hoyer 453682
 modules.d/95udev-rules/module-setup.sh |  6 ++++--
Harald Hoyer 453682
 3 files changed, 25 insertions(+), 18 deletions(-)
Harald Hoyer 453682
Harald Hoyer 453682
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 453682
index be4c107..9e85f50 100755
Harald Hoyer 453682
--- a/dracut.sh
Harald Hoyer 453682
+++ b/dracut.sh
Harald Hoyer 453682
@@ -1481,13 +1481,15 @@ if [[ $kernel_only != yes ]]; then
Harald Hoyer 453682
         cat "$f" >> "${initdir}/etc/fstab"
Harald Hoyer 453682
     done
Harald Hoyer 453682
 
Harald Hoyer 453682
-    if [ -d ${initdir}/$systemdutildir ]; then
Harald Hoyer 453682
-        mkdir -p ${initdir}/etc/conf.d
Harald Hoyer 453682
-        {
Harald Hoyer 453682
-            printf "%s\n" "systemdutildir=\"$systemdutildir\""
Harald Hoyer 453682
-            printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
Harald Hoyer 453682
-            printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
Harald Hoyer 453682
-        } > ${initdir}/etc/conf.d/systemd.conf
Harald Hoyer 453682
+    if dracut_module_included "systemd"; then
Harald Hoyer 453682
+        if [ -d ${initdir}/$systemdutildir ]; then
Harald Hoyer 453682
+            mkdir -p ${initdir}/etc/conf.d
Harald Hoyer 453682
+            {
Harald Hoyer 453682
+                printf "%s\n" "systemdutildir=\"$systemdutildir\""
Harald Hoyer 453682
+                printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
Harald Hoyer 453682
+                printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
Harald Hoyer 453682
+            } > ${initdir}/etc/conf.d/systemd.conf
Harald Hoyer 453682
+        fi
Harald Hoyer 453682
     fi
Harald Hoyer 453682
 
Harald Hoyer 453682
     if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
Harald Hoyer 453682
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
Harald Hoyer 453682
index 4df520c..5d964f4 100755
Harald Hoyer 453682
--- a/modules.d/90crypt/module-setup.sh
Harald Hoyer 453682
+++ b/modules.d/90crypt/module-setup.sh
Harald Hoyer 453682
@@ -86,14 +86,17 @@ install() {
Harald Hoyer 453682
 
Harald Hoyer 453682
     inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
Harald Hoyer 453682
 
Harald Hoyer 453682
-    inst_multiple -o \
Harald Hoyer 453682
-        $systemdutildir/system-generators/systemd-cryptsetup-generator \
Harald Hoyer 453682
-        $systemdutildir/systemd-cryptsetup \
Harald Hoyer 453682
-        $systemdsystemunitdir/systemd-ask-password-console.path \
Harald Hoyer 453682
-        $systemdsystemunitdir/systemd-ask-password-console.service \
Harald Hoyer 453682
-        $systemdsystemunitdir/cryptsetup.target \
Harald Hoyer 453682
-        $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
Harald Hoyer 453682
-        systemd-ask-password systemd-tty-ask-password-agent
Harald Hoyer 453682
-    inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
Harald Hoyer 453682
+    if dracut_module_included "systemd"; then
Harald Hoyer 453682
+        inst_multiple -o \
Harald Hoyer 453682
+                      $systemdutildir/system-generators/systemd-cryptsetup-generator \
Harald Hoyer 453682
+                      $systemdutildir/systemd-cryptsetup \
Harald Hoyer 453682
+                      $systemdsystemunitdir/systemd-ask-password-console.path \
Harald Hoyer 453682
+                      $systemdsystemunitdir/systemd-ask-password-console.service \
Harald Hoyer 453682
+                      $systemdsystemunitdir/cryptsetup.target \
Harald Hoyer 453682
+                      $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
Harald Hoyer 453682
+                      systemd-ask-password systemd-tty-ask-password-agent
Harald Hoyer 453682
+        inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
Harald Hoyer 453682
+    fi
Harald Hoyer 453682
+
Harald Hoyer 453682
     dracut_need_initqueue
Harald Hoyer 453682
 }
Harald Hoyer 453682
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
Harald Hoyer 453682
index f4f9cf8..6a0625a 100755
Harald Hoyer 453682
--- a/modules.d/95udev-rules/module-setup.sh
Harald Hoyer 453682
+++ b/modules.d/95udev-rules/module-setup.sh
Harald Hoyer 453682
@@ -56,8 +56,10 @@ install() {
Harald Hoyer 453682
     # eudev rules
Harald Hoyer 453682
     inst_rules 80-drivers-modprobe.rules
Harald Hoyer 453682
 
Harald Hoyer 453682
-    inst_multiple -o ${systemdutildir}/network/*.link
Harald Hoyer 453682
-    [[ $hostonly ]] && inst_multiple -H -o /etc/systemd/network/*.link
Harald Hoyer 453682
+    if dracut_module_included "systemd"; then
Harald Hoyer 453682
+        inst_multiple -o ${systemdutildir}/network/*.link
Harald Hoyer 453682
+        [[ $hostonly ]] && inst_multiple -H -o /etc/systemd/network/*.link
Harald Hoyer 453682
+    fi
Harald Hoyer 453682
 
Harald Hoyer 453682
     {
Harald Hoyer 453682
         for i in cdrom tape dialout floppy; do