1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2025-01-21 18:04:40 -07:00

kiss: only move up directories if there is just one top level dir

This commit is contained in:
phoebos 2022-11-30 11:10:28 +00:00
parent d240830906
commit 02c254e388
No known key found for this signature in database

6
kiss
View File

@ -535,6 +535,11 @@ pkg_source_tar() {
tar tf "$_tmp_file_pre" | sort -ut / -k1,1 > "$_tmp_file" ||
die "$repo_name" "Failed to extract manifest"
# Only move directories up a level if there is one top-level directory
# in the tarball. The tarball could contain all the files without a top
# directory, so in those more complicated cases, just give the build file
# the original tar structure.
case "$(wc -l <"$_tmp_file")" in 1)
# 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 *?*)
@ -562,6 +567,7 @@ pkg_source_tar() {
# as we may leave files in here if any were copied.
rm -rf "$KISS_PID-$dir"
esac done < "$_tmp_file"
esac
# Remove the tarball now that we are done with it.
rm -f "$_tmp_file_pre"