update tensorflow script

This commit is contained in:
bigeagle 2016-11-06 22:11:32 +08:00
parent 3a6167bf48
commit 41c93a8b87

View File

@ -4,9 +4,6 @@ set -u
set -e
set -o pipefail
_here=`dirname $(realpath $0)`
. ${_here}/helpers/helpers
XMLPARSE="${_here}/helpers/tf-xml-filelist.py"
TF_UPSTREAM_BASE_URL=${TUNASYNC_UPSTREAM_URL:-"https://storage.googleapis.com/tensorflow"}
@ -19,7 +16,7 @@ TF_UPSTREAM_BASE_URL=${TF_UPSTREAM_BASE_URL%/}
failed=0
wget -O - "${TF_UPSTREAM_BASE_URL}/" | ${XMLPARSE} | while read -a tokens; do
filename=${tokens[0]}
filesize=${tokens[1]}
pkgsize=${tokens[1]}
# Notice: the filename starts with no leading '/'!
pkgurl="${TF_UPSTREAM_BASE_URL}/${filename}"
@ -27,11 +24,22 @@ wget -O - "${TF_UPSTREAM_BASE_URL}/" | ${XMLPARSE} | while read -a tokens; do
pkgdir=`dirname ${pkgdst}`
mkdir -p ${pkgdir}
echo "downloading ${pkgurl}"
declare downloaded=false
if [[ -f ${pkgdst} ]]; then
local_size=`stat -c "%s" ${pkgdst}`
if [ ${local_size} -eq ${pkgsize} ]; then
downloaded=true
echo "Skipping ${pkgdst}, size ${pkgsize}"
fi
fi
[[ $downloaded == true ]] && continue
echo "downloading ${pkgurl} to ${pkgdst}"
if [[ -z ${DRY_RUN:-} ]]; then
check-and-download ${pkgurl} ${pkgdst} || failed=1
wget ${WGET_OPTIONS:-} -q -O ${pkgdst} ${pkgurl} || failed=1
fi
done
exit $failed