Blame 0052-dracut-init.sh-beautify-instmods.patch

Harald Hoyer b38677
From 9bb030c5d8189f42eef3a0a881a361ce811414b0 Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer b38677
Date: Wed, 13 Apr 2016 13:57:03 +0200
Harald Hoyer b38677
Subject: [PATCH] dracut-init.sh: beautify instmods()
Harald Hoyer b38677
Harald Hoyer b38677
---
Harald Hoyer b38677
 dracut-init.sh | 31 ++++++++++++++++++++++++++++---
Harald Hoyer b38677
 1 file changed, 28 insertions(+), 3 deletions(-)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/dracut-init.sh b/dracut-init.sh
Harald Hoyer b38677
index e26d97a..8d1d9fa 100644
Harald Hoyer b38677
--- a/dracut-init.sh
Harald Hoyer b38677
+++ b/dracut-init.sh
Harald Hoyer b38677
@@ -1001,22 +1001,47 @@ instmods() {
Harald Hoyer b38677
     local _optional="-o"
Harald Hoyer b38677
     local _silent
Harald Hoyer b38677
     local _ret
Harald Hoyer b38677
+
Harald Hoyer b38677
     [[ $no_kernel = yes ]] && return
Harald Hoyer b38677
+
Harald Hoyer b38677
     if [[ $1 = '-c' ]]; then
Harald Hoyer b38677
-        _optional=""
Harald Hoyer b38677
+        unset _optional
Harald Hoyer b38677
         shift
Harald Hoyer b38677
     fi
Harald Hoyer b38677
     if [[ $1 = '-s' ]]; then
Harald Hoyer b38677
         _silent=1
Harald Hoyer b38677
         shift
Harald Hoyer b38677
     fi
Harald Hoyer b38677
+
Harald Hoyer b38677
     if (($# == 0)); then
Harald Hoyer b38677
         read -r -d '' -a args
Harald Hoyer b38677
         set -- "${args[@]}"
Harald Hoyer b38677
     fi
Harald Hoyer b38677
-    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"}  ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
Harald Hoyer b38677
+
Harald Hoyer b38677
+    $DRACUT_INSTALL \
Harald Hoyer b38677
+        ${initdir:+-D "$initdir"} \
Harald Hoyer b38677
+        ${loginstall:+-L "$loginstall"} \
Harald Hoyer b38677
+        ${hostonly:+-H} \
Harald Hoyer b38677
+        ${omit_drivers:+-N "$omit_drivers"} \
Harald Hoyer b38677
+        ${srcmods:+--kerneldir "$srcmods"} \
Harald Hoyer b38677
+        ${_optional:+-o} \
Harald Hoyer b38677
+        ${_silent:+--silent} \
Harald Hoyer b38677
+        -m "$@"
Harald Hoyer b38677
     _ret=$?
Harald Hoyer b38677
-    (($_ret != 0)) && [[ -z "$_silent" ]] && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
Harald Hoyer b38677
+
Harald Hoyer b38677
+    if (($_ret != 0)) && [[ -z "$_silent" ]]; then
Harald Hoyer b38677
+        derror "FAILED: " \
Harald Hoyer b38677
+            $DRACUT_INSTALL \
Harald Hoyer b38677
+                ${initdir:+-D "$initdir"} \
Harald Hoyer b38677
+                ${loginstall:+-L "$loginstall"} \
Harald Hoyer b38677
+                ${hostonly:+-H} \
Harald Hoyer b38677
+                ${omit_drivers:+-N "$omit_drivers"} \
Harald Hoyer b38677
+                ${srcmods:+--kerneldir "$srcmods"} \
Harald Hoyer b38677
+                ${_optional:+-o} \
Harald Hoyer b38677
+                ${_silent:+--silent} \
Harald Hoyer b38677
+                -m "$@"
Harald Hoyer b38677
+    fi
Harald Hoyer b38677
+
Harald Hoyer b38677
     [[ "$optional" ]] && return 0
Harald Hoyer b38677
     return $_ret
Harald Hoyer b38677
 }