blob: 1b01a8c0d61c8671c629ffe814ee84f7bab00998 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#! /bin/sh
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
cd "$(dirname "$0")/../../platform_tools/android/apps/skqp/src/main/assets"
checksum() {
[ -f "$1" ] && { md5sum < "$1" | head -c 32; }
}
download() {
if ! [ $1 = "$(checksum "$2")" ]; then
mkdir -p "$(dirname "$2")"
curl -s -o "$2" "https://storage.googleapis.com/skia-skqp-assets/$1"
fi
}
download $(cat files.checksum) files.txt
COUNT=$(wc -l < files.txt)
INDEX=1
SHARD_COUNT=32
cat files.txt | while IFS= read -r LINE; do
MD5=$(echo $LINE | awk -F\; '{print $1}')
FILENAME=$(echo $LINE | awk -F\; '{print $2}')
download $MD5 "$FILENAME" &
if [ $(($INDEX % $SHARD_COUNT)) = 0 ]; then
wait
printf '\r %d / %d ' "$INDEX" "$COUNT"
fi
INDEX=$(($INDEX + 1))
done
printf '\rdone \n'
|