mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-28 11:50:06 +00:00
Update fetch_and_deply_from_url (#11410)
This commit is contained in:
parent
54b9d8d3e8
commit
7e4e0b8941
1 changed files with 22 additions and 8 deletions
|
|
@ -6272,13 +6272,6 @@ function fetch_and_deploy_from_url() {
|
|||
|
||||
local filename="${url##*/}"
|
||||
|
||||
local archive_type="zip"
|
||||
if [[ "$filename" == *.tar.gz || "$filename" == *.tgz ]]; then
|
||||
archive_type="tar"
|
||||
elif [[ "$filename" == *.deb ]]; then
|
||||
archive_type="deb"
|
||||
fi
|
||||
|
||||
msg_info "Downloading from $url"
|
||||
|
||||
local tmpdir
|
||||
|
|
@ -6293,6 +6286,28 @@ function fetch_and_deploy_from_url() {
|
|||
return 1
|
||||
}
|
||||
|
||||
# Auto-detect archive type using file description
|
||||
local file_desc
|
||||
file_desc=$(file -b "$tmpdir/$filename")
|
||||
|
||||
local archive_type="unknown"
|
||||
|
||||
if [[ "$file_desc" =~ gzip.*compressed|gzip\ compressed\ data ]]; then
|
||||
archive_type="tar"
|
||||
elif [[ "$file_desc" =~ Zip.*archive|ZIP\ archive ]]; then
|
||||
archive_type="zip"
|
||||
elif [[ "$file_desc" =~ Debian.*package|Debian\ binary\ package ]]; then
|
||||
archive_type="deb"
|
||||
elif [[ "$file_desc" =~ POSIX.*tar.*archive|tar\ archive ]]; then
|
||||
archive_type="tar"
|
||||
else
|
||||
msg_error "Unsupported or unknown archive type: $file_desc"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
msg_info "Detected archive type: $archive_type (file type: $file_desc)"
|
||||
|
||||
if [[ "$archive_type" == "deb" ]]; then
|
||||
msg_info "Installing .deb package"
|
||||
|
||||
|
|
@ -6380,4 +6395,3 @@ function fetch_and_deploy_from_url() {
|
|||
msg_ok "Successfully deployed archive to $directory"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue