This commit is contained in:
CanbiZ 2025-04-29 09:19:53 +02:00
parent 5adff26cc6
commit d51a6435ca
2 changed files with 35 additions and 1 deletions

View File

@ -15,7 +15,7 @@ update_os
msg_info "Installing Dependencies (Patience)" msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \ $STD apt-get install -y \
ffmpeg ffmpeg
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Navidrome" msg_info "Installing Navidrome"
@ -25,6 +25,11 @@ curl -fsSL -o "${TMP_DEB}" "https://github.com/navidrome/navidrome/releases/down
$STD apt-get install -y "${TMP_DEB}" $STD apt-get install -y "${TMP_DEB}"
systemctl enable -q --now navidrome systemctl enable -q --now navidrome
echo "${RELEASE}" >/opt/Navidrome_version.txt echo "${RELEASE}" >/opt/Navidrome_version.txt
echo "Test...."
TMP_TAR=$(mktemp --suffix=.tgz)
download_with_progress "https://github.com/ollama/ollama/releases/download/v0.6.6/ollama-linux-amd64.tgz" "$TMP_TAR"
echo "Test...."
msg_ok "Installed Navidrome" msg_ok "Installed Navidrome"
motd_ssh motd_ssh

View File

@ -756,3 +756,32 @@ import_local_ip() {
export LOCAL_IP export LOCAL_IP
} }
function download_with_progress() {
local url="$1"
local output="$2"
if ! command -v pv &>/dev/null; then
$STD apt-get update
$STD apt-get install -y pv
fi
set -o pipefail
# Content-Length aus HTTP-Header holen
local content_length
content_length=$(curl -fsSLI "$url" | awk '/Content-Length/ {print $2}' | tr -d '\r' || true)
if [[ -z "$content_length" ]]; then
#msg_warn "Content-Length not available, falling back to plain download"
if ! curl -fL# -o "$output" "$url"; then
msg_error "Download failed"
return 1
fi
else
if ! curl -fsSL "$url" | pv -s "$content_length" >"$output"; then
msg_error "Download failed"
return 1
fi
fi
}