pjs/testing/release/common/download_mars.sh

59 строки
1.6 KiB
Bash
Исходник Обычный вид История

2006-07-29 01:00:11 +04:00
download_mars () {
update_url="$1"
2006-07-29 02:52:34 +04:00
only="$2"
test_only="$3"
2006-07-29 01:00:11 +04:00
echo "Using $update_url"
wget --no-check-certificate -q -O update.xml $update_url
2006-07-29 01:00:11 +04:00
mkdir -p update/
2006-07-29 02:52:34 +04:00
if [ -z $only ]; then
only="partial complete"
fi
for patch_type in $only
2006-07-29 01:00:11 +04:00
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"
2006-08-02 00:09:25 +04:00
return 1
2006-07-29 01:00:11 +04:00
fi
command=`echo $line | sed -e 's/^.*<patch //' -e 's:/>.*$::' -e 's:\&amp;:\&:g'`
eval "export $command"
if [ "$test_only" == "1" ]
then
2006-11-01 02:56:57 +03:00
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
2006-07-29 01:00:11 +04:00
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"
2006-08-02 00:09:25 +04:00
return 1
2006-07-29 01:00:11 +04:00
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"
2006-08-02 00:09:25 +04:00
return 1
2006-07-29 01:00:11 +04:00
fi
cp update/$patch_type.mar update/update.mar
2006-07-29 01:00:11 +04:00
done
}