dracut/0015-dracut-functions.sh-check-if-dinfo-is-a-function.patch
Harald Hoyer eeb1c23670 dracut-040-29.git20141204
- git snapshot
2014-12-04 12:31:45 +01:00

45 lines
1.2 KiB
Diff

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