This commit is contained in:
Damien LASSERRE 2011-10-24 07:45:50 +00:00
parent 434aa5c4f9
commit d333d11201

View File

@ -1,25 +1,13 @@
#!/bin/bash
#This program as been create by Damien for Scores et decisions ste
#Email : dlasserre@scores-decisions.com
source parametres.sh
source function.sh
allVersion=("2.0.1" "0.9.9")
source='files/description.list'
echo ' ____ __ ____ __ '
echo '/\ _`\ /\ \ __ /\ _`\ /\ \__ '
echo '\ \,\L\_\ _____\ \ \___ /\_\ ___ __ _ \ \ \L\_\ __ ___ __ _ __ __ \ \ ,_\ ___ _ __ '
echo ' \/_\__ \ /\ __` \ \ _ `\/\ \ / _ `\ /\ \/ \ \ \ \L_L / __`\/ _ `\ / __`\/\` __\/ __`\ \ \ \/ / __`\/\` __\'
echo ' /\ \L\ \ \ \L\ \ \ \ \ \ \ \/\ \/\ \\/> </ \ \ \/, \/\ __//\ \/\ \/\ __/\ \ \//\ \L\.\_\ \ \_/\ \L\ \ \ \/ '
echo ' \ `\____\ \ ,__/\ \_\ \_\ \_\ \_\ \_\/\_/\_\ \ \____/\ \____\ \_\ \_\ \____\\ \_\\ \__/.\_\\ \__\ \____/\ \_\ '
echo ' \/_____/\ \ \/ \/_/\/_/\/_/\/_/\/_/\//\/_/ \/___/ \/____/\/_/\/_/\/____/ \/_/ \/__/\/_/ \/__/\/___/ \/_/ '
echo ' \ \_\ '
echo ' \/_/ '
#This program as been create by Damien for Scores et decisions ste
#Email : dlasserre@scores-decisions.com
#if [ man page exist ! ]
# download ans install man page !
if [ `id -u` = 0 ] #Need Root or Sudo
then
commande=('--configure' '--install' '--all')
@ -29,7 +17,7 @@ then
`man SphinxHelp` #en cours de création du man !
;;
'--delete')
`rm -r indexeConf source sphinx-* wget* libste* *~ 2> /dev/null`
`rm -r indexeConf tmp sphinx-* wget* libste* *~ 2> /dev/null`
echo -e "- Clean directory"
exit
;;
@ -43,12 +31,16 @@ then
if [ ! -e indexeConf ];then `mkdir indexeConf`; indexeConf="Success"; fi
`touch indexeConf/sphinx.conf`
sphinxconf="Success"
if [ ! -e source ];then `mkdir source`; source="Success"; fi
if [ ! -e /dbs ];then `mkdir /dbs`; dbs="Success"; fi
if [ ! -e /dbs/sphinx ];then `mkdir /dbs/sphinx`; sphinx="Success"; fi
#repertoire temporaire.
if [ ! -e tmp ];then `mkdir tmp`; fi
##
if [ ! -e /dbs/sphinx ];then `mkdir /dbs/sphinx`; sphinx="Success"; fi
if [ ! -e /dbs/sphinxlog ];then `mkdir /dbs/sphinxlog`; sphinxlog="Success"; fi
if [ ! -e /init.d/sphinxsearch ];then `cp files/sphinxsearch /etc/init.d/; update-rc.d sphinxsearch defaults`;sphinxinit="Success"; fi
#Check if package in directory, if you want to download manually the package
#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
if [ ! -z $2 ]; then
@ -69,40 +61,39 @@ then
exit
fi
fi
`tar -z -xf sphinx-$version.tar.gz -C source `
`tar -z -xf sphinx-$version.tar.gz -C tmp `
`rm sphinx-$version.tar.gz*`
echo -e " - Extract files..."
echo -e " - Complited"
#If libstemmer not installed in source/
#If libstemmer not installed in tmp/
if [ -e libstemmer_c.tgz ]
then
echo -e $CYAN"Extract file from libstemmer_c..."$NORMAL
`cd source/sphinx-$version ; tar -zxf libstemmer_c.tgz`
`cd tmp/sphinx-$version ; tar -zxf libstemmer_c.tgz`
echo -e " - Complited"
else
echo -e $CYAN"Download and Configure libstemmer..."$NORMAL
`cd source/sphinx-$version ; wget -b http://snowball.tartarus.org/dist/libstemmer_c.tgz > /dev/null`
`cd tmp/sphinx-$version ; wget -b http://snowball.tartarus.org/dist/libstemmer_c.tgz > /dev/null`
loadIndication `(ps -C wget -o pid=)`
fi
echo -e "- Extract files..."
`cd source/sphinx-$version ; tar -zxf libstemmer_c.tgz`
`cd tmp/sphinx-$version ; tar -zxf libstemmer_c.tgz`
echo -e "- Complited"
`cd source/sphinx-$version ; rm libstemmer_c.tgz`
`cd tmp/sphinx-$version ; rm libstemmer_c.tgz`
libstemmer="100%"
echo ""
echo -e $CYAN"Configuration progress..."$ROUGE
`cd source/sphinx-$version ; sh configure --with-libstemmer --prefix=/usr/local/sphinx 1> /dev/null `
`cd tmp/sphinx-$version ; sh configure --with-libstemmer --prefix=/usr/local/sphinx 1> /dev/null `
echo -e $NORMAL"- Complited"
echo -e $NORMAL
echo -e $CYAN"Compilation progress..."$ROUGE
if [ $version != "2.0.1-beta" ];then `cd source/sphinx-$version ; make ` ;fi
if [ $version != "2.0.1-beta" ];then `cd tmp/sphinx-$version ; make ` ;fi
#Make and install binary.
#`cd source/sphinx-$version/ ; make install 1> /dev/null`
#`cd tmp/sphinx-$version/ ; make install 1> /dev/null`
echo -e $NORMAL" - Complited"
echo ""
echo -e $CYAN"Visualisation"$NORMAL
echo -e "---------------------------------------------------------------------------------------"
echo -e "1. Directory : source " $VERT $source $NORMAL
echo -e "2. Directory : indexeConf " $VERT $indexeConf $NORMAL
echo -e "3. Directory : /dbs " $VERT $dbs $NORMAL
echo -e "4. Directory : /dbs/sphinx " $VERT $sphinx $NORMAL
@ -118,8 +109,8 @@ then
fi
fi
echo -e "10. Archive : libstemmer_c.tgz " $VERT $libstemmer $NORMAL
echo -e "11. Compilation : /source/sphinx-$version/src/libstemmer_c "$VERT"Compiled" $NORMAL
echo -e "12. Compilation : /source/sphinx-$version/src/ "$VERT"Complited" $NORMAL
echo -e "11. Compilation : tmp/sphinx-$version/src/libstemmer_c "$VERT"Compiled" $NORMAL
echo -e "12. Compilation : tmp/sphinx-$version/src/ "$VERT"Complited" $NORMAL
echo -e $VERT"Directory and Files as beens creates\n" $NORMAL
echo -n "Machine MASTER ? (y/n) : "; read response
@ -144,8 +135,8 @@ then
`cat files/config.sphinx >> indexeConf/sphinx.conf`
`cp indexeConf/sphinx.conf .`
fi
`cp source/sphinx-$version/src/searchd /usr/bin/`;
`cp source/sphinx-$version/src/indexer /usr/bin/`;
`cp tmp/sphinx-$version/src/searchd /usr/bin/`;
`cp tmp/sphinx-$version/src/indexer /usr/bin/`;
`cp sphinx.conf /usr/local/sphinx/etc/`;
echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL
exit