testing/release/common/download_mars.sh

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:d369bd7c940f
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 download_mars () {
6 update_url="$1"
7 only="$2"
8 test_only="$3"
9
10 echo "Using $update_url"
11 wget --no-check-certificate -q -O update.xml $update_url
12
13 mkdir -p update/
14 if [ -z $only ]; then
15 only="partial complete"
16 fi
17 for patch_type in $only
18 do
19 line=`fgrep "patch type=\"$patch_type" update.xml`
20 grep_rv=$?
21
22 if [ 0 -ne $grep_rv ]; then
23 echo "FAIL: no $patch_type update found for $update_url"
24 return 1
25 fi
26
27 command=`echo $line | sed -e 's/^.*<patch //' -e 's:/>.*$::' -e 's:\&amp;:\&:g'`
28 eval "export $command"
29
30 if [ "$test_only" == "1" ]
31 then
32 echo "Testing $URL"
33 curl -k -s -I -L $URL
34 return
35 else
36 wget --no-check-certificate -nv -O update/$patch_type.mar $URL 2>&1
37 fi
38 if [ "$?" != 0 ]; then
39 echo "Could not download $patch_type!"
40 echo "from: $URL"
41 fi
42 actual_size=`perl -e "printf \"%d\n\", (stat(\"update/$patch_type.mar\"))[7]"`
43 actual_hash=`openssl dgst -$hashFunction update/$patch_type.mar | sed -e 's/^.*= //'`
44
45 if [ $actual_size != $size ]; then
46 echo "FAIL: $patch_type from $update_url wrong size"
47 echo "FAIL: update.xml size: $size"
48 echo "FAIL: actual size: $actual_size"
49 return 1
50 fi
51
52 if [ $actual_hash != $hashValue ]; then
53 echo "FAIL: $patch_type from $update_url wrong hash"
54 echo "FAIL: update.xml hash: $hashValue"
55 echo "FAIL: actual hash: $actual_hash"
56 return 1
57 fi
58
59 cp update/$patch_type.mar update/update.mar
60
61 done
62 }

mercurial