Update build.func

This commit is contained in:
CanbiZ 2025-05-06 15:13:18 +02:00
parent 0b196b77b4
commit cf1db38661

View File

@ -297,30 +297,28 @@ get_header() {
if [ ! -s "$local_header_path" ]; then if [ ! -s "$local_header_path" ]; then
if ! curl -fsSL "$header_url" -o "$local_header_path"; then if ! curl -fsSL "$header_url" -o "$local_header_path"; then
echo -e "Failed to download header for ${app_name}. No header will be displayed."
return 1 return 1
fi fi
fi fi
cat "$local_header_path" cat "$local_header_path" 2>/dev/null || true
} }
# This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node. # This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node.
header_info() { header_info() {
local app_name=$(echo "${APP,,}" | tr -d ' ') local app_name=$(echo "${APP,,}" | tr -d ' ')
local header_content local header_content
# Download & save Header-File locally # Download & save Header-File locally
header_content=$(get_header "$app_name") header_content=$(get_header "$app_name") || header_content=""
if [ $? -ne 0 ]; then
# Fallback: Doesn't show Header
return 0
fi
# Show ASCII-Header # Show ASCII-Header
term_width=$(tput cols 2>/dev/null || echo 120)
clear clear
echo "$header_content" local term_width
term_width=$(tput cols 2>/dev/null || echo 120)
if [ -n "$header_content" ]; then
echo "$header_content"
fi
} }
# This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit. # This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit.