From 220de44ee5fa2976c88ccb3891f26a7f06587049 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Apr 2025 10:37:05 +0200 Subject: [PATCH] Update build.func --- misc/build.func | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/misc/build.func b/misc/build.func index 2e00422b2..7cc2caa82 100644 --- a/misc/build.func +++ b/misc/build.func @@ -288,21 +288,20 @@ update_motd_ip() { # Function to download & save header files get_header() { - local app_name=$(echo ${APP,,} | tr -d ' ') - local header_url="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/ct/headers/${app_name}" - local local_header_path="/usr/local/community-scripts/headers/${app_name}" + local app_name=$(echo "${APP,,}" | tr -d ' ') + local header_url="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/headers/${app_name}" + local local_header_path="/usr/local/community-scripts/headers/${app_name}" - mkdir -p "/usr/local/community-scripts/headers" + mkdir -p "$(dirname "$local_header_path")" - # Check if local file already present - if [ ! -s "$local_header_path" ]; then - curl -fsSL "$local_header_path" "$header_url" - if [ $? -ne 0 ]; then - echo -e "${WARN}${BOLD}${YLW}Failed to download header for ${app_name}. No header will be displayed.${CL}" - return 1 + if [ ! -s "$local_header_path" ]; then + if ! curl -fsSL "$header_url" -o "$local_header_path"; then + echo -e "${WARN:-}[WARN]${BOLD:-}${YLW:-} Failed to download header for ${app_name}. No header will be displayed.${CL:-}" + return 1 + fi fi - fi - cat "$local_header_path" + + cat "$local_header_path" } # This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node.