Piotr Perzanowski | e2ce475 | 2018-12-18 13:18:15 +0100 | [diff] [blame^] | 1 | #! /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 |
| 20 | RELATIVE_PATH=../ # relative path from this script to 'common-functions.sh' |
| 21 | if [ "$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 |
| 25 | fi |
| 26 | SRC_IMAGE_LIST=$1 |
| 27 | if [[ -z "$SRC_IMAGE_LIST" ]]; then |
| 28 | SRC_IMAGE_LIST="docker_image_list.txt" |
| 29 | fi |
| 30 | echo "Download all images" |
| 31 | lines=$(cat $SRC_IMAGE_LIST | wc -l) |
| 32 | line=1 |
| 33 | while 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)) |
| 44 | done < "$SRC_IMAGE_LIST" |