From d51a6435cadd4d1cd4853a5fdd9d17ab517f7c99 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 29 Apr 2025 09:19:53 +0200 Subject: [PATCH] test --- install/navidrome-install.sh | 7 ++++++- misc/tools.func | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/install/navidrome-install.sh b/install/navidrome-install.sh index 3e53178..79ba88d 100644 --- a/install/navidrome-install.sh +++ b/install/navidrome-install.sh @@ -15,7 +15,7 @@ update_os msg_info "Installing Dependencies (Patience)" $STD apt-get install -y \ - ffmpeg + ffmpeg msg_ok "Installed Dependencies" 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}" systemctl enable -q --now navidrome 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" motd_ssh diff --git a/misc/tools.func b/misc/tools.func index 5669daa..7f714fb 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -756,3 +756,32 @@ import_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 +}