Line 1... |
Line 1... |
1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
# $Id: alcasar.sh 363 2010-12-06 23:05:27Z richard $
|
2 |
# $Id: alcasar.sh 364 2010-12-16 10:19:53Z franck $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
|
7 |
|
Line 643... |
Line 643... |
643 |
MYSQL="/usr/bin/mysql -uroot -p$mysqlpwd --exec"
|
643 |
MYSQL="/usr/bin/mysql -uroot -p$mysqlpwd --exec"
|
644 |
# On supprime les tables d'exemple
|
644 |
# On supprime les tables d'exemple
|
645 |
$MYSQL="DROP DATABASE IF EXISTS test;DROP DATABASE IF EXISTS tmp;CONNECT mysql;DELETE from user where user='';FLUSH PRIVILEGES;"
|
645 |
$MYSQL="DROP DATABASE IF EXISTS test;DROP DATABASE IF EXISTS tmp;CONNECT mysql;DELETE from user where user='';FLUSH PRIVILEGES;"
|
646 |
# On crée la base 'radius'
|
646 |
# On crée la base 'radius'
|
647 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_RADIUS;GRANT ALL ON $DB_RADIUS.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES"
|
647 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_RADIUS;GRANT ALL ON $DB_RADIUS.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES"
|
- |
|
648 |
# Ajout d'une base vierge
|
- |
|
649 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIR_CONF/radiusd-db-vierge.sql
|
648 |
FICSQL_LIBFREERADIUS=`find /etc/raddb/sql/mysql -type f -name schema.sql`
|
650 |
# FICSQL_LIBFREERADIUS=`find /etc/raddb/sql/mysql -type f -name schema.sql`
|
649 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $FICSQL_LIBFREERADIUS
|
651 |
# mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $FICSQL_LIBFREERADIUS
|
650 |
$MYSQL="connect $DB_RADIUS;ALTER table radpostauth DROP column pass;"
|
652 |
# $MYSQL="connect $DB_RADIUS;ALTER table radpostauth DROP column pass;"
|
651 |
# Ajout des tables de comptabilité journalière et mensuelle (accounting)
|
653 |
# Ajout des tables de comptabilité journalière et mensuelle (accounting)
|
652 |
DIRSQL_FREERADIUS=`find /usr/share/doc/freeradius-web* -type d -name mysql`
|
654 |
# DIRSQL_FREERADIUS=`find /usr/share/doc/freeradius-web* -type d -name mysql`
|
653 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/mtotacct.sql
|
655 |
# mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/mtotacct.sql
|
654 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/totacct.sql
|
656 |
# mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/totacct.sql
|
655 |
# correction d'un bug sur la table 'userinfo' avant import
|
657 |
# correction d'un bug sur la table 'userinfo' avant import
|
656 |
$SED "s?^ id int(10).*? id int(10) NOT NULL auto_increment,?g" $DIRSQL_FREERADIUS/userinfo.sql
|
658 |
# $SED "s?^ id int(10).*? id int(10) NOT NULL auto_increment,?g" $DIRSQL_FREERADIUS/userinfo.sql
|
657 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/userinfo.sql
|
659 |
# mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/userinfo.sql
|
658 |
# correction d'un bug sur la table 'badusers' avant import (elle reste inutilisée par Alcasar pour l'instant)
|
660 |
# correction d'un bug sur la table 'badusers' avant import (elle reste inutilisée par Alcasar pour l'instant)
|
659 |
#$SED "s?^ id int(10).*? id int(10) NOT NULL auto_increment,?g" $DIRSQL_FREERADIUS/badusers.sql
|
661 |
# #$SED "s?^ id int(10).*? id int(10) NOT NULL auto_increment,?g" $DIRSQL_FREERADIUS/badusers.sql
|
660 |
#mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/badusers.sql
|
662 |
# #mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIRSQL_FREERADIUS/badusers.sql
|
661 |
} # End init_db ()
|
663 |
} # End init_db ()
|
662 |
|
664 |
|
663 |
##########################################################################
|
665 |
##########################################################################
|
664 |
## Fonction param_radius ##
|
666 |
## Fonction param_radius ##
|
665 |
## - Paramètrage des fichiers de configuration FreeRadius ##
|
667 |
## - Paramètrage des fichiers de configuration FreeRadius ##
|