kiss: Use $pid instead of $$

This commit is contained in:
Dylan Araps 2020-06-10 09:45:46 +03:00
parent ad5532671e
commit 5acaff9bdc
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 4 additions and 4 deletions

8
kiss
View File

@ -293,7 +293,7 @@ pkg_extract() {
# Move the directory to prevent naming conflicts between # Move the directory to prevent naming conflicts between
# the child and parent # the child and parent
mv -f "$dir" "$$-$dir" mv -f "$dir" "$pid-$dir"
# First attempt to move all files up a directory level, # First attempt to move all files up a directory level,
# if any files/directories fail (due to mv's lack of # if any files/directories fail (due to mv's lack of
@ -307,17 +307,17 @@ pkg_extract() {
# Using only '$@' causes a single file from each # Using only '$@' causes a single file from each
# invocation to be left out of the list. Weird, right? # invocation to be left out of the list. Weird, right?
{ {
find "$$-$dir/." ! -name . -prune \ find "$pid-$dir/." ! -name . -prune \
-exec sh -c 'mv -f "$0" "$@" .' {} + || -exec sh -c 'mv -f "$0" "$@" .' {} + ||
find "$$-$dir/." ! -name . -prune \ find "$pid-$dir/." ! -name . -prune \
-exec sh -c 'cp -fRp "$0" "$@" .' {} + -exec sh -c 'cp -fRp "$0" "$@" .' {} +
} 2>/dev/null } 2>/dev/null
# Remove the directory now that all files have been # Remove the directory now that all files have been
# transferred out of it. This can't be a simple 'rmdir' # transferred out of it. This can't be a simple 'rmdir'
# as we may leave files in here due to above. # as we may leave files in here due to above.
rm -rf "$$-$dir" rm -rf "$pid-$dir"
done done
# Clean up after ourselves and remove the temporary tar # Clean up after ourselves and remove the temporary tar