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

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