|
Harald Hoyer |
55891e |
From f9708da22345aa11bfa0d5514eefef11f542526b Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
55891e |
From: John Reiser <jreiser@BitWagon.com>
|
|
Harald Hoyer |
55891e |
Date: Mon, 29 Aug 2011 16:03:35 -0700
|
|
Harald Hoyer |
55891e |
Subject: [PATCH] instmods: factor out egrep of "FATAL: Module .* not found"
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
---
|
|
Harald Hoyer |
55891e |
dracut-functions | 34 +++++++++++++++++++---------------
|
|
Harald Hoyer |
55891e |
1 files changed, 19 insertions(+), 15 deletions(-)
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
diff --git a/dracut-functions b/dracut-functions
|
|
Harald Hoyer |
55891e |
index 6c16cae..507f0c3 100755
|
|
Harald Hoyer |
55891e |
--- a/dracut-functions
|
|
Harald Hoyer |
55891e |
+++ b/dracut-functions
|
|
Harald Hoyer |
55891e |
@@ -820,7 +820,7 @@ install_kmod_with_fw() {
|
|
Harald Hoyer |
55891e |
for_each_kmod_dep() {
|
|
Harald Hoyer |
55891e |
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
|
|
Harald Hoyer |
55891e |
shift 2
|
|
Harald Hoyer |
55891e |
- modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
|
|
Harald Hoyer |
55891e |
+ modprobe "$@" --ignore-install --show-depends $_kmod 2>&$modprobe_stderr | (
|
|
Harald Hoyer |
55891e |
while read _cmd _modpath _options; do
|
|
Harald Hoyer |
55891e |
[[ $_cmd = insmod ]] || continue
|
|
Harald Hoyer |
55891e |
$_func ${_modpath} || exit $?
|
|
Harald Hoyer |
55891e |
@@ -829,9 +829,6 @@ for_each_kmod_dep() {
|
|
Harald Hoyer |
55891e |
[[ $_found -eq 0 ]] && exit 1
|
|
Harald Hoyer |
55891e |
exit 0
|
|
Harald Hoyer |
55891e |
)
|
|
Harald Hoyer |
55891e |
- egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
|
|
Harald Hoyer |
55891e |
- rm -f "$initdir/modprobe.err"
|
|
Harald Hoyer |
55891e |
- return $?
|
|
Harald Hoyer |
55891e |
}
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
# filter kernel modules to install certain modules that meet specific
|
|
Harald Hoyer |
55891e |
@@ -934,16 +931,23 @@ instmods() {
|
|
Harald Hoyer |
55891e |
esac
|
|
Harald Hoyer |
55891e |
}
|
|
Harald Hoyer |
55891e |
|
|
Harald Hoyer |
55891e |
- local _mpargs _ret=0
|
|
Harald Hoyer |
55891e |
- if (($# == 0)); then # filenames from stdin
|
|
Harald Hoyer |
55891e |
- local _mod
|
|
Harald Hoyer |
55891e |
- while read _mod; do
|
|
Harald Hoyer |
55891e |
- inst1mod "${_mod%.ko*}"
|
|
Harald Hoyer |
55891e |
+ function instmods_1() {
|
|
Harald Hoyer |
55891e |
+ local _ret=0 _mod _mpargs
|
|
Harald Hoyer |
55891e |
+ if (($# == 0)); then # filenames from stdin
|
|
Harald Hoyer |
55891e |
+ while read _mod; do
|
|
Harald Hoyer |
55891e |
+ inst1mod "${_mod%.ko*}"
|
|
Harald Hoyer |
55891e |
+ done
|
|
Harald Hoyer |
55891e |
+ fi
|
|
Harald Hoyer |
55891e |
+ while (($# > 0)); do # filenames as arguments
|
|
Harald Hoyer |
55891e |
+ inst1mod ${1%.ko*}
|
|
Harald Hoyer |
55891e |
+ shift
|
|
Harald Hoyer |
55891e |
done
|
|
Harald Hoyer |
55891e |
- fi
|
|
Harald Hoyer |
55891e |
- while (($# > 0)); do # filenames as args
|
|
Harald Hoyer |
55891e |
- inst1mod ${1%.ko*}
|
|
Harald Hoyer |
55891e |
- shift
|
|
Harald Hoyer |
55891e |
- done
|
|
Harald Hoyer |
55891e |
- return $_ret
|
|
Harald Hoyer |
55891e |
+ return $_ret
|
|
Harald Hoyer |
55891e |
+ }
|
|
Harald Hoyer |
55891e |
+
|
|
Harald Hoyer |
55891e |
+ # Capture all stderr from modprobe onto a new fd $modprobe_stderr,
|
|
Harald Hoyer |
55891e |
+ # and pipe it into egrep. See REDIRECTION in bash manpage.
|
|
Harald Hoyer |
55891e |
+ ( instmods_1 "$@" ) {modprobe_stderr}>&1 \
|
|
Harald Hoyer |
55891e |
+ | egrep -v 'FATAL: Module .* not found.' | derror
|
|
Harald Hoyer |
55891e |
+ return $?
|
|
Harald Hoyer |
55891e |
}
|