From dbe4baf278183852fced3eb3b5e34dc94fb39281 Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Wed, 19 Oct 2016 01:01:53 +0200 Subject: Fix aglsetup always succeeded regardless of whether errors or not The aglsetup is always succeeded regardless of whether got errors while executing sub scripts or not. This is caused by following script. call_func 2>&1 | tee xxxx.log The result of this line always becomes 0 (succeeded) by result of command 'tee'. The '$PIPESTATUS[]' should be used for this case. Change-Id: I67bf0dbc86331ec7858bd8edb4739a5e7729275b Signed-off-by: Tadao Tanikawa --- scripts/.aglsetup_genconfig.bash | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/.aglsetup_genconfig.bash b/scripts/.aglsetup_genconfig.bash index 57a31e261..65f4c3645 100755 --- a/scripts/.aglsetup_genconfig.bash +++ b/scripts/.aglsetup_genconfig.bash @@ -373,17 +373,17 @@ EOF append_fragment $BUILDDIR/conf/setup.sh "" "echo '--- end of setup script'" infon " Executing setup script ... " - execute_setup $BUILDDIR/conf/setup.sh 2>&1 | tee $BUILDDIR/conf/setup.log \ - && { - info "OK" - [[ $VERBOSE == 1 ]] && dump_log $BUILDDIR/conf/setup.log - rm $BUILDDIR/conf/setup.sh - } \ - || { - info "FAIL: please check $BUILDDIR/conf/setup.log" - dump_log $BUILDDIR/conf/setup.log - return 1 - } + execute_setup $BUILDDIR/conf/setup.sh 2>&1 | tee $BUILDDIR/conf/setup.log + [[ ${PIPESTATUS[0]} == 0 ]] && { + info "OK" + [[ $VERBOSE == 1 ]] && dump_log $BUILDDIR/conf/setup.log + rm $BUILDDIR/conf/setup.sh + } \ + || { + info "FAIL: please check $BUILDDIR/conf/setup.log" + dump_log $BUILDDIR/conf/setup.log + return 1 + } # NOTE: the setup.sh script is removed if execution succeeded (only the log remains) } -- cgit 1.2.3-korg