diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-22 16:40:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-22 16:41:26 +0300 |
commit | a90c2834a1f35d97d3a5a96af5486d84aaa8e1ce (patch) | |
tree | 0d9197dd08c8b79482b759e756aaaf8ae50e64c9 /build_files/build_environment | |
parent | fbe25aeed4411e1b7f501f25a7b23c4c0967c6e9 (diff) |
install_deps.sh: add debugging options
Add USE_DEBUG_TRAP, USE_DEBUG_LOG for trapping errors and logging
executed lines respectively.
Handy for troubleshooting issues in the script.
Diffstat (limited to 'build_files/build_environment')
-rwxr-xr-x | build_files/build_environment/install_deps.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index c71b5f1c436..c783c7f2b85 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -19,6 +19,29 @@ # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions. +##### Debugging Helpers ##### +# +# Use for developing this script (keep first). + +# Useful for debugging this script: +USE_DEBUG_TRAP=${USE_DEBUG_TRAP:-0} +USE_DEBUG_LOG=${USE_DEBUG_LOG:-0} + +# Print the line that exits. +if [ $USE_DEBUG_TRAP -ne 0 ]; then + err_report() { + echo "Error on line $1" + exit 1 + } + trap 'err_report $LINENO' ERR +fi + +# Noisy, show every line that runs with it's line number. +if [ $USE_DEBUG_LOG -ne 0 ]; then + PS4='\e[0;33m$(printf %4d ${LINENO}):\e\033[0m ' + set -x +fi + ##### Args and Help Handling ##### # Parse command line! |