forked from mirrored-repos/manjaro-tools
buildiso: finalize error handling
This commit is contained in:
parent
98b11ef576
commit
52ce7f86be
2 changed files with 15 additions and 1 deletions
|
@ -169,6 +169,12 @@ done
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
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)
|
timer_start=$(get_timer)
|
||||||
|
|
||||||
check_root "$0" "${orig_argv[@]}"
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
|
@ -46,7 +46,7 @@ run_safe() {
|
||||||
set -e
|
set -e
|
||||||
set -E
|
set -E
|
||||||
restoretrap=$(trap -p ERR)
|
restoretrap=$(trap -p ERR)
|
||||||
trap 'error_function $func' ERR SIGINT SIGTERM
|
trap 'error_function $func' ERR
|
||||||
|
|
||||||
if ${verbose};then
|
if ${verbose};then
|
||||||
run_log "$func"
|
run_log "$func"
|
||||||
|
@ -59,6 +59,14 @@ run_safe() {
|
||||||
set +e
|
set +e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trap_exit() {
|
||||||
|
local sig=$1; shift
|
||||||
|
error "$@"
|
||||||
|
umount_image
|
||||||
|
trap -- "$sig"
|
||||||
|
kill "-$sig" "$$"
|
||||||
|
}
|
||||||
|
|
||||||
# $1: image path
|
# $1: image path
|
||||||
make_sqfs() {
|
make_sqfs() {
|
||||||
if [[ ! -d "$1" ]]; then
|
if [[ ! -d "$1" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue