use local figlet

This commit is contained in:
CanbiZ 2024-12-28 19:06:29 +01:00 committed by GitHub
parent a89ef945f7
commit 40cd3d0c71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,21 +158,32 @@ arch_check() {
# 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() {
if ! command -v toilet &> /dev/null; then if ! command -v figlet &> /dev/null; then
# Install toilet for Debian/Ubuntu-based systems if [ -f /etc/debian_version ] || [ -f /etc/lsb-release ]; then
if [ -f /etc/debian_version ]; then
apt-get update -y &> /dev/null apt-get update -y &> /dev/null
apt-get install -y toilet &> /dev/null apt-get install -y tar &> /dev/null # Sicherstellen, dass tar vorhanden ist
elif [ -f /etc/alpine-release ]; then elif [ -f /etc/alpine-release ]; then
apk add --no-cache toilet &> /dev/null apk add --no-cache tar &> /dev/null # Sicherstellen, dass tar vorhanden ist
export TERM=xterm
else else
echo "Unsupported OS"
return 1 return 1
fi fi
temp_dir=$(mktemp -d)
curl -sL https://github.com/community-scripts/ProxmoxVE/raw/refs/heads/develop/misc/figlet.tar.xz -o "$temp_dir/figlet.tar.xz"
tar -xf "$temp_dir/figlet.tar.xz" -C "$temp_dir"
mv "$temp_dir/figlet" /usr/local/bin/
chmod +x /usr/local/bin/figlet
rm -rf "$temp_dir"
fi fi
term_width=$(tput cols 2>/dev/null || echo 120) # Default to 120 columns
ascii_art=$(figlet -f slant -w "$term_width" "$APP")
clear clear
term_width=$(tput cols 2>/dev/null || echo 80) # Fallback to 80 columns cat <<EOF
toilet --width "$term_width" --gay "$APP" $ascii_art
EOF
} }
# 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.