From 903ad8e007b9e57746330189c50d9e28565770ba Mon Sep 17 00:00:00 2001 From: mihaiitdata Date: Fri, 13 Feb 2026 16:45:58 +0200 Subject: [PATCH] =?UTF-8?q?FIX=20SINTAX=C4=82=20v1.1.1-madrid:=20Folosesc?= =?UTF-8?q?=20example.conf=20ca=20baz=C4=83=20=C3=AEn=20loc=20de=20heredoc?= =?UTF-8?q?=20-=20EVIT=C4=82=20probleme=20de=20encoding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix-and-install-madrid.sh | 242 +++++++------------------------------- 1 file changed, 45 insertions(+), 197 deletions(-) diff --git a/fix-and-install-madrid.sh b/fix-and-install-madrid.sh index 1e47fe2..fc7a019 100644 --- a/fix-and-install-madrid.sh +++ b/fix-and-install-madrid.sh @@ -151,203 +151,50 @@ mkdir -p "$PREFIX/log" mkdir -p "$PREFIX/var" log_success "Directoare create" -# Generare configurație - DIRECT fără probleme de expansiune -log_info "Generare configurație Madrid..." +# Generare configurație Madrid - FOLOSIND example.conf ca bază +log_info "Generare configurație Madrid din example.conf..." -cat > "$PREFIX/lib/ircd.conf" <<'ENDCONFIG' -# Configurație UnderChat IRCd - Madrid.ES.EU.UnderChat.org -# Generat automat cu fix-and-install-madrid.sh -# Versiune: v1.0.6-madrid-final - -General { - name = "Madrid.ES.EU.UnderChat.org"; - 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" +# Copiază example.conf ca bază +if [ -f "doc/example.conf" ]; then + cp doc/example.conf "$PREFIX/lib/ircd.conf" + log_success "Folosesc example.conf ca bază" +else + log_error "example.conf nu găsit!" + exit 1 fi -# Verifică din nou -if grep -q "REPLACE_PREFIX" "$PREFIX/lib/ircd.conf"; then - 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 +# Modifică valorile pentru Madrid +log_info "Personalizare pentru Madrid..." -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 -log_info "Verificare CPATH generat..." -grep "CPATH" "$PREFIX/lib/ircd.conf" || log_warn "CPATH nu găsit!" +# Înlocuiește căile +sed -i "s|/path/to|$PREFIX|g" "$PREFIX/lib/ircd.conf" +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 log_info "Generare MOTD..." @@ -418,10 +265,10 @@ echo "" echo -e "${ALBASTRU}═══ PORNIRE SERVER ═══${NC}" 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 " 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 -e "${ALBASTRU}═══ VERIFICARE ═══${NC}" @@ -454,9 +301,10 @@ start_now=${start_now:-Y} if [[ "$start_now" =~ ^[Yy]$ ]]; then 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 if pgrep -x ircd > /dev/null; then @@ -478,7 +326,7 @@ if [[ "$start_now" =~ ^[Yy]$ ]]; then else echo "" 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 echo ""