From d3b988300a97e6e32e1c059b09b63957e1198d18 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 26 Mar 2020 11:30:30 +0200 Subject: [PATCH] kiss: Clean up leftover cache entries --- kiss | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/kiss b/kiss index cff39f1..c867cd0 100755 --- a/kiss +++ b/kiss @@ -1138,11 +1138,17 @@ pkg_clean() { # to the build. [ "$KISS_DEBUG" != 1 ] || return - # Block 'Ctrl+C' while cache is being cleaned. - trap '' INT + # Create a list containing the current invocation's temporary + # files and directories. + set +f -- "$mak_dir" "$pkg_dir" "$tar_dir" "$cac_dir/$pid-m" - # Remove temporary items. - rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" "$cac_dir/$pid-m" + # Go through the cache and add any entries which don't belong + # to a currently running kiss instance. + for dir in "$cac_dir/"[bep]*-[0-9]*; do + [ -e "/proc/${dir##*-}" ] || set -- "$@" "$dir" + done + + rm -rf -- "$@" } args() { @@ -1240,7 +1246,7 @@ args() { r|remove) pkg_order "$@" - for pkg in $redro; do + for pkg in $redro; do pkg_remove "$pkg" "${KISS_FORCE:-check}" done ;;