pkgmeek: added interrupt() to handle SIGTERM and SIGHUP

This commit is contained in:
John McQuah 2022-06-16 16:18:58 -04:00
parent 71ad099fef
commit eeddae981c
1 changed files with 5 additions and 0 deletions

View File

@ -548,6 +548,10 @@ refresh_signature() {
fi
}
interrupted() {
error "Interrupted."; cleanup_work; exit 1
}
cleanup_work() {
[ "$PKGMK_KEEP_WORK" = "yes" ] || { cd "$PKGMK_ROOT"; rm -rf "$work"; }
}
@ -585,5 +589,6 @@ readonly -f main info warning error print_help parse_options validate_pkgfile \
check_reqvars check_pkg_mtime fetch_url cat_manifest check_manifest \
cat_signature check_signature parse_signify_output refresh_signature \
cleanup_work recursive
trap "interrupted" SIGHUP SIGINT SIGQUIT SIGTERM
main "$@"