1
0
mirror of https://github.com/rancher/os.git synced 2025-06-23 13:37:03 +00:00
os/scripts/tar-images

30 lines
894 B
Bash
Executable File

#!/bin/bash
set -ex
cd $(dirname $0)/..
IMAGES=$(bin/host_ros c images -i build/initrd/usr/share/ros/os-config.yml)
echo "tar-image: IMAGES=$IMAGES"
for i in $IMAGES; do
echo "tar-image: pull($i)"
if [ "${FORCE_PULL}" = "1" ] || ! docker inspect $i >/dev/null 2>&1; then
docker pull $i
fi
done
if [ -e ".make-vmware" ]; then
docker pull rancher/os-openvmtools:${OPEN_VMTOOLS_VERSION}
IMAGES="$IMAGES rancher/os-openvmtools:${OPEN_VMTOOLS_VERSION}"
fi
echo "tar-images: docker save ${IMAGES}"
if [ "$COMPRESS" == "" ]; then
docker save ${IMAGES} | gzip > build/images.tar
else
# system-docker can not load images which compressed by xz with a compression level of 9
# decompression consumes more memory if using level 9
# the default compression level for xz is 6
docker save ${IMAGES} | xz -6 -e > build/images.tar
fi
echo "tar-images: DONE"