This repository has been archived on 2025-02-12. You can view files and clone it, but cannot push or open issues or pull requests.
NeoStats/makeconf

674 lines
17 KiB
Bash
Executable file
Raw Blame History

#!/bin/sh
# makeconf $Id$
if [ "$1" ] ; then
NEOSTATSCONF=$1
else
NEOSTATSCONF="neostats.conf"
fi
TIME=`date +"%H:%M:%S %Z"`
DATE=`date +"%a, %b %e %Y"`
SERVNAME="stats.somenet.net"
ROOTNICK="NeoStats"
SERVICEHOST="stats.net"
SERVNUMERIC="1"
INFOLINE="NeoStats 3.0 IRC Services"
LINKPORT="6667"
LINKSERVER="127.0.0.1"
LINKPASS="linkpassword"
NEOCHAN="#services"
NEOCONN="10"
BINDIP="127.0.0.1"
LOGFNAMEFORMAT="-%m-%d"
SETSERVERTIMES="24"
# these are so I can use stuff like $1 without it replacing it...like by
# using $dlrsgn$uno for $1
dlrsgn="$"
uno="1"
dos="2"
# remove the temp file if it exists
rm -f mkconf.tmp
# make a quick script for replacing one line with another
cat > repl_str << __EOF__
sed -e "s@^$dlrsgn$uno\(.*\)@$dlrsgn$dos" $NEOSTATSCONF > mkconf.tmp
cp mkconf.tmp $NEOSTATSCONF
rm mkconf.tmp
__EOF__
# mark repl_str as an executable
chmod +x repl_str
rm -f repl_str
# Checking out how to specify not to make a new line with the current OS
c=''
n=''
2>/dev/null
if [ "`eval echo -n 'a'`" = "-n a" ]; then
c='\c'
else
n='-n'
fi
# If Settings exist, load the info, otherwise tell them to run configure.
if [ -r config.h ]; then
echo "Starting configuration.. "
else if [ -r include/config.h ]; then
echo "Starting configuration.. "
else
echo "Configuration failed!"
echo "You have not run configure yet!"
echo "You probably should read the README file too"
echo ""
echo "Type ./configure"
echo "(If you need help read the README before asking us)"
echo ""
exit 1
fi
fi
CONF=$NEOSTATSCONF
if [ -r "$CONF" ]; then
echo "$NEOSTATSCONF found"
echo " "
echo "You already have a configuration file. This script is just for"
echo "creating the configuration file. If you continue you WILL LOSE"
echo "all the data that is already in your configuration file!"
echo ""
echo "If you are sure you want to recreate your configuration file"
echo "type 'recreate'."
echo $n " [exit] -> $c"
read cc
if [ "$cc" != "recreate" ]; then
echo " "
echo "Do you want to edit $NEOSTATSCONF using an editor?"
echo "If so, specify the editor you want to use. Otherwise,"
echo "type 'exit'."
EDITFND="not found"
if [ -r /usr/bin/pico ]; then
EDITFND="pico"
fi
if [ -r /usr/bin/joe ]; then
EDITFND="joe"
fi
if [ -r /usr/bin/vi ]; then
EDITFND="vi"
fi
if [ -r /usr/bin/vim ]; then
EDITFND="vim"
fi
while [ "c" = "c" ]; do
echo $n " [$EDITFND] -> $c"
read EDITOR
if [ -z "$EDITOR" ]; then
EDITOR="$EDITFND"
fi
if [ "$EDITOR" = "exit" ]; then
echo "Done."
exit 1
fi
if [ -f $EDITOR ]; then
$EDITOR $CONF
exit 1
fi
if [ -f /usr/bin/$EDITOR ]; then
/usr/bin/$EDITOR $CONF
exit 1
fi
echo "Editor not found. Specify a valid editor or"
echo "type 'exit' to quit this script."
done
fi
mv $CONF "$CONF.saved"
rm $CONF
echo "$NEOSTATSCONF has been renamed to $CONF.saved"
else
echo "$NEOSTATSCONF is not found. (good)"
fi
clear
echo ""
echo "Thanks for Choosing NeoStats!"
echo ""
echo "*----------------------------------------*"
echo "| Welcome to the $NEOSTATSCONF generator. |"
echo "*----------------------------------------*"
###########################################################################
# select IRCd
validselection=0
echo "Which IRC server do you use?"
echo " 1) Unreal 3.1.x"
echo " 2) Unreal 3.2.x"
echo " 3) Ultimate 2.x.x"
echo " 4) Ultimate 3.x.x"
echo " 5) Hybrid7"
echo " 6) NeoIRCd"
echo " 7) Bahamut 1.4"
echo " 8) Bahamut 1.8"
echo " 9) Mystic"
echo " 10) Quantum"
echo " 11) Viagra"
echo " 12) Plexus"
echo " 13) IRCu P10 (Experimental)"
while [ $validselection -eq 0 ] ; do
echo $n " [$IRCD_DEFAULT] -> $c"
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
INPUT=$IRCD_DEFAULT
fi
case $INPUT in
no\ default)
echo "You must specify your IRC server type in order for NeoStats to function"
echo "correctly."
;;
1)
IRCD="unreal31"
validselection=1
;;
2)
IRCD="unreal32"
validselection=1
;;
3)
IRCD="ultimate2"
validselection=1
;;
4)
IRCD="ultimate3"
validselection=1
;;
5)
IRCD="hybrid7"
MEXTAUTHALLOWED=0
validselection=1
;;
6)
IRCD="neoircd"
validselection=1
;;
7)
IRCD="bahamut"
validselection=1
;;
8)
IRCD="bahamut18"
validselection=1
;;
9)
IRCD="mystic"
validselection=1
;;
10)
IRCD="quantum"
validselection=1
;;
11)
IRCD="viagra"
validselection=1
;;
12)
IRCD="plexus"
validselection=1
;;
13)
IRCD="ircup10"
validselection=1
;;
*)
echo "Please enter a valid option number."
;;
esac
done
IRCD_DEFAULT=$INPUT
echo ""
echo " "
echo "What will your root nickname be? (ie: $ROOTNICK)"
echo $n " [$ROOTNICK] -> $c"
read cc
if [ ! -z "$cc" ]; then
ROOTNICK="$cc"
fi
echo " "
echo "What will your service host be? (ie: $SERVICEHOST)"
echo $n " [$SERVICEHOST] -> $c"
read cc
if [ ! -z "$cc" ]; then
SERVICEHOST="$cc"
fi
echo " "
echo "What will your server name be? (ie: $SERVNAME)"
echo $n " [$SERVNAME] -> $c"
read cc
if [ ! -z "$cc" ]; then
SERVNAME="$cc"
fi
echo " "
echo "What is your IRC server's IP? (ie: $LINKSERVER)"
echo $n " [$LINKSERVER] -> $c"
read cc
if [ ! -z "$cc" ]; then
LINKSERVER="$cc"
fi
echo " "
echo "What is the IRCd's Link port? (ie: 7890)"
echo $n " [$LINKPORT] -> $c"
read cc
if [ ! -z "$cc" ]; then
LINKPORT="$cc"
fi
echo " "
echo "What is the IRCd's Link password for stats? (ie: bleh)"
echo $n " [$LINKPASS] -> $c"
read cc
if [ ! -z "$cc" ]; then
LINKPASS="$cc"
fi
echo " "
echo "NeoStats Server comment?"
echo $n " [$INFOLINE] -> $c"
read cc
if [ ! -z "$cc" ]; then
INFOLINE="$cc"
fi
echo " "
echo "What channel should NeoStats join on IRC?"
echo $n " [$NEOCHAN] -> $c"
read cc
if [ ! -z "$cc" ]; then
NEOCHAN="$cc"
fi
echo " "
echo "Time in seconds we wait before attempting to reconnect to the server on a split?"
echo $n " [$NEOCONN] -> $c"
read cc
if [ ! -z "$cc" ]; then
NEOCONN="$cc"
fi
echo " "
echo "What IP should NeoStats Bind to? (ie: $BINDIP)"
echo "This is optional. See neostats.conf for more information"
echo $n " [$BINDIP] -> $c"
read cc
if [ ! -z "$cc" ]; then
BINDIP="$cc"
fi
cat > $CONF << __EOF__
##################################################
## Configuration file for NeoStats
## Created: $DATE - $TIME
## NeoStats Copyright (c) 1999-2005, Adam Rutter, Justin Hammond, Mark Hetherington
## Web: http://www.NeoStats.Net
## File Revision: 3.0
##################################################
##################################################
#Each of the options has an indicator as follows:
# [REQUIRED] - must be set or NeoStats will not run.
# [RECOMMENDED] - optional but may cause problems if not set.
# [OPTIONAL] - optional and the feature will be disabled if not set.
# [DISCOURAGED] - may cause undesirable side effects if enabled.
##################################################
##############################
# IRCd Linking Configuration #
##############################
# PROTOCOL <protocol> [REQUIRED]
# Specifies the protocol module to use.
# Valid protocol options are:
# bahamut14 bahamut18 client hybrid7
# ircup10 plexus
# ultimate2 ultimate3 unreal31 unreal32
#
#
# PROTOCOL "unreal32"
#
PROTOCOL "$IRCD"
# DBM <dbm> [OPTIONAL]
# Specifies the database manager module to use.
# NeoStats will default to GDBM if this is not provided.
# Valid options are:
# gdbm
#
# DBM "gdbm"
#
#
#DBM "$DATABASE"
# SERVER_NAME <hostname> [REQUIRED]
# Specifies the name of the NeoStats Server as it will appear on
# the network. e.g.
#
# SERVER_NAME stats.neostats.net
#
# When NeoStats links, it will appear as stats.neostats.net.
SERVER_NAME $SERVNAME
# SERVER_PORT <port number> [REQUIRED]
# Specifies the port to connect to on the IRC Server e.g.
#
# SERVER_PORT 6667
#
# When connecting, NeoStats will connect to port 6667
SERVER_PORT $LINKPORT
# CONNECT_TO <ip address> [REQUIRED]
# Specifies the IP address to connect to. e.g.
#
# CONNECT_TO 127.0.0.1
#
# This will force stats to connect to 127.0.0.1
CONNECT_TO $LINKSERVER
# CONNECT_PASS <link password> [REQUIRED]
# Specifies the password used to connect. This must match your C/N
# lines in your IRCD configuration e.g.
#
# CONNECT_PASS linkpass
#
# Send "linkpass" as the password to connect
CONNECT_PASS $LINKPASS
# SERVER_INFOLINE <info line> [REQUIRED]
# Specify the description of the server that
# appears when you do /links e.g.
#
# SERVER_INFOLINE Network Auxiliary Services
SERVER_INFOLINE "$INFOLINE"
# SERVER_NUMERIC <numeric> [RECOMMENDED]
# Specify the numeric of the server to send on connect.
# This must be a value between 1 and 254, and must not be in use by
# any other IRC server on the network.
#
# SERVER_NUMERIC 1
SERVER_NUMERIC "$SERVNUMERIC"
##########################
# NeoStats Configuration #
##########################
# ROOT_NICK <nick> [REQUIRED]
# Specifies the nick of the NeoStats root bot
# e.g.
#
# ROOT_NICK NeoStats
#
# When NeoStats links, it create a root bot with nick NeoStats
ROOT_NICK "$ROOTNICK"
# SERVICE_HOST <nick> [REQUIRED]
# Specifies the default host of NeoStats service bots
# e.g.
#
# SERVICE_HOST stats.net
#
# Service bots will now we user@stats.net
# If not specified NeoStats will default to the server name
#SERVICE_HOST "$SERVICEHOST"
# SERVICES_CHAN #<channel name> [REQUIRED]
# Specify the channel that all bots on NeoStats
# will automatically join, and echo out any
# important information e.g.
#
# SERVICES_CHAN #services
#
# Makes NeoStats, and all the other bots join #services channel on
# start-up/load.
SERVICES_CHAN $NEOCHAN
# WANT_PRIVMSG [DISCOURAGED]
# Specify if the bots should send all messages as privmsgs or as
# notices (Most Services use notice) e.g.
#
# WANT_PRIVMSG
#
# If present, will send all messages as privmsgs (if commented out,
# it will send as Notices) *NOTE:* This option Violates IRC RFC, and
# can cause flooding problems on your network. Its NOT recommended.
#WANT_PRIVMSG
# RECONNECT_TIME <seconds> [RECOMMENDED]
# If NeoStats server gets split from the network, how long to wait
# before attempting to reconnect to the network. A value of 0 will
# cause NeoStats to shutdown and not attempt to reconnect. e.g.
#
# RECONNECT_TIME 10
#
# Specifies wait 10 seconds before trying to reconnect
#
# RECONNECT_TIME 0
#
# Tells NeoStats to never reconnect to the network
#
# If not specified, NeoStats will default to 10 seconds.
RECONNECT_TIME $NEOCONN
# ONLY_OPERS [OPTIONAL]
# Restrict NeoStats and StatServ to opers use only.
# If not specified, users will have some access to NeoStats
# and StatServ commands. e.g.
#
# ONLY_OPERS
#
# Only opers may use NeoStats and StatServ.
#ONLY_OPERS
# BIND_TO [OPTIONAL]
# Make NeoStats bind to a particular IP Address. If not
# specified NeoStats will attempt to find this address
# itself. e.g.
#
# BIND_TO 203.203.123.12
#
# All outgoing connections from NeoStats will originate from this
# IP address
# This IP address should not be localhost (127.0.0.1)
#BIND_TO $BINDIP
# LOG_FILENAME_FORMAT <format> [OPTIONAL]
# Defines the format for dated log files. This allows you to choose
# what date format is used for log file names when they are rotated at
# midnight. The option uses the parameters passed to strftime so you
# can use any options valid for that function. Common ones are:
# %a Abbreviated weekday name
# %A Full weekday name
# %b Abbreviated month name
# %B Full month name
# %d Day of month as decimal number (01 <20> 31)
# %m Month as decimal number (01 <20> 12)
# %y Year without century, as decimal number (00 <20> 99)
# %Y Year with century, as decimal number
#
# Examples using 30 September 2003 as the date:
# For NeoStats0930.log:
#
# LOG_FILENAME_FORMAT %m%d
#
# For NeoStats20030930.log:
#
# LOG_FILENAME_FORMAT %Y%m%d
#
# If not defined, the default is the original NeoStats log format of
# "-%m-%d" i.e. NeoStats-09-30.log
#LOG_FILENAME_FORMAT $LOGFNAMEFORMAT
# SET_SERVER_TIMES <INTERVAL> [OPTIONAL]
# Cause NeoStats to sync server times at the given interval
# INTERVAL is an integer representing the number of hours
#
# Examples
#
# SET_SERVER_TIMES 24
#
# Cause NeoStats to sync server times every 24 hours
# If not present, NeoStats will not sync times.
# This option only works on servers that support this and
# defaults to a sync interval of 24 hours. Enabling this
# option will also cause NeoStats to sync servers when it
# first joins the network.
SET_SERVER_TIMES 24
########################################
# NeoStats ROOT user #
########################################
#SERVICE_ROOT <nick!ident@host> [REQUIRED]
# Who should get master access to manage NeoStats regardless of
# authentication systems. Only one entry allowed. e.g.
#
# SERVICE_ROOT fish!?Fish@*.neostats.net
#
# Will give "fish" complete access to NeoStats if fish has
# umode +r and comes from the specified hostname and ident.
#SERVICE_ROOT nick!ident@host
# NO_LOAD [YOU MUST REMOVE THIS]
# If this is in the neostats.conf your NeoStats WILL NOT START UP. To
# disable this simply comment this line out. e.g.
#
# NO_LOAD <- NeoStats will not load.
#
# #NO_LOAD <- NeoStats will load.
NO_LOAD
#####################################
# Module Configurations and Loading #
#####################################
# LOAD_MODULE <module name> [OPTIONAL]
# What modules to load at start-up. e.g.
#
# LOAD_MODULE statserv
#
# Will load up StatServ at boot
#
# Multiple instances of LOAD_MODULE may be specified
#
# We have provided example lines for convenience for
# official modules but you must download and install
# external modules before trying to load them.
# StatServ, maintain and report various networks statistics
#LOAD_MODULE statserv
# HostServ, vhost services for users
#LOAD_MODULE hostserv
# TextServ, text messaging service
#LOAD_MODULE textserv
# ConnectServ, monitor connections to the network: user connections, oper
# modes, server connections and nick changes.
#LOAD_MODULE connectserv
# Operlog, operator command logging service
#LOAD_MODULE operlog
# IRCdauth, authenticate users based on their user modes.
#LOAD_MODULE ircdauth
# Extauth, authenticate users based on nick!user@host access lists
#LOAD_MODULE extauth
# SecureServ. You must download and install SecureServ first.
#LOAD_MODULE secureserv
# OPSB. You must download and install OPSB first.
#LOAD_MODULE opsb
# LogServ. You must download and install LogServ first.
#LOAD_MODULE logserv
# TriviaServ. You must download and install TriviaServ first.
#LOAD_MODULE triviaserv
# WarServ. You must download and install WarServ first.
#LOAD_MODULE warserv
# GameServ. You must download and install GameServ first.
#LOAD_MODULE gameserv
# YahzteeServ. You must download and install YahzteeServ first.
#LOAD_MODULE yahtzeeserv
###############################################################################
## End of Configuration ##
###############################################################################
__EOF__
# Make it so ONLY the one who created the conf can read or write.
chmod 700 $NEOSTATSCONF
echo ""
echo "*------------------------------------------------*"
echo "| Thank you for choosing NeoStats. |"
echo "| You must now edit neostats.conf and check all |"
echo "| settings are correct then just type ./neostats |"
echo "| to run NeoStats. NeoStats will not run until |"
echo "| you do not edit this file. |"
echo "*------------------------------------------------*"
echo "| Check any external and third party modules you |"
echo "| wish to use (e.g. SecureServ) are compiled and |"
echo "| installed then add them to $NEOSTATSCONF for |"
echo "| them to load. |"
echo "*------------------------------------------------*"
echo "| **I CANT STRESS THIS ENOUGH, PLEASE READ THE** |"
echo "| **README FILE BEFORE ASKING FOR HELP!!!!! ** |"
echo "*------------------------------------------------*"
echo "| This file was updated by M (mark@ctcp.net) |"
echo "*------------------------------------------------*"
echo
exit 1