How To Run Choob

Minimum requirements

  • A copy of Sun's or IBM's JDK, at least version 1.6, in your path.
  • A working SQL server, preferably MySQL 4.1 or above. (You'll need the InnoDB table type)

Recommended extras

  • A copy of the svn toolset, or, on Windows, a copy of TortoiseSVN.

Getting ready to run the bot for the first time

  1. Checkout the source. See the documentation of your svn toolkit, or have a look at CheckingOutChoob, for information on how to do this.
  2. Create an account on the SQL server for the bot to use.
  3. Run the SQL script in db/choob.db on your server.
  4. 'cd' to the src directory.
  5. Ensure you have a 'bot.conf' in this directory. There is an bot.conf.example in the src directory, with comments. Make sure you substitute in sensible values.
  6. Execute the 'compile' script for your platform.

Running the bot

  1. Execute the 'run' script for your platform, from the src directory.

From Department of Computer Science, or on any 'compatible' linux machine

  • It's theoretically possible that the following script will automatically get Choob running.. it has worked many times in dcs.006.
  • It's worked on joshua, don't try this, it'll break horribly if anyone has run it.. probably since the machine was rebooted.
  • ~csuebl/gochoob.sh might work, too.
  • NB: Do not run this if you have a working mysql server/as root/on a system you care about.. it may damage something.
    #!/bin/bash
    _DIST="trunk"
    
    _MYSQL='mysql-standard-5.0.18-linux-i686-glibc23'
    if [ `ps aux | grep \`whoami\` | grep mysqld | wc -l` -le 5 ];
    then
            echo "MySQL appears not to be running..."
            cd /tmp
            if [ -r "mysql" ];
            then
                    echo -n "MySQL is installed, starting... "
                    cd mysql
                    ./bin/mysqld_safe --no-defaults &
                    sleep 3
                    echo "I'm assuming it's setup, if not, you may be screwed."
            else
                    wget -nc http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.0/$_MYSQL.tar.gz
                    tar zxvf $_MYSQL.tar.gz
                    mv $_MYSQL mysql
    
                    cd mysql
                    ./configure
    
                    echo "Mysqld might not have started, so let's not do anything for 10 seconds."
                    sleep 10
    
                    /tmp/mysql/bin/mysqladmin -h 127.0.0.1 -u root password 'choob'
                    echo "grant all on * to choob@127.0.0.1 identified by 'choob';" | mysql -h 127.0.0.1 -u root -pchoob
            fi
    fi
    
    echo "Checking out Choob..."
    cd /tmp
    svn co http://svn.uwcs.co.uk/repos/choob/ > svnspam
    
    echo "Overwriting db..."
    cd choob/$_DIST/db
    cat choob.db  | sed -e 's/drop database ch/drop database if exists ch/' | mysql -h 127.0.0.1 -u root -pchoob
    
    echo "Compiling..."
    cd ../src
    bash ./compile.sh
    chmod u+x ./compile.sh
    
    echo "Generating bot.conf.."
    
    cat bot.conf.example | sed -e "s/localhost/127.0.0.1/;s/SomeName/Choob$_NICKHAX|$RANDOM/" > bot.conf
    
    #if [ "$1" = "config" || "$2" = "config" ]
    #       $EDITOR bot.conf
    #fi
    
    echo "Running, hold Ctrl+C if you don't want to..."
    chmod u+x ./run.sh
    bash ./run.sh
    
    echo "Install script terminated, to run Choob again, 'cd /tmp/choob/$_DIST/src' and './run.sh'."