diff --git a/install/install_func.sh b/install/install_func.sh index ed550e47..e2f94721 100755 --- a/install/install_func.sh +++ b/install/install_func.sh @@ -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" diff --git a/install/prepare.sh b/install/prepare.sh index 734deffc..89ecf248 100755 --- a/install/prepare.sh +++ b/install/prepare.sh @@ -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"