Commit 52ce7f86 authored by udeved's avatar udeved
Browse files

buildiso: finalize error handling

parent 98b11ef5
......@@ -169,6 +169,12 @@ done
shift $(($OPTIND - 1))
for sig in TERM HUP QUIT; do
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
done
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
timer_start=$(get_timer)
check_root "$0" "${orig_argv[@]}"
......
......@@ -46,7 +46,7 @@ run_safe() {
set -e
set -E
restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR SIGINT SIGTERM
trap 'error_function $func' ERR
if ${verbose};then
run_log "$func"
......@@ -59,6 +59,14 @@ run_safe() {
set +e
}
trap_exit() {
local sig=$1; shift
error "$@"
umount_image
trap -- "$sig"
kill "-$sig" "$$"
}
# $1: image path
make_sqfs() {
if [[ ! -d "$1" ]]; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment