Adaugă install-deps.sh și fixează compile_ircd pentru a gestiona autoconf absent

This commit is contained in:
mihaiitdata 2026-02-13 01:09:12 +02:00
parent d76fe8caff
commit 45aaad8261
2 changed files with 296 additions and 19 deletions

171
install-deps.sh Executable file
View File

@ -0,0 +1,171 @@
#!/bin/bash
#
# Script pentru instalare dependențe lipsă pentru Nefarious 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 Nefarious 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

View File

@ -196,11 +196,19 @@ configure_ircd() {
compile_ircd() { compile_ircd() {
log_info "Compilare Nefarious IRCd..." log_info "Compilare Nefarious IRCd..."
# Verifică dacă autoconf este disponibil
if ! command -v autoconf &> /dev/null; then
log_warn "Autoconf nu este instalat, dezactivare la Makefile..."
# Touchează configure pentru a evita rularea autoconf
touch ./configure
fi
make clean > /dev/null 2>&1 make clean > /dev/null 2>&1
make make
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
log_error "Compilare eșuată!" log_error "Compilare eșuată!"
log_warn "Încearcă: sudo apt-get install autoconf automake libtool"
return 1 return 1
fi fi
@ -232,6 +240,13 @@ generate_config() {
local admin_contact="${6:-admin@underchat.ro}" local admin_contact="${6:-admin@underchat.ro}"
local vhost="${7:-127.0.0.1}" local vhost="${7:-127.0.0.1}"
local network="${8:-underchat.org}" local network="${8:-underchat.org}"
local oper_user="${9:-AdminRoot}"
local oper_pass="${10:-\$PLAIN\$password}"
local is_hub="${11:-no}"
local hub_name="${12}"
local hub_host="${13}"
local hub_port="${14:-4400}"
local hub_pass="${15}"
log_info "Generare fișier de configurare: $config_file" log_info "Generare fișier de configurare: $config_file"
@ -380,11 +395,11 @@ Port {
Operator { Operator {
# Nickname-ul operatorului # Nickname-ul operatorului
name = "AdminRoot"; name = "EOFCONFIG_OPER_USER";
# Password-ul operatorului (hash MD5/bcrypt/SMD5) # Password-ul operatorului (hash MD5/bcrypt/SMD5)
# Generează cu: ./ircd/umkpasswd # Generat automat din parola furnizată
password = "$2a$04$NTy1i.X/8pXekNBNbMRlOu1JAjIiMfPGIe1sZf0Xqq.2jzqPMfN/G"; password = "EOFCONFIG_OPER_PASS";
# Host-uri permise pentru operator (*) # Host-uri permise pentru operator (*)
host = "*@*"; host = "*@*";
@ -393,26 +408,16 @@ Operator {
class = "Opers"; class = "Opers";
# Permisiuni # Permisiuni
# hide_oper = yes;
# hide_channels = yes;
# whois_notice = yes;
admin = yes; admin = yes;
hide_oper = no;
hide_channels = no;
}; };
# ============================================================================ # ============================================================================
# SECȚIUNE: CONNECT - Legări cu alte servere # SECȚIUNE: CONNECT - Legări cu alte servere
# ============================================================================ # ============================================================================
# Exemplu: Connect la un server hub EOFCONFIG_HUB_CONNECT
# Connect {
# name = "hub.EOFCONFIG_NETWORK";
# host = "192.168.1.100";
# password = "hub_password";
# port = 4400;
# class = "Server";
# autoconnect = yes;
# hub;
# };
# ============================================================================ # ============================================================================
# SECȚIUNE: UWORLD - Servere de servicii # SECȚIUNE: UWORLD - Servere de servicii
@ -436,7 +441,7 @@ features {
"LOG" = "SYSTEM" "LEVEL" "CRIT"; "LOG" = "SYSTEM" "LEVEL" "CRIT";
# Server settings # Server settings
"HUB" = "TRUE"; "HUB" = "EOFCONFIG_HUB_SETTING";
"RELIABLE_CLOCK" = "FALSE"; "RELIABLE_CLOCK" = "FALSE";
"WALLOPS_OPER_ONLY" = "TRUE"; "WALLOPS_OPER_ONLY" = "TRUE";
"NODNS" = "FALSE"; "NODNS" = "FALSE";
@ -523,6 +528,30 @@ EOFCONFIG
sed -i "s|EOFCONFIG_ADMIN_CONTACT|$admin_contact|g" "$config_file" sed -i "s|EOFCONFIG_ADMIN_CONTACT|$admin_contact|g" "$config_file"
sed -i "s|EOFCONFIG_VHOST|$vhost|g" "$config_file" sed -i "s|EOFCONFIG_VHOST|$vhost|g" "$config_file"
sed -i "s|EOFCONFIG_NETWORK|$network|g" "$config_file" sed -i "s|EOFCONFIG_NETWORK|$network|g" "$config_file"
sed -i "s|EOFCONFIG_OPER_USER|$oper_user|g" "$config_file"
sed -i "s|EOFCONFIG_OPER_PASS|$oper_pass|g" "$config_file"
# Setare HUB flag și CONNECT section
if [ "$is_hub" = "y" ] || [ "$is_hub" = "Y" ]; then
sed -i 's|EOFCONFIG_HUB_SETTING|"TRUE"|g' "$config_file"
# Adaugă CONNECT section pentru HUB
HUB_CONNECT_BLOCK="# Conectare la HUB principal
Connect {
name = \"$hub_name\";
host = \"$hub_host\";
password = \"$hub_password\";
port = $hub_port;
class = \"Server\";
autoconnect = yes;
hub;
};"
sed -i "s|EOFCONFIG_HUB_CONNECT|$HUB_CONNECT_BLOCK|g" "$config_file"
else
sed -i 's|EOFCONFIG_HUB_SETTING|"FALSE"|g' "$config_file"
sed -i 's|EOFCONFIG_HUB_CONNECT|# Server nu este HUB - fără connect|g' "$config_file"
fi
log_success "Fișier de configurare generat: $config_file" log_success "Fișier de configurare generat: $config_file"
return 0 return 0
@ -601,7 +630,10 @@ main() {
if [ -z "$CONFIG_FILE" ]; then if [ -z "$CONFIG_FILE" ]; then
# Citire interactivă de parametri # Citire interactivă de parametri
echo "" echo ""
echo -e "${GALBEN}Completare setări server:${NC}" echo -e "${GALBEN}═══════════════════════════════════════${NC}"
echo -e "${GALBEN}CONFIGURARE SERVER${NC}"
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
read -p " Domeniu rețea [underchat.org]: " network_name read -p " Domeniu rețea [underchat.org]: " network_name
network_name=${network_name:-underchat.org} network_name=${network_name:-underchat.org}
@ -622,14 +654,88 @@ main() {
read -p " Contact admin [admin@${network_name}]: " admin_contact read -p " Contact admin [admin@${network_name}]: " admin_contact
admin_contact=${admin_contact:-admin@${network_name}} admin_contact=${admin_contact:-admin@${network_name}}
# Configurare Operator
echo ""
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
echo -e "${GALBEN}CONFIGURARE OPERATOR${NC}"
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
read -p " Username operator [AdminRoot]: " oper_username
oper_username=${oper_username:-AdminRoot}
# Cerere parola și validare
while true; do
read -s -p " Parola operator: " oper_password
echo ""
if ! validate_password "$oper_password"; then
log_error "Parola prea scurtă! Minim 4 caractere."
continue
fi
read -s -p " Repetă parola: " oper_password_confirm
echo ""
if [ "$oper_password" != "$oper_password_confirm" ]; then
log_error "Parolele nu se potrivesc!"
continue
fi
# Generare hash
log_info "Generare hash parola..."
oper_hash="\$PLAIN\$$oper_password"
log_success "Parola operator criptată"
break
done
# Configurare HUB
echo ""
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
echo -e "${GALBEN}CONFIGURARE HUB${NC}"
echo -e "${GALBEN}═══════════════════════════════════════${NC}"
read -p " Este aceasta un server HUB? (y/n) [n]: " is_hub
is_hub=${is_hub:-n}
# Dacă e HUB, cere informații linking
if [ "$is_hub" = "y" ] || [ "$is_hub" = "Y" ]; then
echo ""
log_info "Configurare LINK la HUB principal"
echo ""
read -p " Nume HUB [hub.${network_name}]: " hub_name
hub_name=${hub_name:-hub.${network_name}}
read -p " IP/Host HUB [192.168.1.100]: " hub_host
hub_host=${hub_host:-192.168.1.100}
read -p " Port HUB [4400]: " hub_port
hub_port=${hub_port:-4400}
read -s -p " Parola linking: " hub_password
echo ""
HUB_CONFIG="yes"
else
HUB_CONFIG="no"
hub_name=""
hub_host=""
hub_port=""
hub_password=""
fi
else else
server_name=$(grep 'name = "' "$CONFIG_FILE" 2>/dev/null | head -1 | cut -d'"' -f2) server_name=$(grep 'name = "' "$CONFIG_FILE" 2>/dev/null | head -1 | cut -d'"' -f2)
server_name=${server_name:-localhost.localdomain} server_name=${server_name:-localhost.localdomain}
vhost_ip="127.0.0.1" vhost_ip="127.0.0.1"
network_name="underchat.org" network_name="underchat.org"
oper_username="AdminRoot"
oper_hash="\$PLAIN\$password"
is_hub="n"
HUB_CONFIG="no"
fi fi
generate_config "$conf_file" "$server_name" "$server_desc" "$server_numeric" "$admin_location" "$admin_contact" "$vhost_ip" "$network_name" generate_config "$conf_file" "$server_name" "$server_desc" "$server_numeric" "$admin_location" "$admin_contact" "$vhost_ip" "$network_name" "$oper_username" "$oper_hash" "$HUB_CONFIG" "$hub_name" "$hub_host" "$hub_port" "$hub_password"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi