From: John Reiser <jreiser-Po6cBsTGB2ZWk0Htik3J/w@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 6/8] instmods: factor out egrep of "FATAL: Module .* not found"
Date: Tue, 30 Aug 2011 21:40:38 -0700 [thread overview]
Message-ID: <4E5DBB46.3060001@bitwagon.com> (raw)
---
dracut-functions | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index dc71f51..6278eb4 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -820,7 +820,7 @@ install_kmod_with_fw() {
for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
shift 2
- modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
+ modprobe "$@" --ignore-install --show-depends $_kmod 2>&$modprobe_stderr | (
while read _cmd _modpath _options; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
@@ -829,9 +829,6 @@ for_each_kmod_dep() {
[[ $_found -eq 0 ]] && exit 1
exit 0
)
- egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
- rm -f "$initdir/modprobe.err"
- return $?
}
# filter kernel modules to install certain modules that meet specific
@@ -934,16 +931,23 @@ instmods() {
esac
}
- local _mpargs _ret=0
- if (($# == 0)); then # filenames from stdin
- local _mod
- while read _mod; do
- inst1mod "${_mod%.ko*}"
+ function instmods_1() {
+ local _ret=0 _mod _mpargs
+ if (($# == 0)); then # filenames from stdin
+ while read _mod; do
+ inst1mod "${_mod%.ko*}"
+ done
+ fi
+ while (($# > 0)); do # filenames as arguments
+ inst1mod ${1%.ko*}
+ shift
done
- fi
- while (($# > 0)); do # filenames as args
- inst1mod ${1%.ko*}
- shift
- done
- return $_ret
+ return $_ret
+ }
+
+ # Capture all stderr from modprobe onto a new fd $modprobe_stderr,
+ # and pipe it into egrep. See REDIRECTION in bash manpage.
+ ( instmods_1 "$@" ) {modprobe_stderr}>&1 \
+ | egrep -v 'FATAL: Module .* not found.' | derror
+ return $?
}
--
1.7.6
--
reply other threads:[~2011-08-31 4:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E5DBB46.3060001@bitwagon.com \
--to=jreiser-po6cbstgb2zwk0htik3j/w@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.