mod_image_for_recovery.sh: don't silence stderr in non-verbose modes

The current code will silence stderr when operating in non-verbose mode
because it always turns on shell tracing with `set -x`.  Unfortunately,
this also ends up killing error messages from a bunch of places in the
script as well:
 - look for all the "1>&2" uses in mod_image_for_recovery.sh
 - look at missing error() override
 - look at duplication of die() just to undo things

A really simple example:
$ ./mod_image_for_recovery.sh
$
Did it work?  Or did I do something wrong?  Who knows!

So undo the stderr silencing and simply turn on `set -x` only when
requested (verbose mode).

BUG=None
TEST=forced some errors in non-verbose mode and saw no output before change, but saw it after change; made a working recovery image

Change-Id: I31578fba091e390a56a437af97782a621e2137fb
Reviewed-on: http://gerrit.chromium.org/gerrit/6904
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2011-08-30 13:23:38 -04:00
parent 4d290ef5a4
commit 2fe928ec7a

View File

@ -59,16 +59,10 @@ eval set -- "${FLAGS_ARGV}"
# so will die prematurely if 'set -e' is specified before now.
set -e
if [ $FLAGS_verbose -eq $FLAGS_FALSE ]; then
exec 2>/dev/null
# Redirecting to stdout instead of stderr since
# we silence stderr above.
die() {
echo -e "${V_BOLD_RED}ERROR : $1${V_VIDOFF}"
exit 1
}
if [ $FLAGS_verbose -eq $FLAGS_TRUE ]; then
# Make debugging with -v easy.
set -x
fi
set -x # Make debugging with -v easy.
. "${SCRIPT_ROOT}/build_library/board_options.sh" || exit 1