From 3dc9d49fb8e67a152ebc023332a8124314c40ee2 Mon Sep 17 00:00:00 2001 From: David Gaster Date: Wed, 24 May 2023 20:04:18 -0700 Subject: [PATCH] ability to specify platform arch for air gap install Signed-off-by: David Gaster (cherry picked from commit a601ecc4684435093a9d92dd05621b837d77a5ad) --- scripts/save-images.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/save-images.sh b/scripts/save-images.sh index 69a28c5..003004a 100755 --- a/scripts/save-images.sh +++ b/scripts/save-images.sh @@ -15,6 +15,11 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; + -p|--platform) + platform="$2" + shift # past argument + shift # past value + ;; -h|--help) help="true" shift @@ -28,8 +33,9 @@ while [[ $# -gt 0 ]]; do done usage () { - echo "USAGE: $0 [--image-list longhorn-images.txt] [--images longhorn-images.tar.gz]" + echo "USAGE: $0 [--image-list longhorn-images.txt] [--images longhorn-images.tar.gz] [--platform linux/amd64]" echo " [-l|--images-list path] text file with list of images. 1 per line." + echo " [-p|--platform linux/arch] if using images-list path, pulls the image with the specified platform" echo " [-i|--images path] tar.gz generated by docker save. If this flag is empty, the script does not export images to a tar.gz file" echo " [-h|--help] Usage message" } @@ -42,9 +48,13 @@ fi set -e -x for i in $(cat ${list}); do - docker pull ${i} + if [ -n "$platform" ]; then + docker pull ${i} --platform $platform + else + docker pull ${i} + fi done if [[ $images ]]; then docker save $(cat ${list} | tr '\n' ' ') | gzip -c > ${images} -fi \ No newline at end of file +fi