Rev 7714 | Rev 8008 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | reyssat | 1 | #! /bin/sh |
2 | # |
||
4281 | bpr | 3 | # This script do many things (should be cleaned) |
4 | # - update sheets from example class (will be indexed after) |
||
5 | # - indexes wims server resources (modules, sheets). |
||
7702 | bpr | 6 | # - with option "withoef", do something counting oef exercises, |
4281 | bpr | 7 | # make a list of oef (module,name_exofile) in bases/site/oef/ |
8 | # does not seem to be yet in use - take Changelog |
||
9 | # - make slib index |
||
10 | # - make shtooka packs index |
||
11 | # - build index of docs in bases/doc |
||
12 | # - make model list |
||
13 | # - make oefdocumentation for javascript in createxo |
||
14 | |||
3 | reyssat | 15 | # It should be run each time a module is added or modified. |
16 | # |
||
17 | |||
18 | # base directory. |
||
19 | test=`dirname $0` |
||
20 | if [ -z "$test" ]; then WIMS_HOME=..; else WIMS_HOME=$test/..; fi |
||
21 | cd $WIMS_HOME |
||
22 | WIMS_HOME=`pwd` |
||
4249 | guerimand | 23 | |
3 | reyssat | 24 | export mlist slist dicsort_separator dicsort_grouping |
25 | export w_translator_unknown w_dictionary w_translator_switch translator_input |
||
26 | LANG=C |
||
27 | |||
28 | BASES=$WIMS_HOME/public_html/bases |
||
29 | MODULES=$WIMS_HOME/public_html/modules |
||
30 | translator=$WIMS_HOME/public_html/bin/translator |
||
31 | dicsort=$WIMS_HOME/bin/dicsort |
||
55 | bpr | 32 | SLIB=$WIMS_HOME/public_html/scripts/slib |
655 | bpr | 33 | SWAC=$WIMS_HOME/public_html/scripts/data/swac |
3195 | bpr | 34 | MODEL=$WIMS_HOME/public_html/scripts/model |
4927 | bpr | 35 | CIRCUIT=$WIMS_HOME/public_html/scripts/data/circuits |
4947 | bpr | 36 | BGIMAGE=$WIMS_HOME/public_html/gifs/bg |
6072 | bpr | 37 | OEF=$WIMS_HOME/public_html/scripts/oef |
6085 | bpr | 38 | CLASSES=$WIMS_HOME/log/classes |
6090 | bpr | 39 | DOC=$WIMS_HOME/public_html/scripts/docu |
6091 | bpr | 40 | BASESDOC=$WIMS_HOME/public_html/bases/doc |
6236 | bpr | 41 | THEME=$WIMS_HOME/public_html/themes |
6260 | bpr | 42 | DATAMODULE=$WIMS_HOME/public_html/modules/data |
6915 | bpr | 43 | FORTUNE=$BASES/fortune |
6935 | bpr | 44 | KEYWDIR=$WIMS_HOME/public_html/scripts/keywords |
6260 | bpr | 45 | |
6090 | bpr | 46 | ## copy all sheet in example class to base/sheet/ for search engine |
47 | $WIMS_HOME/bin/mkexamplesheet.sh $WIMS_HOME |
||
48 | |||
3 | reyssat | 49 | # MAX_LINELEN |
50 | linelen=15000 |
||
51 | |||
52 | cd $MODULES |
||
7372 | bpr | 53 | mlist=`find [EHKUGRL]* tool data contrib -name INDEX 2>/dev/null\ |
3 | reyssat | 54 | | sed 's!/INDEX$!!g' | sort` |
183 | bpr | 55 | mlist2=`find local com help -follow -name INDEX 2>/dev/null\ |
3 | reyssat | 56 | | sed 's!/INDEX$!!g' | sort` |
57 | mlist="$mlist |
||
58 | $mlist2" |
||
4835 | bpr | 59 | grep -l "ask_trusted=yes" */*/*/var.init | awk -F "/" '{ print $1"/"$2"/"$3 }' > $BASES/site/trusted_modules |
3 | reyssat | 60 | |
4835 | bpr | 61 | |
6915 | bpr | 62 | cd $WIMS_HOME ; |
4835 | bpr | 63 | bin/css.pl |
64 | |||
6379 | bpr | 65 | cd $BASES/sys ; |
66 | ./mkindex |
||
6935 | bpr | 67 | cd $WIMS_HOME |
68 | mkdir -p $KEYWDIR |
||
69 | cp $BASES/sys/tmp/* $KEYWDIR |
||
6379 | bpr | 70 | |
7714 | bpr | 71 | ### reverse the table of modules/taxonomy |
72 | cd $BASES/classification |
||
73 | echo "classification" |
||
74 | ./classif.pl |
||
75 | |||
7185 | bpr | 76 | cd $BASES/dic ; |
77 | ./mkindex.sh |
||
78 | |||
3 | reyssat | 79 | cd $BASES/sheet |
80 | slist="`find . -name '*.def' | sed 's!^./!!g;s!.def$!!g' | sort`" |
||
81 | rm -f index/* |
||
82 | cd $BASES |
||
83 | rm -fR site2 |
||
3854 | bpr | 84 | cp -pPR site site2 |
3 | reyssat | 85 | cd site2 |
86 | rm -f [A-Z].?? lists/[A-Z].?? |
||
87 | mkdir -p lists |
||
88 | |||
89 | cd $WIMS_HOME |
||
90 | bin/modind || exit |
||
91 | |||
92 | cd $BASES/site2 || exit |
||
93 | rm -f mkindex.log |
||
94 | dicsort_separator=':' |
||
95 | dicsort_grouping=' ' |
||
96 | for f in [A-Z].?? |
||
97 | do |
||
98 | $dicsort $f >>mkindex.log |
||
6381 | bpr | 99 | mv $f.sorted $f |
3 | reyssat | 100 | done |
101 | cd $BASES/site2 |
||
102 | |||
103 | dicsort_grouping= |
||
104 | for f in title description addr serial language author version weight.?? |
||
105 | do |
||
106 | $dicsort $f >>mkindex.log |
||
6381 | bpr | 107 | mv $f.sorted $f |
3 | reyssat | 108 | done |
109 | n=`grep -c . addr` |
||
110 | rm -f $WIMS_HOME/log/modupdate |
||
111 | echo Indexed $n modules. |
||
112 | |||
113 | w_translator_switch="leavelines file" |
||
114 | w_translator_unknown=leave |
||
115 | w_dictionary=serial |
||
116 | translator_input=popular |
||
117 | $translator >popular.1 |
||
118 | $dicsort popular.1 >>mkindex.log |
||
119 | grep '^[0-9]' popular.1.sorted >popular.1 |
||
120 | |||
121 | awk -F: '{print $1}' title | uniq >lists/total |
||
122 | |||
123 | cd lists |
||
124 | cats=`ls [A-Z].??` |
||
125 | cd .. |
||
126 | |||
127 | for t in $cats |
||
128 | do |
||
129 | w_translator_unknown=leave |
||
130 | w_dictionary=pop/dic |
||
131 | w_translator_switch="leaveline file" |
||
132 | translator_input=lists/$t |
||
133 | $translator | sort -n -r -k2 2>/dev/null |\ |
||
134 | awk 'BEGIN {a=0}; {a+=length()+1}; |
||
135 | a >= '$linelen' {exit}; |
||
136 | {print}' >pop/$t |
||
137 | done |
||
138 | |||
139 | # Robot lists |
||
140 | langs=`ls A.* | sed 's/^A\.//g'` |
||
141 | w_translator_switch="leaveline file" |
||
142 | w_dictionary=popular |
||
143 | w_translator_unknown=leave |
||
144 | translator_input=lists/robot.phtml |
||
145 | $translator | sort -nr >lists/robot.sorted |
||
146 | |||
147 | for l in $langs |
||
148 | do |
||
6443 | bpr | 149 | awk -F, '$2=="'$l'" {print "!href module="$3" "$4"\n, "$5" <br />"}' lists/robot.sorted >lists/robot-$l.phtml |
3 | reyssat | 150 | done |
151 | rm -f lists/robot.* |
||
152 | |||
153 | cd $BASES |
||
154 | if [ -d site2 ]; then |
||
155 | mv site site.old |
||
156 | mv site2 site |
||
157 | [ -d site ] && rm -fR site.old |
||
158 | fi |
||
159 | |||
4281 | bpr | 160 | # OEF exercises - what does it do ??? do not be used |
3 | reyssat | 161 | if [ "$1" = "withoef" ]; then |
162 | echo Listing OEF exercices by order of time... |
||
163 | TMP=$WIMS_HOME/tmp/oefs |
||
164 | tmp1=${TMP}1; tmp2=${TMP}2; tmp3=${TMP}3 |
||
165 | |||
166 | mkdir -p $BASES/site/oef |
||
167 | cd $BASES/site/lists |
||
168 | langs=`ls O.* | sed 's/^O\.//g'` |
||
169 | cd $MODULES |
||
4281 | bpr | 170 | ## FIXME Changelog does not exist just Changelog.new Changelog.modif |
3 | reyssat | 171 | newmod=`awk '$2=="added" {print $4}' Changelog | head -20 | tr -d '()'` |
172 | for l in $langs |
||
173 | do |
||
174 | oefmodules=`egrep '^[A-Z]|^contrib' $BASES/site/lists/O.$l` |
||
175 | rm -f $tmp1 $tmp2 $tmp3 2>/dev/null |
||
176 | for m in $oefmodules |
||
177 | do |
||
178 | mt=`echo $m | sed 's/.[a-z][a-z]$//'` |
||
179 | test=`echo "$newmod" | grep $mt` |
||
180 | if [ -z "$test" ]; then out=$tmp1; else out=$tmp2; fi |
||
181 | perl -e 'for (@ARGV) {@S=stat($_); print "$_ $S[9]\n"}'\ |
||
182 | $m/src/*.oef >> $out |
||
183 | done |
||
184 | for tmp in $tmp1 $tmp2; do |
||
185 | if [ -s $tmp ]; then |
||
186 | sort -nr -k2 $tmp | cut -d' ' -f1 >> $tmp3 |
||
187 | fi |
||
188 | done |
||
189 | if [ -s $tmp3 ]; then |
||
190 | sed 's!/src/!,!g;s/\.oef$//g' $tmp3 > $BASES/site/oef/new.$l |
||
191 | n=`grep -c . $tmp3` |
||
192 | echo "$l: $n OEF sorted." |
||
193 | fi |
||
194 | done |
||
195 | rm -f $tmp1 $tmp2 $tmp3 2>/dev/null |
||
196 | fi |
||
197 | |||
198 | # sheets |
||
199 | dicsort_grouping=' ' |
||
200 | cd $BASES/sheet/index |
||
201 | for f in ?? |
||
202 | do |
||
203 | $dicsort $f >>mkindex.log |
||
204 | mv $f.sorted $f |
||
205 | cnt=`grep -c . list.$f` |
||
206 | echo $cnt >count.$f |
||
207 | $dicsort addr.$f >>mkindex.log |
||
208 | mv addr.$f.sorted addr.$f |
||
209 | $dicsort serial.$f >>mkindex.log |
||
210 | mv serial.$f.sorted serial.$f |
||
211 | echo Indexed $cnt $f sheets. |
||
212 | done |
||
213 | |||
214 | dicsort_grouping= |
||
215 | for f in title.* description.* |
||
216 | do |
||
217 | $dicsort $f >>mkindex.log |
||
218 | mv $f.sorted $f |
||
219 | done |
||
220 | |||
451 | bpr | 221 | #slib index |
55 | bpr | 222 | cd $SLIB |
6915 | bpr | 223 | ./mkindex >>mkindex.log |
55 | bpr | 224 | |
451 | bpr | 225 | #shtooka index |
655 | bpr | 226 | cd $SWAC |
6915 | bpr | 227 | rm -f index.log |
228 | ./mkindex >>index.log |
||
451 | bpr | 229 | |
4291 | bpr | 230 | |
231 | # make index bases doc |
||
6443 | bpr | 232 | $BASES/doc/.build-index 1>/dev/null |
568 | bpr | 233 | |
3195 | bpr | 234 | #model list |
6915 | bpr | 235 | for i in fr en cn ca it ; do rm -f $MODEL/$i/list ; done |
3195 | bpr | 236 | |
6072 | bpr | 237 | #oef/qcm |
238 | # generate exercises in directory oef/$lang/qcm |
||
8002 | bpr | 239 | for i in fr en cn nl ; do |
240 | cd $OEF/$i/qcm ; |
||
241 | touch $OEF/$i/qcm/src/cpp/qcm.cpp; |
||
242 | $OEF/mkindex $WIMS_HOME ; |
||
243 | done |
||
6072 | bpr | 244 | |
6085 | bpr | 245 | # generate exercises in example class |
246 | cd $CLASSES |
||
247 | clist=`ls -d [1-9][0-9][0-9][0-9]` |
||
248 | for cls in $clist; do |
||
249 | cd $CLASSES/$cls ; $OEF/mkindex $WIMS_HOME 2>/dev/null |
||
250 | done |
||
251 | |||
6090 | bpr | 252 | # compile documents in example class |
253 | cd $CLASSES |
||
254 | clist=`ls -d [1-9][0-9][0-9][0-9]` |
||
255 | for cls in $clist; do |
||
256 | cd $CLASSES/$cls |
||
6915 | bpr | 257 | if [ ! -d doc ] ; then |
6443 | bpr | 258 | echo "no document in $cls" 1>/dev/null |
6090 | bpr | 259 | else |
260 | cd doc |
||
261 | dlist=`ls` |
||
6915 | bpr | 262 | if [ ! -d "$dlist" ] ; then |
6090 | bpr | 263 | for doc in $dlist ; do |
6443 | bpr | 264 | cd $CLASSES/$cls/doc/$doc ; $DOC/mkindex $WIMS_HOME $CLASSES/$cls/doc/$doc 1>/dev/null |
6090 | bpr | 265 | done |
266 | fi |
||
267 | fi |
||
268 | done |
||
6091 | bpr | 269 | # compile documents in bases/doc |
270 | cd $BASESDOC |
||
271 | clist=`ls -d [0-9]*` |
||
272 | for doc in $clist; do |
||
273 | cd $BASESDOC/$doc |
||
6443 | bpr | 274 | $DOC/mkindex $WIMS_HOME $BASESDOC/$doc 1>/dev/null 2>/dev/null |
6091 | bpr | 275 | done |
6915 | bpr | 276 | |
3461 | bpr | 277 | #oefdocumentation for javascript |
278 | cd $WIMS_HOME |
||
4834 | bpr | 279 | bin/oefdoc.pl |
4927 | bpr | 280 | |
281 | #make circuits index and generate component images |
||
6915 | bpr | 282 | ## should also understand mkindex and |
4948 | bpr | 283 | cd $CIRCUIT |
284 | ./mksymbols ; ./mkthumbs |
||
4947 | bpr | 285 | |
286 | #make some bg images |
||
287 | cd $BGIMAGE |
||
6072 | bpr | 288 | ./.generate |
6236 | bpr | 289 | |
6260 | bpr | 290 | #make images in some datamodule |
291 | cd $DATAMODULE/images; |
||
6443 | bpr | 292 | ##create test if done ; do nothing if file test exists |
6260 | bpr | 293 | if [ -f "roadsigns.fr/INDEX" ]; then |
6915 | bpr | 294 | if [ -f "roadsigns.fr/test" ] ; then echo "no modification in $DATAMODULE/images/roadsigns.fr"; |
6443 | bpr | 295 | else |
296 | dir=$DATAMODULE/images/roadsigns.fr |
||
297 | for z in 500 200 100 ; do |
||
6915 | bpr | 298 | cd $dir/images ; mkdir -p png$z ; |
6443 | bpr | 299 | for a in `ls svg/*.svg`; do file=`basename $a .svg`; convert $a -resize $z $dir/images/png$z/$file.png 2>/dev/null ; done; |
300 | done; |
||
301 | touch $dir/test ; echo "yes" > $dir/test |
||
302 | fi |
||
6260 | bpr | 303 | fi; |
6915 | bpr | 304 | |
305 | #make file.dat for fortune |
||
306 | cd $FORTUNE |
||
307 | ##create test if done ; do nothing if file test exists |
||
308 | if [ `which strfile` ]; then |
||
309 | if [ -f "test" ]; then |
||
310 | echo "no modification in $FORTUNE ; you must delete $FORTUNE/test to recreate the files .dat"; |
||
311 | else |
||
312 | for a in `ls -d *`; |
||
313 | do cd $a; |
||
314 | if [ ! `ls -d * | wc -c` -eq 0 ] ; then |
||
315 | for b in `ls` ; do |
||
316 | file=`basename $b .dat` ; |
||
317 | strfile $file ; |
||
318 | done; |
||
319 | fi; |
||
320 | cd ..; |
||
321 | done |
||
322 | fi |
||
323 | touch $FORTUNE/test ; echo "yes" > $FORTUNE/test |
||
324 | fi |
||
7702 | bpr | 325 | |
326 | # cleanup the *.bin in score |
||
327 | cd $CLASSES |
||
328 | echo "cleanup classes" |
||
329 | find . -type f -name "*.bin" -exec rm -v "{}" ";" 1>/dev/null |