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