From 493aa8dfe225cefcae3bb62c1d83ec964647e352 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 22 May 2025 10:47:54 +0200 Subject: [PATCH] test --- misc/build.func | 54 ++++++++++++++-------------- misc/core.func | 33 +++++++++++++++++ tools/pve/pve-privilege-converter.sh | 1 + 3 files changed, 61 insertions(+), 27 deletions(-) diff --git a/misc/build.func b/misc/build.func index 431eaf0..4dd4ae6 100644 --- a/misc/build.func +++ b/misc/build.func @@ -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() { diff --git a/misc/core.func b/misc/core.func index ee75e23..8b03525 100644 --- a/misc/core.func +++ b/misc/core.func @@ -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. # ------------------------------------------------------------------------------ diff --git a/tools/pve/pve-privilege-converter.sh b/tools/pve/pve-privilege-converter.sh index 5cf6a1a..e75841f 100644 --- a/tools/pve/pve-privilege-converter.sh +++ b/tools/pve/pve-privilege-converter.sh @@ -17,6 +17,7 @@ set -euo pipefail shopt -s inherit_errexit nullglob APP="PVE-Privilege-Converter" +APP_TYPE="pve" header_info "$APP" check_root() {