diff options
| author | Adam <Adam@anope.org> | 2011-09-25 04:19:15 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-09-25 04:19:15 -0400 |
| commit | 1f2399de364c09adcce4193895cd362d80ffdfc5 (patch) | |
| tree | 5f40fc531f22c174b6e10bb7bc12842a4a21d30b /src/bin/mydbgen | |
| parent | 43201ead9575a74e350710bc191f4ac67366aca7 (diff) | |
Added a new database format and sqlite support. Also moved db-convert to a module.
Diffstat (limited to 'src/bin/mydbgen')
| -rwxr-xr-x | src/bin/mydbgen | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/bin/mydbgen b/src/bin/mydbgen deleted file mode 100755 index 12bee8063..000000000 --- a/src/bin/mydbgen +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh -# - -# Location of the .sql file with the schema -DBSQL="tables.sql" - -# Schema Version -SVER="2" - -# Local Version, defaults to 0 -LVER="0" - -TFILE="/tmp/.anopedb.$$" - -if [ "`eval echo -n 'a'`" = "-n a" ] ; then - c="\c" -else - n="-n" -fi - -DBFILE=../data/$DBSQL - -if [ ! -f "./$DBFILE" ] ; then - echo "Error: Required file $DBSQL was not found!"; - exit -fi - -echo "" -echo "This script will guide you through the process of configuring your Anope" -echo "installation to make use of MySQL support. This script must be used for both" -echo "new installs as well as for upgrading for users who have a previous version" -echo "of Anope installed" - -while [ -z "$SQLHOST" ] ; do - echo "" - echo "What is the hostname of your MySQL server?" - echo $n "-> $c" - read cc - if [ ! -z "$cc" ] ; then - SQLHOST=$cc - fi -done - -while [ -z "$SQLUSER" ] ; do - echo "" - echo "What is your MySQL username?" - echo $n "-> $c" - read cc - if [ ! -z "$cc" ] ; then - SQLUSER=$cc - fi -done - -OLD_TTY=`stty -g` - -echo "" -echo "What is your MySQL password?" -echo $n "-> $c" -stty -echo echonl -read cc -SQLPASS_PREFIX="" -if [ ! -z "$cc" ] ; then - SQLPASS_PREFIX="-p" - SQLPASS=$cc -fi -stty $OLD_TTY - -mysqlshow -h$SQLHOST -u$SQLUSER $SQLPASS_PREFIX$SQLPASS >/dev/null 2>&1 -if test "$?" = "1" ; then - echo "Error: Unable to login, verify your login/password and hostname" - exit -fi - -while [ -z "$SQLDB" ] ; do - echo "" - echo "What is the name of the Anope SQL database?" - echo $n "-> $c" - read cc - if [ ! -z "$cc" ] ; then - SQLDB=$cc - fi -done - -MYSQLDUMP="mysqldump -h$SQLHOST -u$SQLUSER $SQLPASS_PREFIX$SQLPASS $SQLDB" -MYSQLSHOW="mysqlshow -h$SQLHOST -u$SQLUSER $SQLPASS_PREFIX$SQLPASS $SQLDB" -MYSQL="mysql -h$SQLHOST -u$SQLUSER $SQLPASS_PREFIX$SQLPASS $SQLDB" - -echo "" - -$MYSQLSHOW | grep -q $SQLDB -if test "$?" = "1" ; then - echo -n "Unable to find databse, creating... " - mysql -h$SQLHOST -u$SQLUSER $SQLPASS_PREFIX$SQLPASS -Bs -e "create database $SQLDB" >/dev/null 2>&1 - if test "$?" = "0" ; then - echo "done!" - else - echo "failed!" - FAILED="$FAILED 'database creation'" - fi -fi - -$MYSQL -Bs -e "show tables like 'anope_os_core'" | grep -q anope_os_core -if test "$?" = "1" ; then - echo -n "Unable to find Anope schema, creating... " - $MYSQL < $DBFILE - if test "$?" = "0" ; then - echo "done!" - else - echo "failed!" - FAILED="$FAILED 'schema creation'" - fi -else - echo "done!" -fi - -echo "" - -if [ $LVER -ne $SVER ]; then -echo -n "Inserting initial version number... " -$MYSQL -Bs -e "delete from anope_info" -echo "INSERT INTO anope_info (version, date) VALUES ($SVER, now())" > $TFILE -$MYSQL < $TFILE >/dev/null 2>&1 -if test "$?" = "0" ; then - echo "done!" -else - echo "failed!" - FAILED="$FAILED 'version insert'" -fi -fi - -rm -f $TFILE -if test "x$FAILED" = "x" ; then - # Try to find out more about this installation - SQLPORT="$(mysql_config --port 2> /dev/null)" - if test "$SQLPORT" = "0" ; then - SQLPORT=3306 - fi - echo "" - echo "Your MySQL setup is complete and your Anope schema is up to date. Make" - echo "sure you configure MySQL on your services.conf file prior to launching" - echo "Anope with MySQL support." - echo "" -else - echo "The following operations failed:" - echo "$FAILED" -fi - -exit |
