#!/bin/sh
###############################################################################
# Internetting Cooperating Programmers
# -----------------------------------------------------------------------------
#
# ____ PROJECT
# | _ \ __ _ _ __ ___ ___ _ __
# | | | |/ _` | '_ \ / __/ _ \ '__|
# | |_| | (_| | | | | (_| __/ |
# |____/ \__,_|_| |_|\___\___|_| the IRC bot
#
# All files in this archive are subject to the GNU General Public License.
#
# $Source: /cvsroot/dancer/dancer/installbot,v $
# $Revision: 1.2 $
# $Date: 2001/03/16 04:02:53 $
# $Author: holsta $
# $State: Exp $
# $Locker: $
#
# -----------------------------------------------------------------------------
###############################################################################
# Defaults
installdir=`expr \`pwd\` : '\(.*\)/.*'`"/bot"
nickpattern="Bot[|_|0]"
channel="#MisconfiguredBot"
server="bogus.irc.server"
realname="I am a bot, please kill me"
usernick="owner"
username=`logname`
username=${username:-"yourlogin"}
sitename=`expr \`hostname\` : '[^\.]*\.\(.*\)'`
sitename=${sitename:-"your.site"}
userhost=$username"@*."$sitename
while :
do
echo ---
echo " Enter directory name to put the Dancer bot files in."
echo " Do not put it in the same directory as the Dancer"
echo " distribution is in."
echo "(default is \"$installdir\")"
read inp
installdir=${inp:-$installdir}
echo ---
echo " Enter the nick pattern you want the bot to use."
echo " It should be of the style: Name[end1|end2|end3]"
echo " For example: Bot[|_|0] will first try Bot, then"
echo " Bot_, and finally Bot0."
echo " Please refer to the documentation for an exact"
echo " description."
echo "(default is \"$nickpattern\")"
read inp
nickpattern=${inp:-$nickpattern}
echo ---
echo " Enter channel name of the channel you want to run it in."
echo "(default is \"$channel\")"
read inp
channel=${inp:-$channel}
if [ `echo $channel | cut -c1` != "#" ]
then channel="#"$channel
fi
echo ---
echo " Enter the name of the primary server you want it to use."
echo " The syntax is server[:port[:passwd]]."
echo " For example:"
echo " server.irc"
echo " server.irc:6667"
echo " server.irc:6667:secret"
echo " Remember to ask for permission (write to /admin) before"
echo " you use the server."
echo "(default is \"$server\")"
read inp
server=${inp:-$server}
echo ---
echo " Enter the real name the bot is going to use."
echo "(default is \"$realname\")"
read inp
realname=${inp:-$realname}
echo ---
echo " Enter the nick you, as a bot owner, will use. This will"
echo " become your registered nick."
echo "(default is \"$usernick\")"
read inp
usernick=${inp:-$usernick}
echo ---
echo " Enter the hostpattern you, as a bot owner, will use."
echo " For example, if \"/whois\" on IRC says that you are"
echo " user@machine.site.domain you should choose"
echo " user@*.site.domain."
echo "(default is \"$userhost\")"
read inp
userhost=${inp:-$userhost}
echo
echo "--------------------"
echo "Install in \"$installdir\""
echo "Nick pattern \"$nickpattern\""
echo "On channel \"$channel\""
echo "Server \"$server\""
echo "Real name \"$realname\""
echo "Your nick \"$usernick\""
echo "Your hostpattern \"$userhost\""
echo "Is this correct? (y/N) "
cont=n
read cont
if [ "$cont" = "y" ]
then break
fi
done
echo making the dir $installdir...
mkdir $installdir
mkdir $installdir/script
echo copying some files...
if [ "$OSTYPE" = "cygwin" ]
then cp -p dancer.exe $installdir
else
cp -p dancer $installdir
fi
cp -p ./example/dancer.explain $installdir
cp -p ./script/* $installdir/script/
echo making your config file...
./dancer config | sed -e "s/^#server =.*/server = $server/g" -e "s/^#nick =.*/nick = $nickpattern/g" -e "s/^#channel =.*/channel = $channel/g" -e "s/^#name =.*/name = $realname/g" >$installdir/dancer.config
echo making your launch script...
cat ./launch.sh | sed -e "s:path=.*:path=\"$installdir\":g" >$installdir/launch.sh
chmod u+x $installdir/launch.sh
echo make a dancer.users...
echo "$usernick 242 (my email)" >$installdir/dancer.users
echo "!$userhost" >>$installdir/dancer.users
syntax highlighted by Code2HTML, v. 0.9.1