mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Add Figlet into Repo | Creation of local ASCII Header (#1072)
* Add Figlet into Repo | Creation of local ASCII Header * update develop > main
This commit is contained in:
		@@ -189,28 +189,44 @@ update_motd_ip() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# 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 [ -f /etc/debian_version ]; then
 | 
					  # Check if figlet is installed
 | 
				
			||||||
    # Debian/Ubuntu
 | 
					  if ! command -v figlet &> /dev/null; then
 | 
				
			||||||
    if ! grep -q "^deb http://ftp.debian.org/debian bookworm main contrib" /etc/apt/sources.list; then
 | 
					    echo -e "${INFO}${BOLD}${DGN}Figlet for ASCII-Header not found. Installing... ${CL}"
 | 
				
			||||||
      echo "deb http://ftp.debian.org/debian bookworm main contrib" >> /etc/apt/sources.list
 | 
					
 | 
				
			||||||
 | 
					    # Install necessary dependencies and figlet
 | 
				
			||||||
 | 
					    if [ -f /etc/debian_version ] || [ -f /etc/lsb-release ]; then
 | 
				
			||||||
      apt-get update -y &> /dev/null
 | 
					      apt-get update -y &> /dev/null
 | 
				
			||||||
    fi
 | 
					      apt-get install -y tar build-essential &> /dev/null
 | 
				
			||||||
    apt-get install -y figlet &> /dev/null
 | 
					 | 
				
			||||||
    elif [ -f /etc/alpine-release ]; then
 | 
					    elif [ -f /etc/alpine-release ]; then
 | 
				
			||||||
    # Alpine Linux
 | 
					      apk add --no-cache tar build-base &> /dev/null
 | 
				
			||||||
    apk add --no-cache figlet ncurses &> /dev/null
 | 
					 | 
				
			||||||
      export TERM=xterm
 | 
					      export TERM=xterm
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    echo "Unsupported OS"
 | 
					 | 
				
			||||||
      return 1
 | 
					      return 1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					    temp_dir=$(mktemp -d)
 | 
				
			||||||
  term_width=$(tput cols 2>/dev/null || echo 120)  # Fallback to 120 columns
 | 
					    curl -sL https://github.com/community-scripts/ProxmoxVE/raw/refs/heads/main/misc/figlet.tar.xz -o "$temp_dir/figlet.tar.xz"
 | 
				
			||||||
 | 
					    mkdir -p /tmp/figlet
 | 
				
			||||||
 | 
					    tar -xf "$temp_dir/figlet.tar.xz" -C /tmp/figlet --strip-components=1
 | 
				
			||||||
 | 
					    cd /tmp/figlet
 | 
				
			||||||
 | 
					    # Run make to compile the figlet binary
 | 
				
			||||||
 | 
					    make >/dev/null
 | 
				
			||||||
 | 
					    # Check if the figlet binary exists
 | 
				
			||||||
 | 
					    if [ -f "figlet" ]; then
 | 
				
			||||||
 | 
					      chmod +x figlet
 | 
				
			||||||
 | 
					      # Move figlet to /usr/local/bin if not already there
 | 
				
			||||||
 | 
					      if [ ! -e /usr/local/bin/figlet ]; then
 | 
				
			||||||
 | 
					        mv figlet /usr/local/bin/
 | 
				
			||||||
 | 
					        mkdir -p /usr/local/share/figlet
 | 
				
			||||||
 | 
					        cp -r /tmp/figlet/fonts/*.flf /usr/local/share/figlet/
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					      echo -e "${CM}${BOLD}${DGN}Figlet successfully installed. ${CL}"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    rm -rf "$temp_dir"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  term_width=$(tput cols 2>/dev/null || echo 120)
 | 
				
			||||||
  ascii_art=$(figlet -f slant -w "$term_width" "$APP")
 | 
					  ascii_art=$(figlet -f slant -w "$term_width" "$APP")
 | 
				
			||||||
  clear
 | 
					  clear
 | 
				
			||||||
  cat <<EOF
 | 
					  echo "$ascii_art"
 | 
				
			||||||
$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.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user