ec/google/chromeec: Optimize battery string readout with caching
[coreboot.git] / util / scripts / capture_commands.sh
blob9e2e08f96be77a31594b5911972140688ac81ba6
1 #!/usr/bin/env sh
2 ## SPDX-License-Identifier: BSD-3-Clause
4 # This script allows us to capture all the commands run in the shell by the
5 # coreboot build. This is better than using 'make v=1' because it captures
6 # commands right from the beginning of the build, and sends the output of any
7 # command to the interactive shell.
9 # To use, run:
10 # make SHELL="${PWD}/util/scripts/capture_commands.sh"
12 REALSHELL=${REALSHELL:-sh}
13 OUTPUT_DIR=${TOP:-/tmp}
14 CAPTURE_FILE=${CAPTURE_FILE:-commands.txt}
16 env echo "$*" | sed 's/^-c '// >> "${OUTPUT_DIR}/${CAPTURE_FILE}"
17 "${REALSHELL}" "$@"