2 # You NEED the dialog program to use this!
7 BSVERSION="0.3 for BNC2.6.4"
12 rm -f $TMPFILE $RSLFILE $VHTFILE
18 echo "Writing your configuration to $SAVEFILE"
21 # BNCSetup $BSVERSION by IceWizard and pharos
22 # automaticly generated configuration file.
23 # edit the first line and chmod +x this file if you like to load bnc
24 # by running its .conf file
25 # Here are additional options you may add:
26 # C:6667 Default Irc Server Port to Connect to
27 # X:default.vhost.com Default Virtual Host to Use
28 # V:another.vhost.com Other Vhosts That Can Be Used
29 # V:different.vhost.com As Many Vhosts as You Want
30 # P:pid.bnc Name of PID File
31 # *NOTE PID file is required if bnc is to be
33 # L:bnc.log Name of Log File
34 # W:1 enable dynamic idents on servers with
36 # A:1:*.addy.net Allow list of ip addresses that can use BNC
38 D:$BNCPORT:$MAXUSERS:$BNCPASS
42 cat $TMPFILE $VHTFILE > $SAVEFILE
43 echo "Finished! You may now edit $SAVEFILE to make any special changes"
51 echo "Running alt configuration tool"
52 echo -n "Port to listen on> "
54 echo "How many users would you like to be allowed on BNC at the same time?"
55 echo "Please note, if you would like to allow unlimited users, enter a 0"
58 echo -n "Pick a password >"
60 echo -n "Pick a password for the superuser >"
66 if ! [ -e /usr/bin/bncmkpasswd ]
68 echo "You need to Make the package before you can use this script"
69 echo "(required /usr/bin/bncmkpasswd)"
73 echo "BAD\$" > $TMPFILE
74 echo "Test" | /usr/bin/bncmkpasswd -s >> $TMPFILE
75 CRCYS=$(cat $TMPFILE | grep '\$' | tail -1 )
78 if [ "BAD\$" = "$CRCYS" ]
82 echo "Your OS is using an unstandard Crypt lib, disabling encryption."
84 echo "Continuing script in 4 seconds"
90 if [ x$ERRORLEVEL != x0 ]
92 echo "You appear to not have the program named dialog"
93 echo "This script depends on it heavily"
100 cat << EOF > $TMPFILE
103 Written by IceWizard <ice@walt-disney.com>
104 Rewritten Pharos <Pharos@refract.com>
105 BNCSetup is a quick BNC conf generator
109 dialog --title "BNCSETUP by IceWizard" --msgbox "$(cat $TMPFILE)" 10 50
111 cat << EOF > $TMPFILE
112 What port would you like BNC to listen on?
113 This must be a number greater than 1024 and must not be in use.
118 while [ -z "$BNCPORT" ]
121 dialog --title "Port to listen on" --inputbox "$(cat $TMPFILE)" 10 68 "6669" 2> $RSLFILE
123 BNCPORT="$(head -1 $RSLFILE)"
124 if [ x$ERRORLEVEL = x1 ]
127 echo "BNC Configuration was cancelled..."
133 cat << EOF > $TMPFILE
134 How many users would you like to be allowed on BNC at the same time?
135 Please note, if you would like to allow unlimited users, enter a 0
140 while [ -z "$MAXUSERS" ]
142 dialog --title "Maximum users" --inputbox "$(cat $TMPFILE)" 10 78 "0" 2> $RSLFILE
144 MAXUSERS="$(head -1 $RSLFILE)"
145 if [ x$ERRORLEVEL = x1 ]
148 echo "BNC Configuration was cancelled..."
153 cat << EOF > $TMPFILE
154 Pick a password you would like to use for BNC?
155 This is the pass that will be used upon
162 while [ -z "$BNCPASS" ]
165 dialog --title "Pick a password" --inputbox "$(cat $TMPFILE)" 12 60 2> $RSLFILE
167 BNCPASS="$(head -1 $RSLFILE)"
168 if [ x$ERRORLEVEL = x1 ]
171 echo "BNC Configuration was cancelled..."
176 cat << EOF > $TMPFILE
177 Pick a superviser password you would like to use for BNC?
178 If you are the only person to use your BNC,
179 feel free to enter the same password.
184 while [ -z "$SUPERPASS" ]
186 dialog --title "Pick a superviser password" --inputbox "$(cat $TMPFILE)" 10 62 2> $RSLFILE
188 SUPERPASS="$(head -1 $RSLFILE)"
189 if [ x$ERRORLEVEL = x1 ]; then
191 echo "BNC Configuration was cancelled..."
199 dialog --yesno "Use encrypted passes in config file (Securety)" 5 60
202 if [ x$ERRORLEVEL = x0 ]
204 if [ -x /usr/bin/bncmkpasswd ]
206 SUPERPASS="+"$(echo "$SUPERPASS" | /usr/bin/bncmkpasswd -s)
207 BNCPASS="+"$(echo "$BNCPASS" | /usr/bin/bncmkpasswd -s)
210 echo "You have not did ./configure and make so there is no /usr/bin/bncmkpasswd"
211 echo "This program is required to produce the encryption"
218 dialog --radiolist "Choose Allow method" 10 70 3 \
219 "0" "Allow ANY ip to use bnc if they know the pass" "on" \
220 "1" "Go to menu for creating ip lists" "off" 2> $RSLFILE
222 if [ x$ERRORLEVEL = x1 ]; then
224 echo "BNC Configuration was cancelled..."
227 ERRORLEVEL="$(head -1 $RSLFILE)"
229 cat << EOF > $TMPFILE
230 Enter an IP to be allowed to use BNC.
231 this ip can include *'s and ?'s and other wildcard stuff.
232 enter q alone to end entering IP's
235 if [ x$ERRORLEVEL = x1 ]
238 while ! [ x$BDONE = xq ]
240 dialog --title "Enter Wildcard IP" --inputbox "$(cat $TMPFILE)" 10 62 2> $RSLFILE
241 BDONE="$(head -1 $RSLFILE)"
244 if ! [ x$BDONE = xq ]
246 echo "A:1:$BDONE" >> $VHTFILE
252 if ! [ -e "$VHTFILE" ]
254 echo "A:1:*" > $VHTFILE
258 cat << EOF > $TMPFILE
259 Enter a Default Vhost IP or DNS that bnc will use.
262 dialog --yesno "Enter a default Vhost to use?" 5 60
265 if [ x$ERRORLEVEL = x0 ]
267 dialog --title "Enter Default Vhost" --inputbox "$(cat $TMPFILE)" 10 62 2> $RSLFILE
268 BDONE="$(head -1 $RSLFILE)"
271 echo "X:$BDONE" >> $VHTFILE
275 dialog --yesno "Enter a list of Vhost possiblities?" 5 60
278 cat << EOF > $TMPFILE
279 Enter an Vhost that can be used by this bnc.
280 This has no bearing on how bnc functions but is simply
281 what is listed when the user does:
283 enter q alone to end entering IP's
286 if [ x$ERRORLEVEL = x0 ]
289 while ! [ x$BDONE = xq ]
291 dialog --title "Enter Vhost possibility" --inputbox "$(cat $TMPFILE)" 15 62 2> $RSLFILE
292 BDONE="$(head -1 $RSLFILE)"
295 if ! [ x$BDONE = xq ]
297 echo "V:$BDONE" >> $VHTFILE
304 dialog --yesno "Would you like bnc to log?" 5 60
307 cat << EOF > $TMPFILE
308 Pick a filename for bnc to write logging info into.
309 if you do not want to use the default
313 if [ x$ERRORLEVEL = x0 ]
315 dialog --title "Enter logfile Filename" --inputbox "$(cat $TMPFILE)" 10 62 "bnc.log" 2> $RSLFILE
316 BDONE="$(head -1 $RSLFILE)"
319 echo "L:$BDONE" >> $VHTFILE
323 dialog --yesno "Would you like bnc to display a motd?" 5 60
326 cat << EOF > $TMPFILE
327 Pick a filename for bnc to show as a motd
328 if you do not want to use the default
332 if [ x$ERRORLEVEL = x0 ]
334 dialog --title "Enter logfile Filename" --inputbox "$(cat $TMPFILE)" 10 62 "motd" 2> $RSLFILE
335 BDONE="$(head -1 $RSLFILE)"
338 echo "M:$BDONE" >> $VHTFILE
342 dialog --title "Requires Identwd to be installed." --yesno "Do you want bnc's dynamic ident support?" 5 60
344 if [ x$ERRORLEVEL = x0 ]
346 echo "W:1" >> $VHTFILE
352 cat << EOF > $TMPFILE
353 Pick a file to save the configuration in
354 if you do not want to use the default
359 while [ -z "$SAVEFILE" ]
361 dialog --title "Save as" --inputbox "$(cat $TMPFILE)" 10 45 "bnc.conf" 2> $RSLFILE
363 SAVEFILE="$(head -1 $RSLFILE)"
364 if [ x$ERRORLEVEL = x1 ]; then
366 echo "BNC Configuration was cancelled..."
371 if [ -e "$SAVEFILE" ]
373 echo "BNCsetup found a configuration file already... saving it as $SAVEFILE.old"
374 mv $SAVEFILE "$SAVEFILE".old