From eeddae981c4447e8101ccd2b1c3b1cd8d69570c2 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Thu, 16 Jun 2022 16:18:58 -0400 Subject: [PATCH] pkgmeek: added interrupt() to handle SIGTERM and SIGHUP --- scripts/pkgmeek | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/pkgmeek b/scripts/pkgmeek index e073b85..de2156e 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -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 "$@"