Blame 0074-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch

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