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