From ecfdfc6c6f2672c96b9ad3c2438815690f48082b Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 26 May 2025 13:04:02 +0200 Subject: [PATCH] fixes --- misc/vm-core.func | 33 +++++++++++++++++++++++++++++++++ vm/umbrel-os-vm.sh | 1 + 2 files changed, 34 insertions(+) diff --git a/misc/vm-core.func b/misc/vm-core.func index 9b5cca3..05d1b03 100644 --- a/misc/vm-core.func +++ b/misc/vm-core.func @@ -23,6 +23,39 @@ load_functions() { # add more } +# Function to download & save header files +get_header() { + local app_name=$(echo "${APP,,}" | tr -d ' ') + local app_type=${APP_TYPE:-ct} # Default zu 'ct' falls nicht gesetzt + local header_url="https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/${app_type}/headers/${app_name}" + local local_header_path="/usr/local/community-scripts/headers/${app_type}/${app_name}" + + mkdir -p "$(dirname "$local_header_path")" + + if [ ! -s "$local_header_path" ]; then + if ! curl -fsSL "$header_url" -o "$local_header_path"; then + return 1 + fi + fi + + cat "$local_header_path" 2>/dev/null || true +} + +header_info() { + local app_name=$(echo "${APP,,}" | tr -d ' ') + local header_content + + header_content=$(get_header "$app_name") || header_content="" + + clear + local term_width + term_width=$(tput cols 2>/dev/null || echo 120) + + if [ -n "$header_content" ]; then + echo "$header_content" + fi +} + # ------------------------------------------------------------------------------ # Sets ANSI color codes used for styled terminal output. # ------------------------------------------------------------------------------ diff --git a/vm/umbrel-os-vm.sh b/vm/umbrel-os-vm.sh index 61f6f97..48b83fd 100644 --- a/vm/umbrel-os-vm.sh +++ b/vm/umbrel-os-vm.sh @@ -9,6 +9,7 @@ source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxV load_functions APP="Umbrel OS VM" +APP_TYPE="VM" header_info echo -e "\n Loading..." GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//')