Blame 0015-dracut-functions.sh-check-if-dinfo-is-a-function.patch

Harald Hoyer eeb1c2
From 26d14fb3d36d6091f64258a62c49939478405693 Mon Sep 17 00:00:00 2001
Harald Hoyer eeb1c2
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer eeb1c2
Date: Mon, 24 Nov 2014 15:17:45 +0100
Harald Hoyer eeb1c2
Subject: [PATCH] dracut-functions.sh: check if dinfo is a function
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
If "dinfo" is an executable, dracut-logger.sh would never be sourced.
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
See: https://bugzilla.redhat.com/show_bug.cgi?id=1167082
Harald Hoyer eeb1c2
---
Harald Hoyer eeb1c2
 dracut-functions.sh | 14 +++++++-------
Harald Hoyer eeb1c2
 1 file changed, 7 insertions(+), 7 deletions(-)
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer eeb1c2
index b43b766..17a71f0 100755
Harald Hoyer eeb1c2
--- a/dracut-functions.sh
Harald Hoyer eeb1c2
+++ b/dracut-functions.sh
Harald Hoyer eeb1c2
@@ -176,7 +176,13 @@ srcmods="/lib/modules/$kernel/"
Harald Hoyer eeb1c2
 }
Harald Hoyer eeb1c2
 export srcmods
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
-if ! type dinfo >/dev/null 2>&1; then
Harald Hoyer eeb1c2
+# is_func <command>
Harald Hoyer eeb1c2
+# Check whether $1 is a function.
Harald Hoyer eeb1c2
+is_func() {
Harald Hoyer eeb1c2
+    [[ "$(type -t "$1")" = "function" ]]
Harald Hoyer eeb1c2
+}
Harald Hoyer eeb1c2
+
Harald Hoyer eeb1c2
+if ! is_func dinfo >/dev/null 2>&1; then
Harald Hoyer eeb1c2
     . "$dracutbasedir/dracut-logger.sh"
Harald Hoyer eeb1c2
     dlog_init
Harald Hoyer eeb1c2
 fi
Harald Hoyer eeb1c2
@@ -209,12 +215,6 @@ mksubdirs() {
Harald Hoyer eeb1c2
     [[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
Harald Hoyer eeb1c2
 }
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
-# is_func <command>
Harald Hoyer eeb1c2
-# Check whether $1 is a function.
Harald Hoyer eeb1c2
-is_func() {
Harald Hoyer eeb1c2
-    [[ "$(type -t "$1")" = "function" ]]
Harald Hoyer eeb1c2
-}
Harald Hoyer eeb1c2
-
Harald Hoyer eeb1c2
 # Function prints global variables in format name=value line by line.
Harald Hoyer eeb1c2
 # $@ = list of global variables' name
Harald Hoyer eeb1c2
 print_vars() {