Blame SOURCES/0273-dracut-functions.sh-check-if-dinfo-is-a-function.patch

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