Commit 630a18786e1f92f097d4df348f91193435ef6b16

Authored by Jean-François Rey
1 parent bc77cbdb10
Exists in master

YesIRastafari

Showing 2 changed files with 14 additions and 2 deletions Inline Diff

1 #!/bin/bash 1 #!/bin/bash
2 2
3 #-------------------# 3 #-------------------#
4 # Install script # 4 # Install script #
5 # OTMEDIA # 5 # OTMEDIA #
6 #-------------------# 6 #-------------------#
7 7
8 # Color variables 8 # Color variables
9 txtgrn=$(tput setaf 2) # Green 9 txtgrn=$(tput setaf 2) # Green
10 txtylw=$(tput setaf 3) # Yellow 10 txtylw=$(tput setaf 3) # Yellow
11 txtblu=$(tput setaf 4) # Blue 11 txtblu=$(tput setaf 4) # Blue
12 txtpur=$(tput setaf 5) # Purple 12 txtpur=$(tput setaf 5) # Purple
13 txtcyn=$(tput setaf 6) # Cyan 13 txtcyn=$(tput setaf 6) # Cyan
14 txtwht=$(tput setaf 7) # White 14 txtwht=$(tput setaf 7) # White
15 txtrst=$(tput sgr0) # Text reset. 15 txtrst=$(tput sgr0) # Text reset.
16 #/color 16 #/color
17 17
18 # 18 #
19 ### Global Variables 19 ### Global Variables
20 # 20 #
21 PWD=$(pwd) 21 PWD=$(pwd)
22 OTMEDIA_HOME=$PWD 22 OTMEDIA_HOME=$PWD
23 test=$(arch) 23 test=$(arch)
24 if [ "$test" == "x86_64" ]; then ARCH=".64"; else ARCH=""; fi 24 if [ "$test" == "x86_64" ]; then ARCH=".64"; else ARCH=""; fi
25 #/Global 25 #/Global
26 26
27 27
28 # 28 #
29 # Put to 0 to disable dependencies of a pass 29 # Put to 0 to disable dependencies of a pass
30 # and 1 to enable 30 # and 1 to enable
31 # 31 #
32 PASS1=1 # First Pass 32 PASS1=1 # First Pass
33 PASS2=1 # Second Pass 33 PASS2=1 # Second Pass
34 CONFPASS=1 # Confidence Pass 34 CONFPASS=1 # Confidence Pass
35 EXPLOITCONFPASS=1 # SOLR query and trigg 35 EXPLOITCONFPASS=1 # SOLR query and trigg
36 36
37 echo -e "\nWill do install for :" 37 echo -e "\nWill do install for :"
38 if [ $PASS1 -eq 1 ];then echo "- Pass 1";fi 38 if [ $PASS1 -eq 1 ];then echo "- Pass 1";fi
39 if [ $PASS2 -eq 1 ];then echo "- Pass 2";fi 39 if [ $PASS2 -eq 1 ];then echo "- Pass 2";fi
40 if [ $CONFPASS -eq 1 ];then echo "- Confidence Pass";fi 40 if [ $CONFPASS -eq 1 ];then echo "- Confidence Pass";fi
41 if [ $EXPLOITCONFPASS -eq 1 ];then echo "- Exploit Confidence Pass";fi 41 if [ $EXPLOITCONFPASS -eq 1 ];then echo "- Exploit Confidence Pass";fi
42 42
43 # 43 #
44 ### CHECK Dependencies ### 44 ### CHECK Dependencies ###
45 # 45 #
46 echo -e "\n\t${txtblu}Check Dependencies${txtrst}\n" 46 echo -e "\n\t${txtblu}Check Dependencies${txtrst}\n"
47 47
48 ## make 48 ## make
49 test=$(whereis make) 49 test=$(whereis make)
50 if [ "$test" == "make:" ] 50 if [ "$test" == "make:" ]
51 then 51 then
52 echo -e "${txtpur}ERROR${txtrst} make not found\n You have to install make\n sudo apt-get install make" 52 echo -e "${txtpur}ERROR${txtrst} make not found\n You have to install make\n sudo apt-get install make"
53 exit 1; 53 exit 1;
54 fi 54 fi
55 echo -e "make \t ${txtgrn}OK${txtrst}" 55 echo -e "make \t ${txtgrn}OK${txtrst}"
56 56
57 ## CC 57 ## CC
58 test=$(whereis cc) 58 test=$(whereis cc)
59 if [ "$test" == "cc:" ] 59 if [ "$test" == "cc:" ]
60 then 60 then
61 echo -e "${txtpur}ERROR${txtrst} cc not found\n You have to install cc\n sudo apt-get install gcc" 61 echo -e "${txtpur}ERROR${txtrst} cc not found\n You have to install cc\n sudo apt-get install gcc"
62 exit 1; 62 exit 1;
63 fi 63 fi
64 echo -e "cc \t ${txtgrn}OK${txtrst}" 64 echo -e "cc \t ${txtgrn}OK${txtrst}"
65 65
66 ## AVCONV 66 ## AVCONV
67 test=$(whereis avconv) 67 test=$(whereis avconv)
68 if [ "$test" == "avconv:" ] 68 if [ "$test" == "avconv:" ]
69 then 69 then
70 echo -e "${txtpur}ERROR${txtrst} avconv not found\n You have to install avconv\n sudo apt-get install libav-tools" 70 echo -e "${txtpur}ERROR${txtrst} avconv not found\n You have to install avconv\n sudo apt-get install libav-tools"
71 exit 1; 71 exit 1;
72 fi 72 fi
73 echo -e "libav-tools : avconv \t ${txtgrn}OK${txtrst}" 73 echo -e "libav-tools : avconv \t ${txtgrn}OK${txtrst}"
74 74
75 ## JAVA 75 ## JAVA
76 test=$(whereis java) 76 test=$(whereis java)
77 if [ "$test" == "java:" ] 77 if [ "$test" == "java:" ]
78 then 78 then
79 echo -e "${txtpur}ERROR${txtrst} java not found\n You have to install java JRE\n sudo apt-get install openjdk-7-jre" 79 echo -e "${txtpur}ERROR${txtrst} java not found\n You have to install java JRE\n sudo apt-get install openjdk-7-jre"
80 exit 1; 80 exit 1;
81 fi 81 fi
82 echo -e "Java : JRE \t ${txtgrn}OK${txtrst}" 82 echo -e "Java : JRE \t ${txtgrn}OK${txtrst}"
83 test=$(whereis javac) 83 test=$(whereis javac)
84 if [ "$test" == "javac:" ] 84 if [ "$test" == "javac:" ]
85 then 85 then
86 echo -e "${txtpur}ERROR${txtrst} javac not found\n You have to install java JDK\n sudo apt-get install openjdk-7-jdk" 86 echo -e "${txtpur}ERROR${txtrst} javac not found\n You have to install java JDK\n sudo apt-get install openjdk-7-jdk"
87 exit 1; 87 exit 1;
88 fi 88 fi
89 echo -e "Java : JDK \t ${txtgrn}OK${txtrst}" 89 echo -e "Java : JDK \t ${txtgrn}OK${txtrst}"
90 90
91 if [ $EXPLOITCONFPASS -eq 1 ] 91 if [ $EXPLOITCONFPASS -eq 1 ]
92 then 92 then
93 ## Python 93 ## Python
94 test=$(whereis python) 94 test=$(whereis python)
95 if [ "$test" == "python:" ] 95 if [ "$test" == "python:" ]
96 then 96 then
97 echo -e "${txtpur}ERROR${txtrst} python not found\n You have to install python\n sudo apt-get install python" 97 echo -e "${txtpur}ERROR${txtrst} python not found\n You have to install python\n sudo apt-get install python"
98 exit 1; 98 exit 1;
99 fi 99 fi
100 echo -e "python : \t ${txtgrn}OK${txtrst}" 100 echo -e "python : \t ${txtgrn}OK${txtrst}"
101 fi 101 fi
102 102
103 ## Perl 103 ## Perl
104 test=$(whereis perl) 104 test=$(whereis perl)
105 if [ "$test" == "perl:" ] 105 if [ "$test" == "perl:" ]
106 then 106 then
107 echo -e "${txtpur}ERROR${txtrst} perl not found\n You have to install perl\n sudo apt-get install perl" 107 echo -e "${txtpur}ERROR${txtrst} perl not found\n You have to install perl\n sudo apt-get install perl"
108 exit 1; 108 exit 1;
109 fi 109 fi
110 echo -e "perl : \t ${txtgrn}OK${txtrst}" 110 echo -e "perl : \t ${txtgrn}OK${txtrst}"
111 111
112 ## iconv 112 ## iconv
113 test=$(whereis iconv) 113 test=$(whereis iconv)
114 if [ "$test" == "iconv:" ] 114 if [ "$test" == "iconv:" ]
115 then 115 then
116 echo -e "${txtpur}ERROR${txtrst} iconv not found\n You have to install iconv\n sudo apt-cache search iconv" 116 echo -e "${txtpur}ERROR${txtrst} iconv not found\n You have to install iconv\n sudo apt-cache search iconv"
117 exit 1; 117 exit 1;
118 fi 118 fi
119 echo -e "iconv : \t ${txtgrn}OK${txtrst}" 119 echo -e "iconv : \t ${txtgrn}OK${txtrst}"
120 120
121 ## csh shell 121 ## csh shell
122 test=$(whereis csh) 122 test=$(whereis csh)
123 if [ "$test" == "csh:" ] 123 if [ "$test" == "csh:" ]
124 then 124 then
125 echo -e "${txtpur}ERROR${txtrst} csh shell not found\n You have to install csh shell\n sudo apt-get install csh" 125 echo -e "${txtpur}ERROR${txtrst} csh shell not found\n You have to install csh shell\n sudo apt-get install csh"
126 exit 1; 126 exit 1;
127 fi 127 fi
128 echo -e "csh shell : \t ${txtgrn}OK${txtrst}" 128 echo -e "csh shell : \t ${txtgrn}OK${txtrst}"
129 129
130 ## SRI LM 130 ## SRI LM
131 if [ -z "$SRILM" ] && [ -z "$MACHINE_TYPE" ] 131 if [ -z "$SRILM" ] && [ -z "$MACHINE_TYPE" ]
132 then 132 then
133 echo -e "${txtpur}ERROR${txtrst} SRILM toolkit variables are not defined (SRILM and MACHINE_TYPE)\n You have to install SRILM Toolkit\n" 133 echo -e "${txtpur}ERROR${txtrst} SRILM toolkit variables are not defined (SRILM and MACHINE_TYPE)\n You have to install SRILM Toolkit\n"
134 exit 1; 134 exit 1;
135 fi 135 fi
136 export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE 136 export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE
137 echo -e "SRILM toolkit : \t ${txtgrn}OK${txtrst}" 137 echo -e "SRILM toolkit : \t ${txtgrn}OK${txtrst}"
138 138
139 139
140 140
141 ### Speeral Configuration ### 141 ### Speeral Configuration ###
142 142
143 echo -e "\n\t${txtblu}Speeral configuration${txtrst}\n" 143 echo -e "\n\t${txtblu}Speeral configuration${txtrst}\n"
144 echo -e "Download Speeral bin and data :" 144 echo -e "Download Speeral bin and data :"
145 scp -r rey@nyx:~/OTMEDIA_DATA/Speeral $OTMEDIA_HOME/tools/ 145 scp -r rey@nyx:~/OTMEDIA_DATA/Speeral $OTMEDIA_HOME/tools/
146 echo -e "\n\t${txtblu}Generating Speeral configuration files :${txtrst}\n" 146 echo -e "\n\t${txtblu}Generating Speeral configuration files :${txtrst}\n"
147 cat $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ 147 cat $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \
148 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ 148 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \
149 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ 149 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \
150 > $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml 150 > $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml
151 echo $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml 151 echo $PWD/tools/Speeral/CFG/SpeeralFirstPass.xml
152 cat $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ 152 cat $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \
153 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ 153 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \
154 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ 154 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \
155 > $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml 155 > $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml
156 echo $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml 156 echo $PWD/tools/Speeral/CFG/SpeeralSecondPass.xml
157 cat $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \ 157 cat $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml.tmp | sed -e "s|<nom>[^<]*</nom>|<nom>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer</nom>|g" \
158 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \ 158 | sed -e "s|<ngramme>[^<]*</ngramme>|<ngramme>$PWD/tools/Speeral/LM/ML_4gOTMEDIA_LEXIQUE_V6</ngramme>|g" \
159 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \ 159 | sed -e "s|<binode>[^<]*</binode>|<binode>$PWD/tools/Speeral/LEX/LEXIQUE_V6.speer.bin</binode>|g" \
160 > $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml 160 > $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml
161 echo $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml 161 echo $PWD/tools/Speeral/CFG/SpeeralThirdPass.xml
162 162
163 163
164 if [ $EXPLOITCONFPASS -eq 1 ] 164 if [ $EXPLOITCONFPASS -eq 1 ]
165 then 165 then
166 ### LIA ltbox ### 166 ### LIA ltbox ###
167 echo -e "\t${txtblu}Install lia_ltbox${txtrst}\n" 167 echo -e "\t${txtblu}Install lia_ltbox${txtrst}\n"
168 export LIA_TAGG_LANG="french" 168 export LIA_TAGG_LANG="french"
169 export LIA_TAGG="$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/" 169 export LIA_TAGG="$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/"
170 export LIA_PHON_REP="$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/" 170 export LIA_PHON_REP="$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/"
171 export LIA_BIGLEX="$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/" 171 export LIA_BIGLEX="$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/"
172 172
173 ### config lia_phon 173 ### config lia_phon
174 cd $LIA_PHON_REP 174 cd $LIA_PHON_REP
175 make all > /dev/null 175 make all > /dev/null
176 make ressource > /dev/null 176 make ressource > /dev/null
177 ### config lia_tagg 177 ### config lia_tagg
178 cd $LIA_TAGG 178 cd $LIA_TAGG
179 make all > /dev/null 179 make all > /dev/null
180 make ressource.french > /dev/null 180 make ressource.french > /dev/null
181 ### config lia_biglex 181 ### config lia_biglex
182 cd $LIA_BIGLEX 182 cd $LIA_BIGLEX
183 make -f makefile.biglex > /dev/null 183 make -f makefile.biglex > /dev/null
184 cd $OTMEDIA_HOME 184 cd $OTMEDIA_HOME
185 185
186 186
187 ### SOLR DB ### 187 ### SOLR DB ###
188 # Tomcat fisrtly 188 # Tomcat fisrtly
189 test=$(dpkg -l | grep "^ii" | grep tomcat) 189 test=$(dpkg -l | grep "^ii" | grep tomcat)
190 if [ "$test" == "" ] 190 if [ "$test" == "" ]
191 then 191 then
192 echo -e "${txtpur}ERROR${txtrst} TOMCAT seems to not be installed)\n You have to install TOMCAT\n" 192 echo -e "${txtpur}ERROR${txtrst} TOMCAT seems to not be installed)\n You have to install TOMCAT\n"
193 exit 1; 193 exit 1;
194 fi 194 fi
195 echo -e "\nTOMCAT : \t ${txtgrn}OK${txtrst}\n" 195 echo -e "\nTOMCAT : \t ${txtgrn}OK${txtrst}\n"
196 # SOLR secondly 196 # SOLR secondly
197 echo -e "\t${txtblu}Install SOLR DB${txtrst}\n" 197 echo -e "\t${txtblu}Install SOLR DB${txtrst}\n"
198 echo -e "You will need 300 Go of free space to install SOLR DB" 198 echo -e "You will need 300 Go of free space to install SOLR DB"
199 read -p "Continue ? (y/n) " solr 199 read -p "Continue ? (y/n) " solr
200 if [ "$solr" == "y" ] 200 if [ "$solr" == "y" ]
201 then 201 then
202 202
203 echo -e "Download SOLR DB\r" 203 echo -e "Download SOLR DB\r"
204 mkdir -p $OTMEDIA_HOME/tools/SOLR 2> /dev/null 204 mkdir -p $OTMEDIA_HOME/tools/SOLR 2> /dev/null
205 scp -r rey@nyx:~/OTMEDIA_DATA/SOLR/otmedia-2013-04.tar.gz $OTMEDIA_HOME/tools/SOLR 205 scp -r rey@nyx:~/OTMEDIA_DATA/SOLR/otmedia-2013-04.tar.gz $OTMEDIA_HOME/tools/SOLR
206 echo -e "Unzip SOLR DB\r" 206 echo -e "Unzip SOLR DB\r"
207 res=0 207 res=0
208 #res = $(tar -xvzf "$OTMEDIA_HOME/tools/SOLR/otmedia-2013-04.tar.gz" "$OTMEDIA_HOME/tools/SOLR/") 208 #res = $(tar -xvzf "$OTMEDIA_HOME/tools/SOLR/otmedia-2013-04.tar.gz" "$OTMEDIA_HOME/tools/SOLR/")
209 if [ $res -eq 2 ]; then echo " ${txtpur}NOT OK${txtrst}"; 209 if [ $res -eq 2 ]; then echo " ${txtpur}NOT OK${txtrst}";
210 else echo " ${txtgrn}OK${txtrst}"; fi 210 else echo " ${txtgrn}OK${txtrst}"; fi
211 else 211 else
212 echo "Skipping SOLR install" 212 echo "Skipping SOLR install"
213 fi 213 fi
214 read -e -p "Configure SOLR DB server ? (y/n) " solr 214 read -e -p "Configure SOLR DB server ? (y/n) " solr
215 if [ "$solr" == "y" ] 215 if [ "$solr" == "y" ]
216 then 216 then
217 read -p "Enter SOLR server IP :" ip 217 read -p "Enter SOLR server IP :" ip
218 if [ "${ip}" == "" ];then ip="localhost";fi 218 if [ "${ip}" == "" ];then ip="localhost";fi
219 echo "machine = \"${ip}\"" > $OTMEDIA_HOME/tools/scripts/solrinfo.py 219 echo "machine = \"${ip}\"" > $OTMEDIA_HOME/tools/scripts/solrinfo.py
220 read -p "Enter SOLR server port :" port 220 read -p "Enter SOLR server port :" port
221 if [ "${port}" == "" ]; then port="8080";fi 221 if [ "${port}" == "" ]; then port="8080";fi
222 echo -e "\n\tSOLR server IP ${ip}" 222 echo -e "\n\tSOLR server IP ${ip}"
223 echo -e "\tSOLR server port ${port}" 223 echo -e "\tSOLR server port ${port}"
224 echo "port = \"${port}\"" >> $OTMEDIA_HOME/tools/scripts/solrinfo.py 224 echo "port = \"${port}\"" >> $OTMEDIA_HOME/tools/scripts/solrinfo.py
225 else 225 else
226 echo "Skipping SOLR DB Configuration" 226 echo "Skipping SOLR DB Configuration"
227 fi 227 fi
228 echo -e "\nSee SOLR.INSTALL file for more information\n" 228 echo -e "\nSee SOLR.INSTALL file for more information\n"
229 fi 229 fi
230 230
231 ### Set Variables in bashrc ### 231 ### Set Variables in bashrc ###
232 cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" > ~/.bashrc.org 232 cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" > ~/.bashrc.org
233 #cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" | grep -v "LIA_TAGG" | grep -v "LIA_PHON" | grep -v "LIA_BIGLEX" > ~/.bashrc.org 233 #cat ~/.bashrc | grep -v "OTMEDIA_HOME" | grep -v "SRILM_BIN" | grep -v "LIA_TAGG" | grep -v "LIA_PHON" | grep -v "LIA_BIGLEX" > ~/.bashrc.org
234 cp ~/.bashrc.org ~/.bashrc 234 cp ~/.bashrc.org ~/.bashrc
235 export OTMEDIA_HOME=$PWD 235 export OTMEDIA_HOME=$PWD
236 echo "export OTMEDIA_HOME=$PWD" >> ~/.bashrc 236 echo "export OTMEDIA_HOME=$PWD" >> ~/.bashrc
237 echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE" >> ~/.bashrc 237 echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE" >> ~/.bashrc
238 #echo "export LIA_TAGG_LANG=french" >> ~/.bashrc 238 #echo "export LIA_TAGG_LANG=french" >> ~/.bashrc
239 #echo "export LIA_TAGG=$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/" >> ~/.bashrc 239 #echo "export LIA_TAGG=$OTMEDIA_HOME/tools/lia_ltbox/lia_tagg/" >> ~/.bashrc
240 #echo "export LIA_PHON_REP=$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/" >> ~/.bashrc 240 #echo "export LIA_PHON_REP=$OTMEDIA_HOME/tools/lia_ltbox/lia_phon/" >> ~/.bashrc
241 #echo "export LIA_BIGLEX=$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/" >> ~/.bashrc 241 #echo "export LIA_BIGLEX=$OTMEDIA_HOME/tools/lia_ltbox/lia_biglex/" >> ~/.bashrc
242 242
243 # set global configuration file 243 # set global configuration file
244 echo "OTMEDIA_HOME=$PWD" > $OTMEDIA_HOME/cfg/main_cfg.cfg 244 echo "OTMEDIA_HOME=$PWD" > $OTMEDIA_HOME/cfg/main_cfg.cfg
245 echo "ARCH=$ARCH" >> $OTMEDIA_HOME/cfg/main_cfg.cfg 245 echo "ARCH=$ARCH" >> $OTMEDIA_HOME/cfg/main_cfg.cfg
246 echo "VERBOSE=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg 246 echo "VERBOSE=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg
247 echo "DEBUG=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg 247 echo "DEBUG=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg
248 echo "CHECK=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg 248 echo "CHECK=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg
249 echo "RERUN=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg 249 echo "RERUN=0" >> $OTMEDIA_HOME/cfg/main_cfg.cfg
250 250
251 echo -e "\n\t${txtgrn}### Install completed ###${txtrst}\n" 251 echo -e "\n\t${txtgrn}### Install completed ###${txtrst}\n"
252 echo -e "do : source ~/.bashrc" 252 echo -e "do : source ~/.bashrc"
253 echo -e "or set variable :\n" 253 echo -e "or set variable :\n"
254 echo "export OTMEDIA_HOME=$PWD" 254 echo "export OTMEDIA_HOME=$PWD"
255 echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE" 255 echo "export SRILM_BIN=$SRILM/bin/$MACHINE_TYPE"
256
257 echo "${txtgrn}Yes${txtylw}I${txtpur}Rastafari{$txtrst}"
256 258
main_tools/OneScriptToRuleThemAll.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################### 3 #####################################
4 # File: OneScriptToRuleThemAll.sh # 4 # File: OneScriptToRuleThemAll.sh #
5 # Brief : Script to launch OTMEDIA # 5 # Brief : Script to launch OTMEDIA #
6 # Version : 1.0 # 6 # Version : 1.0 #
7 # Date : 23/07/2013 # 7 # Date : 23/07/2013 #
8 # Author : Jean-François Rey # 8 # Author : Jean-François Rey #
9 ##################################### 9 #####################################
10 10
11 # Color variables
12 txtgrn=$(tput setaf 2) # Green
13 txtylw=$(tput setaf 3) # Yellow
14 txtblu=$(tput setaf 4) # Blue
15 txtpur=$(tput setaf 5) # Purple
16 txtcyn=$(tput setaf 6) # Cyan
17 txtwht=$(tput setaf 7) # White
18 txtrst=$(tput sgr0) # Text reset.
19 #/color
20
21
11 echo -e "#### OneScriptToRuleThemAll ####" 22 echo -e "#### OneScriptToRuleThemAll ####"
12 LORD=" Three::rings 23 LORD=" Three::rings
13 for:::the::Elven-King 24 for:::the::Elven-King
14 under:the:sky,:Seven:for:the 25 under:the:sky,:Seven:for:the
15 Dwarf-Lords::in::their::halls:of 26 Dwarf-Lords::in::their::halls:of
16 stone,:Nine for:Mortal 27 stone,:Nine for:Mortal
17 :::Men::: ________ doomed::to 28 :::Men::: ________ doomed::to
18 die.:One _,-'...:... \`-. for:::the 29 die.:One _,-'...:... \`-. for:::the
19 ::Dark:: ,- .:::::::::::. \`. Lord::on 30 ::Dark:: ,- .:::::::::::. \`. Lord::on
20 his:dark ,' .:::::zzz:::::. \`. :throne: 31 his:dark ,' .:::::zzz:::::. \`. :throne:
21 In:::the/ ::::OTMEDIA:::: \ Land::of 32 In:::the/ ::::${txtpur}OTMEDIA${txtrst}:::: \ Land::of
22 :Mordor:\ ::::SCRIPTS:::: / :where:: 33 :Mordor:\ ::::${txtpur}SCRIPTS${txtrst}:::: / :where::
23 ::the::: '. '::::YEEEP::::' ,' Shadows: 34 ::the::: '. '::::YEEEP::::' ,' Shadows:
24 lie.::One \`. \`\`:::::::::'' ,' Ring::to 35 lie.::One \`. \`\`:::::::::'' ,' Ring::to
25 ::rule:: \`-._\`\`\`:'''_,-' ::them:: 36 ::rule:: \`-._\`\`\`:'''_,-' ::them::
26 all,::One \`-----' ring::to 37 all,::One \`-----' ring::to
27 ::find::: them,:One 38 ::find::: them,:One
28 Ring:::::to bring::them 39 Ring:::::to bring::them
29 all::and::in:the:darkness:bind 40 all::and::in:the:darkness:bind
30 them:In:the:Land:of:Mordor 41 them:In:the:Land:of:Mordor
31 where:::the::Shadows 42 where:::the::Shadows
32 :::lie.:::" 43 :::lie.:::"
33 44
34 45
35 # Check OTMEDIA_HOME env var 46 # Check OTMEDIA_HOME env var
36 if [ -z ${OTMEDIA_HOME} ] 47 if [ -z ${OTMEDIA_HOME} ]
37 then 48 then
38 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) 49 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
39 export OTMEDIA_HOME=$OTMEDIA_HOME 50 export OTMEDIA_HOME=$OTMEDIA_HOME
40 fi 51 fi
41 52
42 # where is OneScriptToRuleThemAll.sh 53 # where is OneScriptToRuleThemAll.sh
43 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) 54 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
44 55
45 RING="" 56 RING=""
46 p1=0 57 p1=0
47 p2=0 58 p2=0
48 conf=0 59 conf=0
49 exploitconf=0 60 exploitconf=0
50 p3=0 61 p3=0
51 recompose=0 62 recompose=0
52 scoring=0 63 scoring=0
53 64
54 #---------------# 65 #---------------#
55 # Parse Options # 66 # Parse Options #
56 #---------------# 67 #---------------#
57 while getopts ":hDv:cf:r123CeRsa" opt 68 while getopts ":hDv:cf:r123CeRsa" opt
58 do 69 do
59 case $opt in 70 case $opt in
60 h) 71 h)
61 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n" 72 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n"
62 echo -e "\t Options:" 73 echo -e "\t Options:"
63 echo -e "\t\t-h :\tprint this message" 74 echo -e "\t\t-h :\tprint this message"
64 echo -e "\t\t-D :\tDEBUG mode on" 75 echo -e "\t\t-D :\tDEBUG mode on"
65 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 76 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
66 echo -e "\t\t-c :\tCheck process, stop if error detected" 77 echo -e "\t\t-c :\tCheck process, stop if error detected"
67 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)" 78 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)"
68 echo -e "\t\t-r :\tForce to rerun without deleting all files" 79 echo -e "\t\t-r :\tForce to rerun without deleting all files"
69 echo -e "\t\t-a :\tDo every pass" 80 echo -e "\t\t-a :\tDo every pass"
70 echo -e "\t\t-1 :\tDo 1rt pass" 81 echo -e "\t\t-1 :\tDo 1rt pass"
71 echo -e "\t\t-2 :\tDo 2nd pass" 82 echo -e "\t\t-2 :\tDo 2nd pass"
72 echo -e "\t\t-3 :\tDo 3rd pass" 83 echo -e "\t\t-3 :\tDo 3rd pass"
73 echo -e "\t\t-C :\tDo confidence pass" 84 echo -e "\t\t-C :\tDo confidence pass"
74 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)" 85 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)"
75 echo -e "\t\t-R :\tDo recompose res" 86 echo -e "\t\t-R :\tDo recompose res"
76 echo -e "\t\t-s :\tDo scoring" 87 echo -e "\t\t-s :\tDo scoring"
77 exit 1 88 exit 1
78 ;; 89 ;;
79 D) 90 D)
80 RING=$RING" -D" 91 RING=$RING" -D"
81 ;; 92 ;;
82 v) 93 v)
83 RING=$RING" -v $OPTARG" 94 RING=$RING" -v $OPTARG"
84 ;; 95 ;;
85 c) 96 c)
86 RING=$RING" -c" 97 RING=$RING" -c"
87 ;; 98 ;;
88 f) 99 f)
89 RING=$RING" -f $OPTARG" 100 RING=$RING" -f $OPTARG"
90 ;; 101 ;;
91 r) 102 r)
92 RING=$RING" -r" 103 RING=$RING" -r"
93 ;; 104 ;;
94 a) 105 a)
95 p1=1 106 p1=1
96 p2=1 107 p2=1
97 p3=1 108 p3=1
98 conf=1 109 conf=1
99 exploitconf=1 110 exploitconf=1
100 recompose=1 111 recompose=1
101 scoring=1 112 scoring=1
102 ;; 113 ;;
103 1) 114 1)
104 p1=1 115 p1=1
105 ;; 116 ;;
106 2) 117 2)
107 p2=1 118 p2=1
108 ;; 119 ;;
109 3) 120 3)
110 p3=1 121 p3=1
111 ;; 122 ;;
112 C) 123 C)
113 conf=1 124 conf=1
114 ;; 125 ;;
115 e) 126 e)
116 exploitconf=1 127 exploitconf=1
117 ;; 128 ;;
118 a) 129 a)
119 recompose=1 130 recompose=1
120 ;; 131 ;;
121 s) 132 s)
122 scoring=1 133 scoring=1
123 ;; 134 ;;
124 :) 135 :)
125 echo "Option -$OPTARG requires an argument." >&2 136 echo "Option -$OPTARG requires an argument." >&2
126 exit 1 137 exit 1
127 ;; 138 ;;
128 \?) 139 \?)
129 echo "BAD USAGE : unknow opton -$OPTARG" 140 echo "BAD USAGE : unknow opton -$OPTARG"
130 exit 1 141 exit 1
131 ;; 142 ;;
132 esac 143 esac
133 done 144 done
134 145
135 # Check USAGE by arguments number 146 # Check USAGE by arguments number
136 if [ $(($#-($OPTIND-1))) -ne 2 ] 147 if [ $(($#-($OPTIND-1))) -ne 2 ]
137 then 148 then
138 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>" 149 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>"
139 echo "$0 -h for more info" 150 echo "$0 -h for more info"
140 exit 1 151 exit 1
141 fi 152 fi
142 153
143 shift $((OPTIND-1)) 154 shift $((OPTIND-1))
144 # check audio file - First argument 155 # check audio file - First argument
145 if [ -e $1 ] && [ -s $1 ] 156 if [ -e $1 ] && [ -s $1 ]
146 then 157 then
147 echo -e "$LORD\n" 158 echo -e "$LORD\n"
148 REP_OUT=$2/$(basename ${1%.*}) 159 REP_OUT=$2/$(basename ${1%.*})
149 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2;fi 160 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2;fi
150 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT};fi 161 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT};fi
151 if [ $conf -eq 1 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi 162 if [ $conf -eq 1 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi
152 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi 163 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi
153 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT};fi 164 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT};fi
154 if [ $conf -eq 1 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi 165 if [ $conf -eq 1 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi
155 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi 166 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi
156 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi 167 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi
157 echo "done" 168 echo "done"
158 else 169 else
159 echo "can't find $1 OR file is empty" 170 echo "can't find $1 OR file is empty"
160 exit 1 171 exit 1
161 fi 172 fi
162 173
163 174
164 175
165 176