mirror of
https://github.com/armbian/build.git
synced 2025-08-11 21:56:58 +02:00
35 lines
961 B
Bash
35 lines
961 B
Bash
# exit_with_error <message> <highlight>
|
|
#
|
|
# a way to terminate build process
|
|
# with verbose error message
|
|
#
|
|
|
|
exit_with_error() {
|
|
local _file
|
|
local _line=${BASH_LINENO[0]}
|
|
local _function=${FUNCNAME[1]}
|
|
local _description=$1
|
|
local _highlight=$2
|
|
_file=$(basename "${BASH_SOURCE[1]}")
|
|
local stacktrace="$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
|
|
|
|
display_alert "ERROR in function $_function" "$stacktrace" "err"
|
|
display_alert "$_description" "$_highlight" "err"
|
|
display_alert "Process terminated" "" "info"
|
|
|
|
if [[ "${ERROR_DEBUG_SHELL}" == "yes" ]]; then
|
|
display_alert "MOUNT" "${MOUNT}" "err"
|
|
display_alert "SDCARD" "${SDCARD}" "err"
|
|
display_alert "Here's a shell." "debug it" "err"
|
|
bash < /dev/tty || true
|
|
fi
|
|
|
|
# TODO: execute run_after_build here?
|
|
overlayfs_wrapper "cleanup"
|
|
# unlock loop device access in case of starvation
|
|
exec {FD}> /var/lock/armbian-debootstrap-losetup
|
|
flock -u "${FD}"
|
|
|
|
exit 255
|
|
}
|