1
0
mirror of https://github.com/rancher/os.git synced 2025-06-26 15:01:34 +00:00

preload.sh

This commit is contained in:
Ivan Mikushin 2015-05-19 18:53:04 +05:00
parent 8024a7b51b
commit 2c4f45ab4c

View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
BASE=${1:-${PRELOAD_DIR}}
BASE=${BASE:-/mnt/preload}
if [ -d ${BASE} ]; then
echo Preloading docker images from ${BASE}...
for file in $(ls ${BASE}); do
if [ -f ${BASE}/${file} ]; then
CAT="cat ${BASE}/${file}"
if [[ ${file} =~ \.t?gz$ ]]; then CAT="${CAT} | gunzip"; fi
if [[ ${file} =~ \.t?xz$ ]]; then CAT="${CAT} | unxz"; fi
CAT="${CAT} | docker load"
echo loading from ${BASE}/${file}
eval ${CAT} || :
fi
done
echo Done.
else
echo Can not preload images from ${BASE}: not a dir or does not exist.
fi