Update install.func
This commit is contained in:
parent
27c57b5295
commit
0ab98a769b
@ -288,6 +288,7 @@ fetch_and_deploy_gh_release() {
|
||||
|
||||
# ensure that jq is installed
|
||||
if ! command -v jq &>/dev/null; then
|
||||
$STD msg_info "Installing jq..."
|
||||
apt-get update -qq &>/dev/null
|
||||
apt-get install -y jq &>/dev/null || {
|
||||
msg_error "Failed to install jq"
|
||||
@ -350,34 +351,40 @@ fetch_and_deploy_gh_release() {
|
||||
local tmpdir
|
||||
tmpdir=$(mktemp -d) || return 1
|
||||
|
||||
# determine platform for OS/Arch or use tarball
|
||||
local os="Linux"
|
||||
local arch="$(uname -m)"
|
||||
case "$arch" in
|
||||
x86_64 | amd64) arch="x86_64" ;;
|
||||
aarch64 | arm64) arch="arm64" ;;
|
||||
armv7l) arch="armv7" ;;
|
||||
armv6l) arch="armv6" ;;
|
||||
*)
|
||||
msg_error "Unsupported architecture: $arch"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
# Liste der Assets aus der Release-API extrahieren
|
||||
local assets urls
|
||||
assets=$(echo "$api_response" | jq -r '.assets[].browser_download_url') || true
|
||||
|
||||
local filename="${app}_v${version}_${os}_${arch}.tar.gz"
|
||||
local url="$base_url/$filename"
|
||||
local url=""
|
||||
for u in $assets; do
|
||||
if [[ "$u" =~ (x86_64|amd64|arm64|armv7|armv6).*\.tar\.gz$ ]]; then
|
||||
url="$u"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
$STD msg_info "Trying download: $url"
|
||||
if [[ -z "$url" ]]; then
|
||||
for u in $assets; do
|
||||
if [[ "$u" =~ \.tar\.gz$ ]]; then
|
||||
url="$u"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if ! curl -fsSL -o "$tmpdir/$filename" "$url"; then
|
||||
$STD msg_info "Falling back to generic tarball..."
|
||||
filename="${app}.tar.gz"
|
||||
url="$base_url/$filename"
|
||||
if ! curl -fsSL -o "$tmpdir/$filename" "$url"; then
|
||||
msg_error "Failed to download .tar.gz from both $url and platform-specific fallback."
|
||||
if [[ -z "$url" ]]; then
|
||||
msg_error "No suitable .tar.gz release asset found for $repo"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local filename="${url##*/}"
|
||||
$STD msg_info "Downloading $url"
|
||||
|
||||
if ! curl -fsSL -o "$tmpdir/$filename" "$url"; then
|
||||
msg_error "Failed to download $filename from $url"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "/opt/$app"
|
||||
|
Loading…
x
Reference in New Issue
Block a user