summaryrefslogtreecommitdiffstats
path: root/build/creating_data/download-http-files.sh
diff options
context:
space:
mode:
authorTomáš Levora <t.levora@partner.samsung.com>2019-04-23 14:28:47 +0200
committerTomáš Levora <t.levora@partner.samsung.com>2019-05-09 12:24:21 +0200
commit284fbf8afb0ff784507e7b0f8b9d325e8644f67c (patch)
tree8facf71bf7bb9325b2f428d5d8e1daa5a396c7e2 /build/creating_data/download-http-files.sh
parent029b36f9f0faedc18b032ebb8c598118ff80f67b (diff)
Fix download scripts to handle empty lines
Fixing download and saving scripts to be able to ignore empty or 00D ending lines in lists Issue-ID: OOM-1818 Change-Id: I55ef1dfbea628f8c1d4b19745536e629a2dbe0c9 Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
Diffstat (limited to 'build/creating_data/download-http-files.sh')
-rwxr-xr-xbuild/creating_data/download-http-files.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/build/creating_data/download-http-files.sh b/build/creating_data/download-http-files.sh
index 06f41354..1144c66e 100755
--- a/build/creating_data/download-http-files.sh
+++ b/build/creating_data/download-http-files.sh
@@ -16,7 +16,11 @@
#
# COPYRIGHT NOTICE ENDS HERE
-LIST_FILE="$1"
+
+# Load common-functions library
+. $(dirname ${0})/../common-functions.sh
+
+LIST_FILE="${1}"
if [[ -z "$LIST_FILE" ]]; then
echo "Missing list file"
exit 1
@@ -28,13 +32,13 @@ if [[ -z "$outdir" ]]; then
exit 1
fi
-lines=$(cat "$LIST_FILE" | wc -l)
+lines=$(clean_list "$LIST_FILE" | wc -l)
cnt=1
# create output dir if not exists
mkdir -p "$outdir"
-while read -r line; do
+for line in $(clean_list "$LIST_FILE"); do
# www.springframework.org/schema/tool/spring-tool-4.3.xsd
file="${line%%\?*}"
echo "Downloading $cnt / $lines: $file"
@@ -44,5 +48,4 @@ while read -r line; do
# drop below 10b/10s
curl --retry 5 -y 10 -Y 10 --location "$line" -o "$outdir/$file" &>/dev/null
cnt=$((cnt+1))
-
-done < "$LIST_FILE"
+done \ No newline at end of file