#!/bin/sh
# Aviation Config file maker (c) 1998 by Mixter
# usage: ./mkconf [config-file] [eggdrop-executable]
if test -z $2 ; then
echo "usage: ./mkconf [config-file] [eggdrop-executable]" ; exit ; fi
if [ -f $1 ] ; then echo "I refuse to overwrite "$1" :P" ; exit ; fi
if [ ! -f $2 ] ; then echo "Doh, "$2" doesnt exist." ; exit ; fi
conf=$1
eggname=$2
printf "\n\taviation config v2.0 by Mixter\n"
> $conf ; chmod 755 $conf
echo \#\!`pwd`/$eggname >> $conf
printf "Bot nick [lamestbot]: " ; read fd
if test ! -z $fd ; then echo set nick1 \"$fd\" >> $conf
mv userfile userfile.$fd ; fi
if test -z $fd ; then echo set nick1 \"lamestbot\" >> $conf
mv userfile userfile.lamestbot ; fi
printf "Bot ident ["`whoami`"]: " ; read fd
if test ! -z $fd ; then echo set username \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set username \"`whoami`\" >> $conf ; fi
printf "Bot ircname [random]: " ; read fd
if test ! -z "$fd" ; then echo set realname \"$fd\" >> $conf ; fi
printf "Bot owner [Mixter]: " ; read fd
if test ! -z $fd ; then echo set owner \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set owner \"Mixter\" >> $conf ; fi
printf "Listening ports(all) [12345]: " ; read fd
if test ! -z $fd ; then echo set allport \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set allport \"12345\" >> $conf ; fi
printf "Listening ports(users) [none]: " ; read fd
if test ! -z $fd ; then echo set useport \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set useport \"0\" >> $conf ; fi
printf "Listening ports(bots) [none]: " ; read fd
if test ! -z $fd ; then echo set botport \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set botport \"0\" >> $conf ; fi
printf "Bots channels [#us-opers]: " ; read fd
if test ! -z $fd ; then echo set botchans \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set botchans \"#us-opers\" >> $conf ; fi
printf "IRC Network [EFNET]: " ; read fd
if test ! -z $fd ; then echo set network \"$fd\" >> $conf ; fi
if test -z $fd ; then echo set network \"EFNET\" >> $conf ; fi
echo source aviation.tcl >> $conf
printf "done\ntype \"crontab cron\" to activate crontab\n"
printf "NOTICE: Make sure to put an exec ./"$1" into your CONF\n"
printf "type \"./bchk\" or \"./"$conf"\" to start the bot manually\n"
exit 0
