1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-02-01 16:51:52 +00:00

Update build.func

This commit is contained in:
CanbiZ 2024-12-28 19:56:22 +01:00 committed by GitHub
parent 06a49017af
commit 4376497a5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)