diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-07-04 15:02:51 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-07-04 15:02:51 +0000 |
commit | ba30f01e76c591061d2050147f8478236e851bfa (patch) | |
tree | 9eb809fd5eea572666961999be1693e41c3947f4 | |
parent | 72758883b8a5c46565f33cdb3e1a1cee15d2b47f (diff) | |
download | cpt-ba30f01e76c591061d2050147f8478236e851bfa.tar.gz |
kiss: Block Ctrl+C during package install.
FossilOrigin-Name: b6e79a30499d4d325bdbca89cf467eec3893302e92dd168d9cab07bf65fc1292
-rwxr-xr-x | kiss | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -665,6 +665,11 @@ pkg_install() { cp "$(command -v mkdir)" "$cac_dir" cp "$(command -v find)" "$cac_dir" + # Block being able to abort the script with 'Ctrl+C' during installation. + # Removes all risk of the user aborting a package installation leaving + # an incomplete package installed. + trap '' INT + log "[$pkg_name]: Removing previous version of package if it exists." pkg_remove "$pkg_name" log "[$pkg_name]: Installing package..." @@ -689,9 +694,13 @@ pkg_install() { [ -f "$KISS_ROOT/${rpath%/*}/${file##*/}" ] && return - "$cac_dir/mv" "$file" "$KISS_ROOT/${rpath%/*}" + "$cac_dir/mv" "$file" "$KISS_ROOT/${rpath%/*}" ||: done + # Reset 'trap' to its original value. Installation is done so + # we no longer need to block 'Ctrl+C'. + trap pkg_clean EXIT INT + # Run the post install script and suppress errors. If it exists, # it will run, else nothing will happen. "$KISS_ROOT/var/db/kiss/$pkg_name/post-install" 2>/dev/null ||: |