diff -r 000000000000 -r 6474c204b198 testing/release/common/download_mars.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/release/common/download_mars.sh Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,62 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +download_mars () { + update_url="$1" + only="$2" + test_only="$3" + + echo "Using $update_url" + wget --no-check-certificate -q -O update.xml $update_url + + mkdir -p update/ + if [ -z $only ]; then + only="partial complete" + fi + for patch_type in $only + do + line=`fgrep "patch type=\"$patch_type" update.xml` + grep_rv=$? + + if [ 0 -ne $grep_rv ]; then + echo "FAIL: no $patch_type update found for $update_url" + return 1 + fi + + command=`echo $line | sed -e 's/^.*.*$::' -e 's:\&:\&:g'` + eval "export $command" + + if [ "$test_only" == "1" ] + then + echo "Testing $URL" + curl -k -s -I -L $URL + return + else + wget --no-check-certificate -nv -O update/$patch_type.mar $URL 2>&1 + fi + if [ "$?" != 0 ]; then + echo "Could not download $patch_type!" + echo "from: $URL" + fi + actual_size=`perl -e "printf \"%d\n\", (stat(\"update/$patch_type.mar\"))[7]"` + actual_hash=`openssl dgst -$hashFunction update/$patch_type.mar | sed -e 's/^.*= //'` + + if [ $actual_size != $size ]; then + echo "FAIL: $patch_type from $update_url wrong size" + echo "FAIL: update.xml size: $size" + echo "FAIL: actual size: $actual_size" + return 1 + fi + + if [ $actual_hash != $hashValue ]; then + echo "FAIL: $patch_type from $update_url wrong hash" + echo "FAIL: update.xml hash: $hashValue" + echo "FAIL: actual hash: $actual_hash" + return 1 + fi + + cp update/$patch_type.mar update/update.mar + + done +}