Skip to content

Commit c2a7e99

Browse files
authored
tools.func: better handling when unpacking tarfiles in prebuild mode (#5781)
1 parent 3847442 commit c2a7e99

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

misc/tools.func

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,11 @@ function fetch_and_deploy_gh_release() {
957957
fi
958958
$STD unzip "$tmpdir/$filename" -d "$target"
959959
elif [[ "$filename" == *.tar.* ]]; then
960-
tar --strip-components=1 -xf "$tmpdir/$filename" -C "$target"
960+
if tar -tf "$tmpdir/$filename" | grep -qE '^([^/]+/){2}'; then
961+
tar --strip-components=1 -xf "$tmpdir/$filename" -C "$target"
962+
else
963+
tar -xf "$tmpdir/$filename" -C "$target"
964+
fi
961965
else
962966
msg_error "Unsupported archive format: $filename"
963967
rm -rf "$tmpdir"

0 commit comments

Comments
 (0)