1#!/bin/sh
2
3# Configures the Darkbot
4
5echo
6echo "-------------------------------------------"
7echo "Don't worry if you misconfigure because you"
8echo "can always do it later from:"
9echo
10echo "/usr/local/etc/darkbot/configure"
11echo "-------------------------------------------"
12echo
13while [ -z "$EEDITOR" ]
14do
15	echo -n "Enter the name of the text editor you would like to use [pico]: "
16	read EEDITOR
17	if [ -z "$EEDITOR" ]; then
18		echo "No editor specified, defaulting to pico."
19		EEDITOR=pico
20fi
21done
22echo
23echo "You will need to build the setup.ini for Darkbot..."
24echo
25echo "Hit ENTER to continue."
26read x
27echo
28while [ -z "$NICK" ]
29do
30	echo -n "Enter the nickname you would like to use for your bot: "
31	read NICK
32	if [ -z "$NICK" ]; then
33		echo "Enter a nickname for your bot!"
34		sleep 1
35		echo
36fi
37done
38while [ -z "$USERID" ]
39do
40	echo -n "Enter the userid you would like to use [`whoami`]: "
41	read USERID
42	if [ -z "$USERID" ]; then
43		echo "No userid specified... defaulting to `whoami`"
44		USERID=`whoami`
45	fi
46done
47while [ -z "$CHAN" ]
48do
49	echo -n "Enter the channel $NICK should join: "
50	read CHAN
51	if [ -z "$CHAN" ]; then
52		echo "You must enter a channel!"
53		sleep 1
54		echo
55	fi
56done
57while [ -z "$REALNAME" ]
58do
59	echo -n "Enter the realname info for $NICK [default]: "
60	read REALNAME
61	if [ -z "$REALNAME" ]; then
62		echo "Using default realname.."
63		REALNAME="Download me from http://darkbot.net"
64	fi
65done
66while [ -z "$CMDCHAR" ]
67do
68	echo -n "Enter the command character $NICK should respond to [!]: "
69	read CMDCHAR
70	if [ -z "$CMDCHAR" ]; then
71		echo "No CMDCHAR specified, defaulting to !"
72		CMDCHAR=!
73	fi
74done
75while [ -z "$VHOST" ]
76do
77        echo -n "Enter the VHOST you want to use. If none, hit enter [0]:"
78        read VHOST
79        if [ -z "$VHOST" ]; then
80                echo "None entered. Will not use VHOST."
81                VHOST=0
82        fi
83done
84echo
85echo "Writing data settings to setup.ini ....."
86echo "NICK=$NICK" > dat/setup.ini
87echo "USERID=$USERID" >> dat/setup.ini
88echo "CHAN=$CHAN" >> dat/setup.ini
89echo "REALNAME=$REALNAME" >> dat/setup.ini
90echo "CMDCHAR=$CMDCHAR" >> dat/setup.ini
91echo "VHOST=$VHOST" >> dat/setup.ini
92echo "AUTOTOPIC=0" >> dat/setup.ini
93echo
94echo "Next you need to specify the server $NICK should connect to."
95echo
96while [ -z "$SERVER" ]
97do
98	echo
99	echo -n "Enter the server your bot should connect to [irc.superchat.org]: "
100	read SERVER
101	if [ -z "$SERVER" ]; then
102		echo "No server specified. defaulting to irc.superchat.org"
103		SERVER=irc.superchat.org
104	fi
105done
106while [ -z "$PORT" ]
107do
108	echo -n "Enter the port to connect to on $SERVER [6667]: "
109	read PORT
110	if [ -z "$PORT" ]; then
111		echo "No port specified, defaulting to 6667"
112		PORT=6667
113	fi
114done
115echo "$SERVER $PORT (Added: `date`)" > dat/servers.ini
116echo
117./Adduser
118