blob: d0115547bb6362a0a41fb069f898c68822b08bcd [file] [log] [blame]
Piotr Perzanowskie2ce4752018-12-18 13:18:15 +01001#! /usr/bin/env bash
2# COPYRIGHT NOTICE STARTS HERE
3#
4# Copyright 2018 © Samsung Electronics Co., Ltd.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# COPYRIGHT NOTICE ENDS HERE
19# boilerplate
20RELATIVE_PATH=../ # relative path from this script to 'common-functions.sh'
21if [ "$IS_COMMON_FUNCTIONS_SOURCED" != YES ] ; then
22 SCRIPT_DIR=$(dirname "${0}")
23 LOCAL_PATH=$(readlink -f "$SCRIPT_DIR")
24 . "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh
25fi
26SRC_IMAGE_LIST=$1
27if [[ -z "$SRC_IMAGE_LIST" ]]; then
28 SRC_IMAGE_LIST="docker_image_list.txt"
29fi
30echo "Download all images"
31lines=$(cat $SRC_IMAGE_LIST | wc -l)
32line=1
33while read -r image; do
34 echo "== pkg #$line of $lines =="
35 name=$(echo $image|awk '{print $1}')
36 digest=$(echo $image|awk '{print $2}')
37 echo "$name digest:$digest"
38 if [[ "$digest" == "<none>" ]]; then
39 retry docker -l error pull "$name"
40 else
41 retry docker -l error pull "$name"
42 fi
43 line=$((line+1))
44done < "$SRC_IMAGE_LIST"