Blame view
install.sh
7.68 KB
e6be5137b reinitialized pro... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
#!/bin/bash #-------------------# # Install script # # OTMEDIA # #-------------------# # Color variables txtgrn=$(tput setaf 2) # Green txtylw=$(tput setaf 3) # Yellow txtblu=$(tput setaf 4) # Blue txtpur=$(tput setaf 5) # Purple txtcyn=$(tput setaf 6) # Cyan txtwht=$(tput setaf 7) # White txtrst=$(tput sgr0) # Text reset. #/color # ### Global Variables # PWD=$(pwd) OTMEDIA_HOME=$PWD test=$(arch) if [ "$test" == "x86_64" ]; then ARCH=".64"; else ARCH=""; fi #/Global # # Put to 0 to disable dependencies of a pass # and 1 to enable # PASS1=1 # First Pass PASS2=1 # Second Pass CONFPASS=1 # Confidence Pass EXPLOITCONFPASS=1 # SOLR query and trigg echo -e " Will do install for :" if [ $PASS1 -eq 1 ];then echo "- Pass 1";fi if [ $PASS2 -eq 1 ];then echo "- Pass 2";fi if [ $CONFPASS -eq 1 ];then echo "- Confidence Pass";fi if [ $EXPLOITCONFPASS -eq 1 ];then echo "- Exploit Confidence Pass";fi # ### CHECK Dependencies ### # echo -e " \t${txtblu}Check Dependencies${txtrst} " ## make test=$(whereis make) if [ "$test" == "make:" ] then echo -e "${txtpur}ERROR${txtrst} make not found You have to install make sudo apt-get install make" exit 1; fi echo -e "make \t ${txtgrn}OK${txtrst}" ## CC test=$(whereis cc) if [ "$test" == "cc:" ] then echo -e "${txtpur}ERROR${txtrst} cc not found You have to install cc sudo apt-get install gcc" exit 1; fi echo -e "cc \t ${txtgrn}OK${txtrst}" ## AVCONV test=$(whereis avconv) if [ "$test" == "avconv:" ] then echo -e "${txtpur}ERROR${txtrst} avconv not found You have to install avconv sudo apt-get install libav-tools" exit 1; fi echo -e "libav-tools : avconv \t ${txtgrn}OK${txtrst}" ## JAVA test=$(whereis java) if [ "$test" == "java:" ] then echo -e "${txtpur}ERROR${txtrst} java not found You have to install java JRE sudo apt-get install openjdk-7-jre" exit 1; fi echo -e "Java : JRE \t ${txtgrn}OK${txtrst}" test=$(whereis javac) if [ "$test" == "javac:" ] then echo -e "${txtpur}ERROR${txtrst} javac not found You have to install java JDK sudo apt-get install openjdk-7-jdk" exit 1; fi echo -e "Java : JDK \t ${txtgrn}OK${txtrst}" if [ $EXPLOITCONFPASS -eq 1 ] then ## Python test=$(whereis python) if [ "$test" == "python:" ] then echo -e "${txtpur}ERROR${txtrst} python not found You have to install python sudo apt-get install python" exit 1; fi echo -e "python : \t ${txtgrn}OK${txtrst}" fi ## Perl test=$(whereis perl) if [ "$test" == "perl:" ] then echo -e "${txtpur}ERROR${txtrst} perl not found You have to install perl sudo apt-get install perl" exit 1; fi echo -e "perl : \t ${txtgrn}OK${txtrst}" ## iconv test=$(whereis iconv) if [ "$test" == "iconv:" ] then echo -e "${txtpur}ERROR${txtrst} iconv not found You have to install iconv sudo apt-cache search iconv" exit 1; fi echo -e "iconv : \t ${txtgrn}OK${txtrst}" ## csh shell test=$(whereis csh) if [ "$test" == "csh:" ] then echo -e "${txtpur}ERROR${txtrst} csh shell not found You have to install csh shell sudo apt-get install csh" exit 1; fi echo -e "csh shell : \t ${txtgrn}OK${txtrst}" ## SRI LM if [ -z "$SRILM" ] && [ -z "$MACHINE_TYPE" ] then echo -e "${txtpur}ERROR${txtrst} SRILM toolkit variables are not defined (SRILM and MACHINE_TYPE) You have to install SRILM Toolkit " exit 1; fi export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE echo -e "SRILM toolkit : \t ${txtgrn}OK${txtrst}" ### Speeral Configuration ### echo -e "\t${txtblu}Generating Speeral configuration files :${txtrst} " cat $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ > $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml echo $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml cat $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ > $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml echo $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml cat $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ > $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml echo $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml if [ $EXPLOITCONFPASS -eq 1 ] then ### LIA ltbox ### echo -e "\t${txtblu}Install lia_ltbox${txtrst} " export LIA_TAGG_LANG="french" export LIA_TAGG="$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/" export LIA_PHON_REP="$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/" export LIA_BIGLEX="$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/" ### config lia_phon cd $LIA_PHON_REP make all > /dev/null make ressource > /dev/null ### config lia_tagg cd $LIA_TAGG make all > /dev/null make ressource.french > /dev/null ### config lia_biglex cd $LIA_BIGLEX make -f makefile.biglex > /dev/null cd $OTMEDIA_HOME ### SOLR DB ### # Tomcat fisrtly test=$(dpkg -l | grep "^ii" | grep tomcat) if [ "$test" == "" ] then echo -e "${txtpur}ERROR${txtrst} TOMCAT seems to not be installed) You have to install TOMCAT " exit 1; fi echo -e " TOMCAT : \t ${txtgrn}OK${txtrst}" # SOLR secondly echo -e "\t${txtblu}Install SOLR DB${txtrst}" echo -e "Unzip SOLR DB\r" #res = $(tar -xvzf "$OTMEDIA_HOME/tools/SOLR/otmedia-2013-04.tgz" "$OTMEDIA_HOME/tools/SOLR/") if [ $res -eq 2 ]; then echo " ${txtpur}NOT OK${txtrst}"; else echo " ${txtgrn}OK${txtrst}"; fi read -p "Enter SOLR server IP :" ip if [ $ip == "" ];then ip="127.0.0.1";fi echo 'machine = "194.57.216.43"' > $OTMEDIA_HOME/tools/scripts/solrinfo.py read -p "Enter SOLR server port :" port if [ $port == "" ]; then port="8080";fi echo " \tSOLR server IP $ip" echo "\tSOLR server port $port" echo 'port = "8080"' >> $OTMEDIA_HOME/tools/scripts/solrinfo.py fi ### Set Variables in bashrc ### cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" > ~/.bashrc.org #cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" | grep -v "LIA_TAGG" | grep -v "LIA_PHON" | grep -v "LIA_BIGLEX" > ~/.bashrc.org cp ~/.bashrc.org ~/.bashrc export OTMEDIA_HOME=$PWD echo "export OTMEDIA_HOME=$PWD" >> ~/.bashrc echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE" >> ~/.bashrc #echo "export LIA_TAGG_LANG=french" >> ~/.bashrc #echo "export LIA_TAGG=$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/" >> ~/.bashrc #echo "export LIA_PHON_REP=$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/" >> ~/.bashrc #echo "export LIA_BIGLEX=$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/" >> ~/.bashrc # set global configuration file echo "OTMEDIA_HOME=$PWD" > $OTMEDIA_HOME/cfg/main_cfg.cfg echo "ARCH=$ARCH" >> $OTMEDIA_HOME/cfg/main_cfg.cfg echo "VERBOSE=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg echo "DEBUG=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg echo "CHECK=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg echo "RERUN=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg echo -e " \t${txtgrn}### Install completed ###${txtrst} " echo -e "do : source ~/.bashrc" echo -e "or set variable : " echo "export OTMEDIA_HOME=$PWD" echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE" |