fix compile

This commit is contained in:
David Young
2026-03-17 15:30:03 -06:00
parent 3b6d69887e
commit 757859be11

View File

@@ -117,10 +117,18 @@ fetch_source() {
echo " Extracting $filename..."
case "$filename" in
*.zip)
unzip -q "$filepath" -d "$TMP_DIR"
local extracted
extracted=$(unzip -qql "$filepath" | head -n1 | awk '{print $NF}' | cut -d/ -f1)
mv "$TMP_DIR/$extracted" "$src_dir"
unzip -q "$filepath" -d "$src_dir"
# If the zip extracted into a single subdirectory, flatten it
local contents
contents=$(ls -1 "$src_dir")
local count
count=$(echo "$contents" | wc -l)
if [ "$count" -eq 1 ] && [ -d "$src_dir/$contents" ]; then
echo " Descending into $contents..."
local inner="$src_dir/$contents"
mv "$inner"/* "$src_dir/"
rmdir "$inner"
fi
;;
*.tar.gz|*.tgz)
tar -xzf "$filepath" -C "$src_dir" --strip-components=1