Skip to content

Commit 1765847

Browse files
committed
fix: handle archive directory structure in install script
The tar.gz and zip archives contain a parent directory with the binary inside. Updated extraction logic to: - Use --strip-components=1 for tar.gz to extract without parent dir - Move contents up one level for zip files to handle nested structure Tested full installation process and verified binary works correctly.
1 parent 2036ee1 commit 1765847

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,17 @@ install() {
138138
# extract the archive
139139
case "${ARCHIVE_FILE}" in
140140
*.tar.gz)
141-
tar -xzf "${tmp_dir}/${ARCHIVE_FILE}" -C "${tmp_dir}"
141+
tar -xzf "${tmp_dir}/${ARCHIVE_FILE}" -C "${tmp_dir}" --strip-components=1
142142
;;
143143
*.zip)
144144
if has unzip; then
145145
unzip -q "${tmp_dir}/${ARCHIVE_FILE}" -d "${tmp_dir}"
146+
# Find the extracted directory and move contents up
147+
extracted_dir=$(find "${tmp_dir}" -mindepth 1 -maxdepth 1 -type d | head -1)
148+
if [ -n "${extracted_dir}" ]; then
149+
mv "${extracted_dir}"/* "${tmp_dir}/"
150+
rm -rf "${extracted_dir}"
151+
fi
146152
else
147153
error "unzip is required to extract the archive but was not found"
148154
exit 1

0 commit comments

Comments
 (0)