fix typo tag/tar and adjust download function

Change-Id: I8fc12457231a65504854736ec88be5da2d492b74
This commit is contained in:
xiaodongwang 2015-02-03 23:39:21 -08:00
parent 98c97e5d6f
commit 0281af28ec
2 changed files with 19 additions and 19 deletions

View File

@ -193,18 +193,18 @@ download()
downloaded=1
fi
fi
if [ ${#urls[@]} -eq 1 ]; then
url=${urls[0]}
else
echo "download $package from fastest urls ${url[@]}"
url=`fastesturl ${urls[@]}`
if [[ "$?" != "0" ]]; then
echo "failed to get fastest url from ${urls[@]}"
exit 1
fi
fi
if [[ "$url" =~ (http|https|ftp):// ]]; then
if [[ "$downloaded" == "0" ]]; then
if [[ "$downloaded" == "0" ]]; then
if [ ${#urls[@]} -eq 1 ]; then
url=${urls[0]}
else
echo "download $package from fastest urls ${urls[@]}"
url=`fastesturl ${urls[@]}`
if [[ "$?" != "0" ]]; then
echo "failed to get fastest url from ${urls[@]}"
exit 1
fi
fi
if [[ "$url" =~ (http|https|ftp):// ]]; then
echo "downloading $url to /tmp/${package}"
if [[ -f /tmp/${package} || -L /tmp/${package} ]]; then
curl -f -L -z /tmp/${package} -o /tmp/${package}.tmp $url
@ -220,10 +220,10 @@ download()
mv -f /tmp/${package}.tmp /tmp/${package}
fi
fi
fi
else
echo "copy $url to /tmp/${package}"
cp -rf $url /tmp/${package}
else
echo "copy $url to /tmp/${package}"
cp -rf $url /tmp/${package}
fi
fi
if [[ ! -f /tmp/${package} && ! -L /tmp/${package} ]]; then
echo "/tmp/$package is not created"

View File

@ -295,15 +295,15 @@ if [[ $LOCAL_REPO == "y" ]]; then
download -u "${LOCAL_REPO_US}/cirros-0.3.2-x86_64-disk.img" -u "${LOCAL_REPO_HUAWEI}/cirros-0.3.2-x86_64-disk.img" || exit $?
if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then
echo "download centos6.5 local repo"
download -u "${LOCAL_REPO_US}/centos/6.5/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.5/centos_repo.tag.gz" CentOS-6.5-x86_64.tar.gz || exit $?
download -u "${LOCAL_REPO_US}/centos/6.5/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.5/centos_repo.tar.gz" CentOS-6.5-x86_64.tar.gz || exit $?
fi
if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then
echo "download centos6.6 local repo"
download -u "${LOCAL_REPO_US}/centos/6.6/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.6/centos_repo.tag.gz" CentOS-6.6-x86_64.tar.gz || exit $?
download -u "${LOCAL_REPO_US}/centos/6.6/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.6/centos_repo.tar.gz" CentOS-6.6-x86_64.tar.gz || exit $?
fi
if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then
echo "download centos7.0 local repo"
download -u "${LOCAL_REPO_US}/centos/7.0/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/7.0/centos_repo.tag.gz" CentOS-7.0-x86_64.tar.gz || exit $?
download -u "${LOCAL_REPO_US}/centos/7.0/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/7.0/centos_repo.tar.gz" CentOS-7.0-x86_64.tar.gz || exit $?
fi
if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then
echo "download ubuntu12.04 local repo"