#!/bin/sh
printf "\taviation setup v1.6 by Mixter\n"
printf "This script will make sure you have everything installed & compiled.\nRun this AFTER compiling eggdrop, then edit avi.conf.\n"
printf "Also, make sure to rename userfile to userfile.YourBot if you dont want\nto start with -m, which is sometimes not working.\n"
printf "We will also rename eggdrop to av and put it on crontab automatically, if \nyou dont want that, edit the setup file first.\n"
printf "\nsearching for eggdrop... "
if test ! -r eggdrop ;then
printf "not found\n\nplease compile eggdrop AND the modules first\n"
printf "because this script removes unneccessary files like source\n"
exit 1
fi
printf "found\nsearching for aviation.tcl... "
if test ! -r aviation.tcl ;then
printf "not found\n\n---STOP---\n"
exit 1
fi
printf "found\nsearching for quench.c... "
if test ! -r quench.c ;then
printf "not found\n\n---STOP---\n"
exit 1
fi
printf "found\ncompiling... "
cc quench.c -o quench
strip quench;chmod 500 quench
if test ! -r quench ;then
printf "error :/\n"
exit 1
fi
printf "done\nsearching for avi.conf... "
if test ! -r avi.conf ;then
printf "no configfile?\ncreating it... "
cat >avi.conf<<EOF
#!./av
set nick1 "nickname"
set username "[exec whoami]"
set realname "* I'm to lame to read BitchX.doc *"
set owner "Mixter"
set allport "12345"
set useport "0"
set botport "0"
set botchans "#aviation"
set network "EFNET"
source aviation.tcl
EOF
fi
chmod +x avi.conf
printf "ok\nremoving unneccessary files, ctrl-c to abort... "
sleep 5
rm -rf .* C* D* E* F* I* M* N* R* config* doc eggdrop.* 1>/dev/null 2>/dev/null
rm -rf *log klines lush.* motd pid.* *.c o* scripts src 1>/dev/null 2>/dev/null
printf "done\nrenaming eggdrop to ed... "
mv eggdrop ed
printf "done\nnow edit avi.conf\n"
printf "5,15,25,35,45,55 * * * *   "`pwd`"/avi.cron >/dev/null 2>&1\n">ctab
crontab ctab
crontab -l
exit 0
