kiss: Fix bug with strict cache removal

Turns out nested package manager processes would wipe the cache
earlier than expected when installing packages.

As all these nested processes are involved in is installation,
this changes pkg_clean to have them only wipe tar_dir (the only
directory they use).
This commit is contained in:
Dylan Araps 2021-07-16 10:20:20 +03:00
parent 268504bec8
commit 6555df6209
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 14 additions and 3 deletions

17
kiss
View File

@ -1675,9 +1675,20 @@ pkg_update() {
pkg_clean() {
# Clean up on exit or error. This removes everything related to the build.
# This only runs inside the top-level KISS process.
case ${KISS_DEBUG:-0}-${KISS_LVL:-0} in 0-0)
rm -rf "$tmp_dir"
case ${KISS_DEBUG:-0}-${KISS_LVL:-0} in
0-0)
# If we are exiting the top-level package manager process, wipe
# the entire temporary directory.
rm -rf "$tmp_dir"
;;
0-*)
# If we are exiting a nested package manager process, wipe only
# the tar temporary directory. Files in this directory may not
# be owned by user of the top-level process and therefore cannot
# be removed.
rm -rf "$tar_dir"
;;
esac
}