common.sh: set -E flag in switch_to_strict_mode

switch_to_strict_mode enables the -e flag to cause the program exits
immediately without additional information once an error occurs.
The trap 'die_err_trap' ERR is added to provide backtrace and debug
information when error happens.
However, the ERR trap is not inherited and local to the current scope by
default, which makes this line totally useless.

Set -E flag in switch_to_strict_mode function to let the ERR trap
inherited by the functions and make it work as expected.
Also, ignore the error in die_err_trap if errexit option is not set, to
prevent from unexpected dying when errors happening in 'set +e' / 'set -e'
surrounded snippets.

BUG=b:388682790
TEST=./update_kernel.sh $DUT
TEST=CQ

Change-Id: I31d1cd760758f1ff28942567b5b6d43a4f7525d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/6270276
Tested-by: Yu-Che Cheng <[email protected]>
Commit-Queue: Yu-Che Cheng <[email protected]>
Reviewed-by: Raul Rangel <[email protected]>
Reviewed-by: Fei Shao <[email protected]>
1 file changed
tree: 2304fa81ebf3a404309be4b408576d8eb90379a0
  1. bin/
  2. build_library/
  3. hooks/
  4. lib/
  5. mod_for_test_scripts/
  6. .gitignore
  7. build_kernel_image.sh
  8. common.sh
  9. cros_show_stacks
  10. DIR_METADATA
  11. image_to_vm.sh
  12. make_netboot.sh
  13. mod_image_for_recovery.sh
  14. mount_gpt_image.sh
  15. OWNERS
  16. PRESUBMIT.cfg
  17. README.md
  18. update_bootloaders.sh
  19. update_kernel.sh
README.md

src/scripts directory

This repository contains build tools and scripts written in shell (e.g., Bash). Historically, much of our build process was written in shell in this directory, however, we're currently in the process of migrating many scripts to Python in Chromite.

In general, we're not currently accepting new scripts in this directory.

If you want to host a script for yourself/local team, feel free to use the src/platform/dev/contrib/ directory instead.