Blame 0029-dracut-systemd-dracut-cmdline-ask-fix-dracut-kernel-.patch

Harald Hoyer b38677
From eddca3c9c24e4cb9c5def0b98920e36b16fafaac Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: Evgeny Vereshchagin <evvers@ya.ru>
Harald Hoyer b38677
Date: Mon, 15 Feb 2016 08:29:40 +0000
Harald Hoyer b38677
Subject: [PATCH] dracut-systemd/dracut-cmdline-ask: fix dracut
Harald Hoyer b38677
 --kernel-cmdline=rd.cmdline=ask
Harald Hoyer b38677
Harald Hoyer b38677
How to reproduce:
Harald Hoyer b38677
Harald Hoyer b38677
host# dracut --kernel-cmdline='rd.cmdline=ask' initramfs.img
Harald Hoyer b38677
host# qemu-system-x86_64 -initrd initramfs.img ... -append root=/dev/sda1 ...
Harald Hoyer b38677
...
Harald Hoyer b38677
Harald Hoyer b38677
qemu-host# journalctl -b | grep dracut-cmdline-ask
Harald Hoyer b38677
...
Harald Hoyer b38677
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Installed new job dracut-cmdline-ask.service/start as 42
Harald Hoyer b38677
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: ConditionKernelCommandLine=rd.cmdline=ask failed.
Harald Hoyer b38677
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Starting requested but condition failed. Not starting unit.
Harald Hoyer b38677
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Job dracut-cmdline-ask.service/start finished, result=done
Harald Hoyer b38677
...
Harald Hoyer b38677
Harald Hoyer b38677
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
Harald Hoyer b38677
---
Harald Hoyer b38677
 modules.d/98dracut-systemd/dracut-cmdline-ask.service | 3 ++-
Harald Hoyer b38677
 modules.d/98dracut-systemd/dracut-cmdline-ask.sh      | 4 ++++
Harald Hoyer b38677
 2 files changed, 6 insertions(+), 1 deletion(-)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/modules.d/98dracut-systemd/dracut-cmdline-ask.service b/modules.d/98dracut-systemd/dracut-cmdline-ask.service
Harald Hoyer b38677
index 9a34b35..8bc7d80 100644
Harald Hoyer b38677
--- a/modules.d/98dracut-systemd/dracut-cmdline-ask.service
Harald Hoyer b38677
+++ b/modules.d/98dracut-systemd/dracut-cmdline-ask.service
Harald Hoyer b38677
@@ -14,7 +14,8 @@ Before=dracut-cmdline.service
Harald Hoyer b38677
 After=systemd-journald.socket
Harald Hoyer b38677
 Wants=systemd-journald.socket
Harald Hoyer b38677
 ConditionPathExists=/usr/lib/initrd-release
Harald Hoyer b38677
-ConditionKernelCommandLine=rd.cmdline=ask
Harald Hoyer b38677
+ConditionKernelCommandLine=|rd.cmdline=ask
Harald Hoyer b38677
+ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
Harald Hoyer b38677
 
Harald Hoyer b38677
 [Service]
Harald Hoyer b38677
 Environment=DRACUT_SYSTEMD=1
Harald Hoyer b38677
diff --git a/modules.d/98dracut-systemd/dracut-cmdline-ask.sh b/modules.d/98dracut-systemd/dracut-cmdline-ask.sh
Harald Hoyer b38677
index ab8933a..f410f46 100755
Harald Hoyer b38677
--- a/modules.d/98dracut-systemd/dracut-cmdline-ask.sh
Harald Hoyer b38677
+++ b/modules.d/98dracut-systemd/dracut-cmdline-ask.sh
Harald Hoyer b38677
@@ -1,5 +1,9 @@
Harald Hoyer b38677
 #!/bin/bash
Harald Hoyer b38677
 
Harald Hoyer b38677
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
Harald Hoyer b38677
+
Harald Hoyer b38677
+getarg "rd.cmdline=ask" || exit 0
Harald Hoyer b38677
+
Harald Hoyer b38677
 sleep 0.5
Harald Hoyer b38677
 echo
Harald Hoyer b38677
 sleep 0.5