ircu2/install-deps.sh

172 lines
4.6 KiB
Bash
Executable File

#!/bin/bash
#
# Script pentru instalare dependențe lipsă pentru UnderChat IRCd
# Limba: Română
#
# Culori
VERDE='\033[0;32m'
GALBEN='\033[1;33m'
ALBASTRU='\033[0;34m'
ROSU='\033[0;31m'
NC='\033[0m'
log_info() {
echo -e "${ALBASTRU}[INFO]${NC} $1"
}
log_success() {
echo -e "${VERDE}[SUCCES]${NC} $1"
}
log_error() {
echo -e "${ROSU}[EROARE]${NC} $1"
}
log_warn() {
echo -e "${GALBEN}[AVERTIZARE]${NC} $1"
}
echo -e "${ALBASTRU}"
echo "═══════════════════════════════════════"
echo " Instalare Dependențe UnderChat IRCd"
echo "═══════════════════════════════════════"
echo -e "${NC}"
# Detectează distribuzione Linux
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
else
log_error "Nu pot detecta distribuzione Linux!"
exit 1
fi
log_info "Distribuzione detectată: $OS"
# Instalare dependențe pe bază de distribuzione
case $OS in
ubuntu|debian)
log_info "Instalare pachete pe Ubuntu/Debian..."
sudo apt-get update
sudo apt-get install -y \
build-essential \
gcc \
make \
autoconf \
automake \
libtool \
libssl-dev \
libcrypt-dev \
perl \
git \
curl \
wget
;;
rhel|centos|fedora)
log_info "Instalare pachete pe RHEL/CentOS/Fedora..."
sudo yum install -y \
gcc \
make \
autoconf \
automake \
libtool \
openssl-devel \
libcrypt-devel \
perl \
git \
curl \
wget
;;
alpine)
log_info "Instalare pachete pe Alpine Linux..."
sudo apk add --no-cache \
build-base \
gcc \
make \
autoconf \
automake \
libtool \
openssl-dev \
perl
;;
*)
log_error "Distribuzione $OS nu este suportată!"
log_warn "Instalează manual: autoconf automake libtool build-essential openssl-dev"
exit 1
;;
esac
# Verificare instalări
echo ""
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
echo -e "${GALBEN}Verificare dependențe${NC}"
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
MISSING=0
# Verifică gcc
if command -v gcc &> /dev/null; then
log_success "GCC instalat: $(gcc --version | head -1)"
else
log_error "GCC nu este instalat!"
MISSING=1
fi
# Verifică make
if command -v make &> /dev/null; then
log_success "Make instalat: $(make --version | head -1)"
else
log_error "Make nu este instalat!"
MISSING=1
fi
# Verifică autoconf
if command -v autoconf &> /dev/null; then
log_success "Autoconf instalat: $(autoconf --version | head -1)"
else
log_warn "Autoconf nu este instalat (optional)"
fi
# Verifică automake
if command -v automake &> /dev/null; then
log_success "Automake instalat: $(automake --version | head -1)"
else
log_warn "Automake nu este instalat (optional)"
fi
# Verifică libtool
if command -v libtool &> /dev/null; then
log_success "Libtool instalat: $(libtool --version | head -1)"
else
log_warn "Libtool nu este instalat (optional)"
fi
# Verifică OpenSSL
if pkg-config --exists openssl 2>/dev/null; then
log_success "OpenSSL instalat"
else
log_warn "OpenSSL development files nu sunt instalate"
fi
echo ""
if [ $MISSING -eq 0 ]; then
echo -e "${VERDE}═══════════════════════════════════════${NC}"
echo -e "${VERDE}✓ Toate dependențele obligatorii sunt instalate!${NC}"
echo -e "${VERDE}═══════════════════════════════════════${NC}"
echo ""
echo -e "${GALBEN}Pași următori:${NC}"
echo " 1. cd ~/ircu2"
echo " 2. ./install.sh"
exit 0
else
echo -e "${ROSU}═══════════════════════════════════════${NC}"
echo -e "${ROSU}✗ Lipsesc dependențe obligatorii!${NC}"
echo -e "${ROSU}═══════════════════════════════════════${NC}"
exit 1
fi