FIX SINTAXĂ v1.1.1-madrid: Folosesc example.conf ca bază în loc de heredoc - EVITĂ probleme de encoding

This commit is contained in:
mihaiitdata 2026-02-13 16:45:58 +02:00
parent be4b2137ba
commit 903ad8e007
1 changed files with 45 additions and 197 deletions

View File

@ -151,203 +151,50 @@ mkdir -p "$PREFIX/log"
mkdir -p "$PREFIX/var" mkdir -p "$PREFIX/var"
log_success "Directoare create" log_success "Directoare create"
# Generare configurație - DIRECT fără probleme de expansiune # Generare configurație Madrid - FOLOSIND example.conf ca bază
log_info "Generare configurație Madrid..." log_info "Generare configurație Madrid din example.conf..."
cat > "$PREFIX/lib/ircd.conf" <<'ENDCONFIG' # Copiază example.conf ca bază
# Configurație UnderChat IRCd - Madrid.ES.EU.UnderChat.org if [ -f "doc/example.conf" ]; then
# Generat automat cu fix-and-install-madrid.sh cp doc/example.conf "$PREFIX/lib/ircd.conf"
# Versiune: v1.0.6-madrid-final log_success "Folosesc example.conf ca bază"
else
General { log_error "example.conf nu găsit!"
name = "Madrid.ES.EU.UnderChat.org"; exit 1
vhost = "10.0.0.125";
description = "The UnderChat.org Network - Madrid Node";
numeric = 1;
dns server = "8.8.8.8";
dns server = "1.1.1.1";
};
Admin {
Location = "UnderChat.org World";
Location = "Madrid, Spain";
Contact = "admin@UnderChat.org";
};
Class {
name = "Server";
pingfreq = 1 minutes 30 seconds;
connectfreq = 5 minutes;
maxlinks = 1;
sendq = 9000000;
};
Class {
name = "Local";
pingfreq = 1 minutes 30 seconds;
sendq = 160000;
maxlinks = 100;
usermode = "+iw";
};
Class {
name = "Other";
pingfreq = 1 minutes 30 seconds;
sendq = 160000;
maxlinks = 2048;
usermode = "+ix";
};
Class {
name = "Opers";
pingfreq = 1 minutes 30 seconds;
sendq = 160000;
maxlinks = 20;
local = no;
freeform = yes;
mode_lchan = yes;
deop_lchan = yes;
walk_lchan = yes;
show_invis = yes;
see_chan = yes;
list_chan = yes;
usermode = "+Wx";
remove = yes;
};
Client {
host = "*@*";
ip = "*@*";
class = "Other";
maxlinks = 6;
};
Jupe {
nick = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
nick = "StatServ,NoteServ";
nick = "ChanServ,ChanSaver";
nick = "NickServ,NickSaver";
};
Port {
vhost = "10.0.0.125" 4400;
server = yes;
hidden = yes;
};
Port {
vhost = "10.0.0.125" 6667;
hidden = yes;
};
Operator {
name = "Raducu";
password = "$PLAIN$muiesteaua";
host = "*@*";
class = "Opers";
admin = yes;
hide_oper = no;
hide_channels = no;
snomask = "+s";
privileges = "PRIV_WHOIS_NOTICE", "PRIV_HIDE_OPER", "PRIV_ADMIN";
};
features {
"NETWORK" = "UnderChat.org";
"DOMAINNAME" = "UnderChat.org";
"LOG" = "SYSTEM" "FILE" "REPLACE_PREFIX/log/ircd.log";
"LOG" = "SYSTEM" "LEVEL" "CRIT";
"HUB" = "FALSE";
"RELIABLE_CLOCK" = "FALSE";
"WALLOPS_OPER_ONLY" = "TRUE";
"NODNS" = "FALSE";
"NOIDENT" = "FALSE";
"CLIENT_FLOOD" = "1024";
"BUFFERPOOL" = "27000000";
"DEFAULTMAXSENDQLENGTH" = "40000";
"HOST_HIDING" = "TRUE";
"HOST_HIDING_STYLE" = "3";
"HIDDEN_HOST" = "users.UnderChat.org";
"HIDDEN_IP" = "127.0.0.1";
"HIDDEN_HOSTTYPE" = "3";
"MAXCHANNELSPERUSER" = "60";
"CHANNELLEN" = "200";
"MAXBANS" = "50";
"NICKLEN" = "12";
"NICKNAMEHISTORYLENGTH" = "800";
"HANGONGOODLINK" = "300";
"HANGONRETRYDELAY" = "10";
"CONNECTTIMEOUT" = "90";
"PINGFREQUENCY" = "120";
"CONNECTFREQUENCY" = "600";
"MPATH" = "REPLACE_PREFIX/lib/ircd.motd";
"RPATH" = "REPLACE_PREFIX/lib/remote.motd";
"PPATH" = "REPLACE_PREFIX/var/ircd.pid";
"CPATH" = "REPLACE_PREFIX/lib/ircd.conf";
"HIS_STATS_u" = "FALSE";
"HIS_STATS_U" = "TRUE";
"HIS_WHOIS_SERVERNAME" = "TRUE";
"HIS_WHOIS_IDLETIME" = "TRUE";
"HIS_WHOIS_LOCALCHAN" = "TRUE";
"HIS_WHO_SERVERNAME" = "TRUE";
"HIS_WHO_HOPCOUNT" = "TRUE";
"HIS_NETSPLIT" = "TRUE";
"HIS_SERVERNAME" = "*.UnderChat.org";
"HIS_SERVERINFO" = "The UnderChat.org World";
"CHECK" = "TRUE";
"CHECK_EXTENDED" = "TRUE";
"MAX_CHECK_OUTPUT" = "1000";
"OPER_WHOIS_PARANOIA" = "TRUE";
"SETHOST" = "TRUE";
"NETWORK_REHASH" = "TRUE";
"HALFOPS" = "TRUE";
"CTCP_VERSIONING" = "FALSE";
"WHOIS_NOTICE" = "TRUE";
"SPY_WHOIS" = "TRUE";
"SNOMASK_OPERDEFAULT" = "1024";
"SNOMASK_DEFAULT" = "1024";
};
ENDCONFIG
# Înlocuiește REPLACE_PREFIX cu calea reală
sed -i "s|REPLACE_PREFIX|$PREFIX|g" "$PREFIX/lib/ircd.conf"
# Verifică că înlocuirea a funcționat
if grep -q "REPLACE_PREFIX" "$PREFIX/lib/ircd.conf"; then
log_error "REPLACE_PREFIX nu a fost înlocuit corect!"
log_info "Încerc din nou cu escape..."
sed -i "s|REPLACE_PREFIX|${PREFIX}|g" "$PREFIX/lib/ircd.conf"
fi fi
# Verifică din nou # Modifică valorile pentru Madrid
if grep -q "REPLACE_PREFIX" "$PREFIX/lib/ircd.conf"; then log_info "Personalizare pentru Madrid..."
log_error "Încă există REPLACE_PREFIX în config! Manual fix..."
# Înlocuire forțată linie cu linie
sed -i "s|\"REPLACE_PREFIX|\"$PREFIX|g" "$PREFIX/lib/ircd.conf"
fi
log_success "Configurație Madrid generată" # Înlocuiește valorile cu cele pentru Madrid
sed -i 's/name = "[^"]*";/name = "Madrid.ES.EU.UnderChat.org";/' "$PREFIX/lib/ircd.conf"
sed -i 's/vhost = "[^"]*";/vhost = "10.0.0.125";/g' "$PREFIX/lib/ircd.conf"
sed -i 's/description = "[^"]*";/description = "The UnderChat.org Network - Madrid Node";/' "$PREFIX/lib/ircd.conf"
sed -i 's/"NETWORK" = "[^"]*"/"NETWORK" = "UnderChat.org"/g' "$PREFIX/lib/ircd.conf"
sed -i 's/"DOMAINNAME" = "[^"]*"/"DOMAINNAME" = "UnderChat.org"/g' "$PREFIX/lib/ircd.conf"
# Debug: Afișează liniile critice # Înlocuiește căile
log_info "Verificare CPATH generat..." sed -i "s|/path/to|$PREFIX|g" "$PREFIX/lib/ircd.conf"
grep "CPATH" "$PREFIX/lib/ircd.conf" || log_warn "CPATH nu găsit!" sed -i "s|\"MPATH\" = \"[^\"]*\"|\"MPATH\" = \"$PREFIX/lib/ircd.motd\"|g" "$PREFIX/lib/ircd.conf"
sed -i "s|\"CPATH\" = \"[^\"]*\"|\"CPATH\" = \"$PREFIX/lib/ircd.conf\"|g" "$PREFIX/lib/ircd.conf"
sed -i "s|\"PPATH\" = \"[^\"]*\"|\"PPATH\" = \"$PREFIX/var/ircd.pid\"|g" "$PREFIX/lib/ircd.conf"
sed -i "s|\"LOG\" = \"SYSTEM\" \"FILE\" \"[^\"]*\"|\"LOG\" = \"SYSTEM\" \"FILE\" \"$PREFIX/log/ircd.log\"|g" "$PREFIX/lib/ircd.conf"
# Adaugă operator Raducu
sed -i '/^Operator {/,/^};/c\
Operator {\
name = "Raducu";\
password = "$PLAIN$muiesteaua";\
host = "*@*";\
class = "Opers";\
admin = yes;\
hide_oper = no;\
hide_channels = no;\
snomask = "+s";\
privileges = "PRIV_WHOIS_NOTICE", "PRIV_HIDE_OPER", "PRIV_ADMIN";\
};' "$PREFIX/lib/ircd.conf"
log_success "Configurație Madrid personalizată"
# MOTD # MOTD
log_info "Generare MOTD..." log_info "Generare MOTD..."
@ -418,10 +265,10 @@ echo ""
echo -e "${ALBASTRU}═══ PORNIRE SERVER ═══${NC}" echo -e "${ALBASTRU}═══ PORNIRE SERVER ═══${NC}"
echo " Pornește acum:" echo " Pornește acum:"
echo -e " ${VERDE}$PREFIX/bin/ircd${NC}" echo -e " ${VERDE}$PREFIX/bin/ircd -f $PREFIX/lib/ircd.conf${NC}"
echo "" echo ""
echo " SAU pornire în background:" echo " SAU pornire în background:"
echo -e " ${VERDE}nohup $PREFIX/bin/ircd &${NC}" echo -e " ${VERDE}nohup $PREFIX/bin/ircd -f $PREFIX/lib/ircd.conf &${NC}"
echo "" echo ""
echo -e "${ALBASTRU}═══ VERIFICARE ═══${NC}" echo -e "${ALBASTRU}═══ VERIFICARE ═══${NC}"
@ -454,9 +301,10 @@ start_now=${start_now:-Y}
if [[ "$start_now" =~ ^[Yy]$ ]]; then if [[ "$start_now" =~ ^[Yy]$ ]]; then
echo "" echo ""
log_info "Pornire server IRCd..." log_info "Pornire server IRCd cu config Madrid..."
if "$PREFIX/bin/ircd"; then # Pornește cu -f pentru a specifica calea completă a config-ului
if "$PREFIX/bin/ircd" -f "$PREFIX/lib/ircd.conf"; then
sleep 2 sleep 2
if pgrep -x ircd > /dev/null; then if pgrep -x ircd > /dev/null; then
@ -478,7 +326,7 @@ if [[ "$start_now" =~ ^[Yy]$ ]]; then
else else
echo "" echo ""
log_info "OK! Pornește manual când ești gata:" log_info "OK! Pornește manual când ești gata:"
echo " $PREFIX/bin/ircd" echo " $PREFIX/bin/ircd -f $PREFIX/lib/ircd.conf"
fi fi
echo "" echo ""