This commit is contained in:
Damien LASSERRE 2011-10-31 09:53:31 +00:00
parent 8a1ee1e691
commit 903dc305f3

View File

@ -2,6 +2,36 @@
#This program as been create by Damien for Scores et decisions ste
#Email : dlasserre@scores-decisions.com
allVersion=("2.0.1" "0.9.9")
declare -A ERREURS
declare -A ASTUCES
#Color declaration
ROUGE="\\033[1;31m"
NORMAL="\\033[0;39m"
CYAN="\\033[1;36m"
VERT="\\033[1;32m"
BOLD="\\033[1m"
UNDERLINE="\\033[4m"
TEXTNONE="\\033[0m"
#Var
dir="Exist"
log="Exist"
dbs="Exist"
sphinx="Exist"
sphinxlog="Exist"
#Tab of erreurs and astuces
ERREURS=(
["CHMOD"]="Execute the script with SUDO or in ROOT"
["DIRECTORY"]="Directory not create"
["FILE"]= ""
["CMD"]="This command not exist"
["NOCMD"]="Please enter options")
ASTUCES=(
["CREATE"]="Sphinx --create (prepare l'environement)");
function loadIndication() {
while [ -d "/proc/$1" ]
@ -38,9 +68,10 @@ then
##
if [ ! -e /dbs/sphinx ];then echo -e "/dbs/sphinx Doesn't exist !"; exit; fi
if [ ! -e /dbs/sphinxlog ];then echo -e "/dbs/sphinxlog Doesn't exist !"; exit; fi
if [ ! -e /usr/local/sphinx ];then echo -e "/usr/local/sphinx Doesn't exist !"; exit; fi
if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/; update-rc.d sphinxsearch defaults`; fi
if [ ! -e /dbs/sphinxlog ];then `mkdir /dbs/sphinxlog`; exit; fi
if [ ! -e /usr/local/sphinx ];then `mkdir /dbs/sphinx`; exit; fi
if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/; chmod +x /etc/init.d/sphinxsearch ;update-rc.d sphinxsearch defaults`; fi
if [ ! -e config/${HOSTNAME} ];then `mkdir config/${HOSTNAME}`;fi
#Check if package in directory, if you want to download manually the package
if [ ! -e sphinx-2.0.1.tar.gz ] || [ ! -e sphinx-0.9.9.tar.gz ]
then
@ -87,20 +118,36 @@ then
echo -e $NORMAL"- Complited"
echo -e $NORMAL
echo -e $CYAN"Compilation progress..."$ROUGE
#if [ $version != "2.0.1-beta" ];then `cd tmp/sphinx-$version ; make ` ;
#if [ $version != "2.0.1-beta" ];then `cd tmp/sphinx-$version ; make; make install ` ;
#else
#`cd tmp/sphinx-$version/ ; make install 1> /dev/null`;fi
#`cd tmp/sphinx-$version/ ; make; make install`;fi
echo -e $NORMAL" - Complited"
echo -n "Machine MASTER ? (y/n) : "; read response
`touch /usr/local/sphinx/sphinx.conf`;
`cat config/${HOSTNAME}/sphinx.conf > /usr/local/sphinx/sphinx.conf`;
if [ $response = 'y' ];then
echo -e $ROUGE"Mode MASTER activated"$NORMAL
`cat config/${HOSTNAME}/*.conf-MysqlServer >> /usr/local/sphinx/sphinx.conf`;
else
echo -e $ROUGE"Mode SLAVE activated"$NORMAL
`cat config/${HOSTNAME}/*.conf-MysqlServerSlave >> /usr/local/sphinx/sphinx.conf`;
fi
`touch /usr/local/sphinx/sphinx.conf`;
echo -e $ROUGE"Mode MASTER activated"$NORMAL
echo -e "Tapez 'stop' pour quiter l'invite de création des indexes"
while [ indexe != "stop\n" ]; do
echo -e " Entrez indexe : "; read indexe
if [ $response = 'y' ];then
if [ -e config/base/Master/$indexe.conf-MysqlServer ]
then
`cp config/base/Master/$indexe.conf-MysqlServer config/${HOSTNAME}/`
echo -e "Indexe $indexes as been create !";
else
break;
fi
else
if [ -e config/base/Slave/$indexe.conf-MysqlServer ]
then
`cp config/base/Slave/$indexe.conf-MysqlServer config/${HOSTNAME}/`
echo -e "Indexe $indexes as been create !";
else
break;
fi
fi
done;
`cat config/base/sphinx.conf > /usr/local/sphinx/sphinx.conf `;
`cat config/${HOSTNAME}/*.conf-MysqlServer >> /usr/local/sphinx/sphinx.conf`;
echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL
exit
;;