kiss: simplify tar contains

This commit is contained in:
Dylan Araps 2021-07-17 15:21:46 +03:00
parent a73f120c9d
commit 07c62219a1
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

7
kiss
View File

@ -386,9 +386,8 @@ pkg_extract_tar_hack() {
# Iterate over all directories in the first level of the
# tarball's manifest. Each directory is moved up a level.
while IFS=/ read -r dir _; do case ${dir#.} in *?*)
# Skip duplicate directories.
! contains "$_seen" "$dir" || continue && _seen="$_seen $dir"
while IFS=/ read -r dir _; do contains "$_seen" "${dir#.}" || {
_seen="$_seen $dir"
# Move the parent directory to prevent naming conflicts
# with the to-be-moved children.
@ -410,7 +409,7 @@ pkg_extract_tar_hack() {
# transferred out of it. This can't be a simple 'rmdir'
# as we may leave files in here if any were copied.
rm -rf "$KISS_PID-$dir"
esac done < "$_tmp_file"
} done < "$_tmp_file"
# Remove the tarball now that we are done with it.
rm -f "$_tmp_file_pre"