This commit is contained in:
CanbiZ 2025-05-22 10:47:54 +02:00
parent f2aca21d24
commit 493aa8dfe2
3 changed files with 61 additions and 27 deletions

View File

@ -172,39 +172,39 @@ update_motd_ip() {
fi
}
# Function to download & save header files
get_header() {
local app_name=$(echo "${APP,,}" | tr -d ' ')
local header_url="https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/ct/headers/${app_name}"
local local_header_path="/usr/local/community-scripts/headers/${app_name}"
# # Function to download & save header files
# get_header() {
# local app_name=$(echo "${APP,,}" | tr -d ' ')
# local header_url="https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/ct/headers/${app_name}"
# local local_header_path="/usr/local/community-scripts/headers/${app_name}"
mkdir -p "$(dirname "$local_header_path")"
# 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
# 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
}
# This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node.
header_info() {
local app_name=$(echo "${APP,,}" | tr -d ' ')
local header_content
# 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.
# header_info() {
# local app_name=$(echo "${APP,,}" | tr -d ' ')
# local header_content
# Download & save Header-File locally
header_content=$(get_header "$app_name") || header_content=""
# # Download & save Header-File locally
# header_content=$(get_header "$app_name") || header_content=""
# Show ASCII-Header
clear
local term_width
term_width=$(tput cols 2>/dev/null || echo 120)
# # Show ASCII-Header
# clear
# local term_width
# term_width=$(tput cols 2>/dev/null || echo 120)
if [ -n "$header_content" ]; then
echo "$header_content"
fi
}
# 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.
ssh_check() {

View File

@ -183,6 +183,39 @@ silent() {
"$@" >/dev/null 2>&1
}
# 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
}
# ------------------------------------------------------------------------------
# Performs a curl request with retry logic and inline feedback.
# ------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@ set -euo pipefail
shopt -s inherit_errexit nullglob
APP="PVE-Privilege-Converter"
APP_TYPE="pve"
header_info "$APP"
check_root() {