Compare commits

..

1 Commits

Author SHA1 Message Date
github-actions[bot]
8473c0140d Update CHANGELOG.md 2025-01-27 20:41:31 +00:00
2 changed files with 52 additions and 36 deletions

View File

@ -17,14 +17,6 @@ All LXC instances created using this repository come pre-installed with Midnight
Do not break established syntax in this file, as it is automatically updated by a Github Workflow Do not break established syntax in this file, as it is automatically updated by a Github Workflow
## 2025-01-28
### Changed
### 🧰 Maintenance
- [core]: Remove Figlet | Get Headers by Repo & Store Local [@MickLesk](https://github.com/MickLesk) ([#1802](https://github.com/community-scripts/ProxmoxVE/pull/1802))
## 2025-01-27 ## 2025-01-27
### Changed ### Changed

View File

@ -233,41 +233,65 @@ update_motd_ip() {
fi fi
} }
# Function to download & save header files
get_header() {
local app_name=$(echo ${APP,,} | tr -d ' ')
local header_url="https://github.com/community-scripts/ProxmoxVE/raw/main/ct/headers/${app_name}"
local local_header_path="/usr/local/community-scripts/headers/${app_name}"
mkdir -p "/usr/local/community-scripts/headers"
# Check if local file already present
if [ ! -f "$local_header_path" ]; then
wget -qO "$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
fi
fi
cat "$local_header_path"
}
# 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 ' ') # Helper function: Install FIGlet and download fonts
local header_content install_figlet() {
echo -e "${INFO}${BOLD}${DGN}Installing FIGlet...${CL}"
# Download & save Header-File locally temp_dir=$(mktemp -d)
header_content=$(get_header "$app_name") curl -sL https://github.com/community-scripts/ProxmoxVE/raw/refs/heads/main/misc/figlet.tar.xz -o "$temp_dir/figlet.tar.xz"
if [ $? -ne 0 ]; then mkdir -p /tmp/figlet
# Fallback: Doesn't show Header tar -xf "$temp_dir/figlet.tar.xz" -C /tmp/figlet --strip-components=1
return 0 cd /tmp/figlet
make >/dev/null
if [ -f "figlet" ]; then
chmod +x figlet
mv figlet /usr/local/bin/
mkdir -p /usr/local/share/figlet
cp -r /tmp/figlet/fonts/*.flf /usr/local/share/figlet/
echo -e "${CM}${BOLD}${DGN}FIGlet successfully installed.${CL}"
else
echo -e "${ERR}${BOLD}${RED}Failed to install FIGlet.${CL}"
return 1
fi
rm -rf "$temp_dir"
}
# Check if figlet and the slant font are available
if ! figlet -f slant "Test" &>/dev/null; then
echo -e "${INFO}${BOLD}${DGN}FIGlet or the slant font is missing. Installing...${CL}"
if [ -f /etc/debian_version ] || [ -f /etc/lsb-release ]; then
# Debian/Ubuntu-based systems
apt-get update -y &>/dev/null
apt-get install -y wget build-essential &>/dev/null
install_figlet
elif [ -f /etc/alpine-release ]; then
# Alpine-based systems
apk add --no-cache tar xz build-base wget &>/dev/null
export TERM=xterm
install_figlet
else
echo -e "${ERR}${BOLD}${RED}Unsupported operating system.${CL}"
return 1
fi fi
# Show ASCII-Header # Ensure the slant font is available
if [ ! -f "/usr/share/figlet/slant.flf" ]; then
echo -e "${INFO}${BOLD}${DGN}Downloading slant font...${CL}"
wget -qO /usr/share/figlet/slant.flf "http://www.figlet.org/fonts/slant.flf"
fi
fi
# Display ASCII header
term_width=$(tput cols 2>/dev/null || echo 120) term_width=$(tput cols 2>/dev/null || echo 120)
ascii_art=$(figlet -f slant -w "$term_width" "$APP")
clear clear
echo "$header_content" echo "$ascii_art"
} }
# 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.