Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | reyssat | 1 | #! /bin/sh |
2 | # |
||
3 | # This small script automatically downloads wims source distribution. |
||
4 | # It can be executed periodically via cron (say once a week). |
||
5 | # For example you may drop it into /etc/cron.weekly. |
||
6 | # You may change the definition of wimssrc to fit your setup. |
||
7 | # |
||
8 | # |
||
9 | ######################################### |
||
10 | # # |
||
11 | # SETUP configuration values # |
||
12 | # # |
||
13 | ######################################### |
||
14 | |||
15 | # WIMS source directory on the localhost. |
||
16 | # You do not need to change these two lines if this script is in |
||
17 | # the directory of the downloaded source. |
||
18 | # wimssrc=/var/wims/download |
||
19 | wimssrc=`dirname $0` |
||
20 | |||
21 | # Architecture type of the system: i386 |
||
22 | arch=i386 |
||
23 | |||
24 | ######################################### |
||
25 | # # |
||
26 | # END of setup section # |
||
27 | # # |
||
28 | ######################################### |
||
29 | |||
30 | if [ -z "$loadversion" ]; then exit; fi |
||
31 | |||
32 | cd $wimssrc |
||
33 | rm -f ../update.sh |
||
34 | wimsurl=`cat downloadsite | tr -d '[:space:]'` |
||
35 | rm -r *.sh *.tgz *.rpm *.deb 2>/dev/null |
||
36 | test=`cat ../public_html/bases/site/.rpm 2>/dev/null` |
||
37 | list= |
||
38 | if [ ! -z "$test" ] && [ "$loadtype" != "tgz" ]; then |
||
39 | dir=$wimsurl/rpm |
||
40 | list=" |
||
41 | $dir/wims-$loadversion-1.$arch.rpm |
||
42 | $dir/README-rpm |
||
43 | $dir/installrpm.sh |
||
44 | $dir/uninstallrpm.sh |
||
45 | " |
||
46 | # for l in $loadlanguages |
||
47 | # do |
||
48 | # list="$list $dir/wims-modules-$l-$loadversion-1.noarch.rpm" |
||
49 | # done |
||
50 | download=rpm |
||
51 | else |
||
52 | dir=$wimsurl/wims |
||
53 | list="$dir/wims-$loadversion.tgz |
||
54 | $dir/README |
||
55 | $dir/update.sh |
||
56 | " |
||
57 | # for l in $loadlanguages |
||
58 | # do |
||
59 | # list="$list $dir/wims_modules-$l-$loadversion.tgz" |
||
60 | # done |
||
61 | download=tgz |
||
62 | fi |
||
63 | |||
64 | export wims_exec_parm |
||
65 | rm -f ../tmp/webget.log |
||
66 | wims_exec_parm=$dir/filesizes |
||
67 | ../public_html/bin/webget >filesizes 2>>../tmp/webget.log |
||
68 | for f in $list |
||
69 | do |
||
70 | wims_exec_parm=$f |
||
71 | fname=`echo $f | sed "s@$dir/@@"` |
||
72 | ../public_html/bin/webget >$fname 2>>../tmp/webget.log |
||
73 | got=`stat -t $fname 2>/dev/null | cut -d ' ' -f 2` |
||
74 | comp=`awk '$1=="'$fname'" {print $2}' filesizes 2>/dev/null` |
||
75 | if [ ! -z "$got" ] && [ "$got" = "$comp" ]; then |
||
76 | echo $fname: $got bytes |
||
77 | else |
||
78 | echo $fname: Download failed |
||
79 | exit 1 |
||
80 | fi |
||
81 | done |
||
82 | |||
83 | if [ "$download" = "tgz" ]; then |
||
84 | cp update.sh .. |
||
85 | else |
||
86 | cat >../update.sh <<@ |
||
87 | #! /bin/sh |
||
88 | cd download |
||
89 | ./installrpm.sh |
||
90 | @ |
||
91 | chmod u+x ../update.sh |
||
92 | fi |
||
93 |