diff --git a/misc/build.func b/misc/build.func index ef407f7f..763a0ba1 100644 --- a/misc/build.func +++ b/misc/build.func @@ -157,12 +157,16 @@ arch_check() { } header_info() { + # Check if figlet is installed if ! command -v figlet &> /dev/null; then + msg_info "Figlet not found. Installing..." + + # Install necessary dependencies and figlet if [ -f /etc/debian_version ] || [ -f /etc/lsb-release ]; then apt-get update -y &> /dev/null - apt-get install -y tar &> /dev/null + apt-get install -y tar build-essential &> /dev/null elif [ -f /etc/alpine-release ]; then - apk add --no-cache tar &> /dev/null + apk add --no-cache tar build-base &> /dev/null export TERM=xterm else return 1 @@ -170,22 +174,30 @@ header_info() { 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" - + mkdir -p /tmp/figlet tar -xf "$temp_dir/figlet.tar.xz" -C /tmp/figlet --strip-components=1 - - # Search for the figlet executable in the extracted folder - figlet_path=$(find /tmp/figlet -name 'figlet' -type f) - - if [ -n "$figlet_path" ]; then - chmod +x "$figlet_path" + cd /tmp/figlet + + # Run make to compile the figlet binary + make + + # 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_path" /usr/local/bin/ + mv figlet /usr/local/bin/ fi + + msg_ok "Figlet successfully installed and moved to /usr/local/bin" fi rm -rf "$temp_dir" + else + fi term_width=$(tput cols 2>/dev/null || echo 120)