Blame SOURCES/0422-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch

a0a3b4
From 9aa224cc19989807b6e34b72af01e0a12072940c Mon Sep 17 00:00:00 2001
a0a3b4
From: Alexander Kurtz <alexander@kurtz.be>
a0a3b4
Date: Fri, 6 May 2016 17:25:37 +0200
a0a3b4
Subject: [PATCH] dracut-systemd/dracut-cmdline.sh: Don't error out if there is
a0a3b4
 no root= argument.
a0a3b4
a0a3b4
Thanks to systemd's gpt-auto-generator [0] (which implements the Discoverable
a0a3b4
Partitions Specification [1]), it is no longer necessary to always specify the
a0a3b4
root= argument.
a0a3b4
a0a3b4
However, dracut would still refuse to boot if there was no root= argument (or
a0a3b4
if it was set to the special value "gpt-auto" [2]). This commit stops dracut
a0a3b4
from aborting the boot process in these cases and simply lets systemd do its
a0a3b4
magic.
a0a3b4
a0a3b4
[0] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator
a0a3b4
[1] https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
a0a3b4
[2] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator/gpt-auto-generator.c#L928
a0a3b4
a0a3b4
(cherry picked from commit 016613c774baf3d30c6425a65ead05d8b55d6279)
a0a3b4
---
a0a3b4
 modules.d/98systemd/dracut-cmdline.sh | 12 ++++++++++--
a0a3b4
 1 file changed, 10 insertions(+), 2 deletions(-)
a0a3b4
a0a3b4
diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
a0a3b4
index 9d15663..d22e4d6 100755
a0a3b4
--- a/modules.d/98systemd/dracut-cmdline.sh
a0a3b4
+++ b/modules.d/98systemd/dracut-cmdline.sh
a0a3b4
@@ -22,7 +22,12 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug &&
a0a3b4
 
a0a3b4
 source_conf /etc/conf.d
a0a3b4
 
a0a3b4
-root=$(getarg root=)
a0a3b4
+# Get the "root=" parameter from the kernel command line, but differentiate
a0a3b4
+# between the case where it was set to the empty string and the case where it
a0a3b4
+# wasn't specified at all.
a0a3b4
+if ! root="$(getarg root=)"; then
a0a3b4
+    root='UNSET'
a0a3b4
+fi
a0a3b4
 
a0a3b4
 rflags="$(getarg rootflags=)"
a0a3b4
 getargbool 0 ro && rflags="${rflags},ro"
a0a3b4
@@ -66,9 +71,12 @@ case "$root" in
a0a3b4
     /dev/*)
a0a3b4
         root="block:${root}"
a0a3b4
         rootok=1 ;;
a0a3b4
+    UNSET|gpt-auto)
a0a3b4
+        # systemd's gpt-auto-generator handles this case.
a0a3b4
+        rootok=1 ;;
a0a3b4
 esac
a0a3b4
 
a0a3b4
-[ -z "$root" ] && die "No or empty root= argument"
a0a3b4
+[ -z "$root" ] && die "Empty root= argument"
a0a3b4
 [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
a0a3b4
 
a0a3b4
 export root rflags fstype netroot NEWROOT