mirror of
https://github.com/rancher/os.git
synced 2025-06-26 15:01:34 +00:00
preload.sh
This commit is contained in:
parent
8024a7b51b
commit
2c4f45ab4c
25
scripts/dockerimages/scripts/preload.sh
Executable file
25
scripts/dockerimages/scripts/preload.sh
Executable 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
|
||||
|
Loading…
Reference in New Issue
Block a user