testing/release/common/download_mars.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/.
     5 download_mars () {
     6     update_url="$1"
     7     only="$2"
     8     test_only="$3"
    10     echo "Using  $update_url"
    11     wget --no-check-certificate -q -O update.xml $update_url
    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=$?
    22       if [ 0 -ne $grep_rv ]; then
    23 	      echo "FAIL: no $patch_type update found for $update_url" 
    24 	      return 1
    25       fi
    27       command=`echo $line | sed -e 's/^.*<patch //' -e 's:/>.*$::' -e 's:\&amp;:\&:g'`
    28       eval "export $command"
    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/^.*= //'`
    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
    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
    59       cp update/$patch_type.mar update/update.mar
    61     done
    62 }

mercurial