add status check and timeout for fastesturl
also simplified some code to retrieve a result. add huawei source for chef-server and client packages. upgrade chef-client to 11.10 to take advantage of concurrency option in knife cookbook upload. Change-Id: Ic2c771b377918622da88f7243374056d5e0b3dc2 Partial-bug: #1397309
This commit is contained in:
parent
afba46ce6b
commit
a5259401e2
@ -19,7 +19,8 @@ sudo mkdir -p /root/backup/chef
|
|||||||
|
|
||||||
sudo rpm -q chef-server
|
sudo rpm -q chef-server
|
||||||
if [[ "$?" != "0" ]]; then
|
if [[ "$?" != "0" ]]; then
|
||||||
download $CHEF_SRV chef-server install || exit $?
|
CHEF_SRV_SOURCE=`fastesturl "$CHEF_SRV" "$CHEF_SRV_HUAWEI"`
|
||||||
|
download $CHEF_SRV_SOURCE chef-server install || exit $?
|
||||||
else
|
else
|
||||||
echo "chef-server has already installed"
|
echo "chef-server has already installed"
|
||||||
fi
|
fi
|
||||||
@ -41,12 +42,13 @@ fi
|
|||||||
|
|
||||||
echo "configure chef client and knife"
|
echo "configure chef client and knife"
|
||||||
# configure chef client and knife
|
# configure chef client and knife
|
||||||
rpm -q chef
|
if [[ `rpm -q chef` ]]; then
|
||||||
if [[ "$?" != "0" ]]; then
|
sudo rpm -e `rpm -q chef`
|
||||||
download $CHEF_CLIENT `basename $CHEF_CLIENT` install || exit $?
|
|
||||||
else
|
else
|
||||||
echo "chef has already installed"
|
echo "going to install chef client"
|
||||||
fi
|
fi
|
||||||
|
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||||
|
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` install || exit $?
|
||||||
|
|
||||||
sudo mkdir -p ~/.chef
|
sudo mkdir -p ~/.chef
|
||||||
|
|
||||||
@ -71,7 +73,9 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
knife cookbook upload --all --cookbook-path /var/chef/cookbooks
|
# Fix after bug 1397309 is fixed by upgrading chef-server
|
||||||
|
# work around by reducing concurrency to 1
|
||||||
|
knife cookbook upload --all --cookbook-path /var/chef/cookbooks --concurrency 1
|
||||||
if [[ "$?" != "0" ]]; then
|
if [[ "$?" != "0" ]]; then
|
||||||
echo "failed to add cookbooks"
|
echo "failed to add cookbooks"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -235,12 +235,7 @@ fi
|
|||||||
|
|
||||||
# download packages
|
# download packages
|
||||||
cd /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
cd /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
||||||
fastesturl http://mirrors.hustunique.com http://mirror.centos.org
|
PPA_REPO_URL=`fastesturl http://mirrors.hustunique.com http://mirror.centos.org`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest url for downloading centos ppa packages"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r PPA_REPO_URL</tmp/url
|
|
||||||
centos_ppa_repo_packages="
|
centos_ppa_repo_packages="
|
||||||
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||||
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||||
@ -264,7 +259,8 @@ for f in $centos_ppa_repo_rsyslog_packages; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# download chef client for centos ppa repo
|
# download chef client for centos ppa repo
|
||||||
download $CENTOS_CHEF_CLIENT `basename $CENTOS_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||||
|
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` copy /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
||||||
|
|
||||||
# create centos repo
|
# create centos repo
|
||||||
cd ..
|
cd ..
|
||||||
@ -318,7 +314,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# download chef client for ubuntu ppa repo
|
# download chef client for ubuntu ppa repo
|
||||||
download $UBUNTU_CHEF_CLIENT `basename $UBUNTU_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/ || exit $?
|
UBUNTU_CHEF_CLIENT_SOURCE=`fastesturl "$UBUNTU_CHEF_CLIENT" "$UBUNTU_CHEF_CLIENT_HUAWEI"`
|
||||||
|
download $UBUNTU_CHEF_CLIENT_SOURCE `basename $UBUNTU_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/ || exit $?
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
find ubuntu_ppa_repo -name \*.deb -exec reprepro -Vb ubuntu_ppa_repo includedeb ppa {} \;
|
find ubuntu_ppa_repo -name \*.deb -exec reprepro -Vb ubuntu_ppa_repo includedeb ppa {} \;
|
||||||
@ -339,12 +336,7 @@ fi
|
|||||||
|
|
||||||
# import cobbler distro
|
# import cobbler distro
|
||||||
sudo mkdir -p /var/lib/cobbler/iso
|
sudo mkdir -p /var/lib/cobbler/iso
|
||||||
fastesturl $CENTOS_IMAGE_SOURCE_ASIA $CENTOS_SOURCE_MIRROR
|
CENTOS_SOURCE=`fastesturl $CENTOS_IMAGE_SOURCE_ASIA $CENTOS_IMAGE_SOURCE`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for centos iso"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r CENTOS_SOURCE</tmp/url
|
|
||||||
download "$CENTOS_SOURCE" ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
download "$CENTOS_SOURCE" ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||||
sudo mkdir -p /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}
|
sudo mkdir -p /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}
|
||||||
if [ $(mount | grep -c "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} ") -eq 0 ]; then
|
if [ $(mount | grep -c "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} ") -eq 0 ]; then
|
||||||
@ -359,12 +351,7 @@ else
|
|||||||
echo "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} has already mounted"
|
echo "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} has already mounted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fastesturl $UBUNTU_IMAGE_SOURCE_ASIA $UBUNTU_IMAGE_SOURCE
|
UBUNTU_SOURCE=`fastesturl $UBUNTU_IMAGE_SOURCE_ASIA $UBUNTU_IMAGE_SOURCE`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for ubuntu iso"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r UBUNTU_SOURCE</tmp/url
|
|
||||||
download "$UBUNTU_SOURCE" ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
download "$UBUNTU_SOURCE" ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||||
sudo mkdir -p /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}
|
sudo mkdir -p /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}
|
||||||
if [ $(mount | grep -c "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} ") -eq 0 ]; then
|
if [ $(mount | grep -c "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} ") -eq 0 ]; then
|
||||||
|
@ -67,9 +67,11 @@ export JS_MVC=${JS_MVC:-"javascriptmvc-3.2.4"}
|
|||||||
|
|
||||||
# set the chef packages download path
|
# set the chef packages download path
|
||||||
export CHEF_SRV=${CHEF_SRV:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
export CHEF_SRV=${CHEF_SRV:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||||
export CHEF_CLIENT=${CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-11.8.0-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
export CHEF_SRV_HUAWEI=${CHEF_SRV_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||||
export CENTOS_CHEF_CLIENT=${CENTOS_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.8.0-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
export CENTOS_CHEF_CLIENT=${CENTOS_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.10.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
||||||
export UBUNTU_CHEF_CLIENT=${UBUNTU_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.8.0-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
export CENTOS_CHEF_CLIENT_HUAWEI=${CENTOS_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.10.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
||||||
|
export UBUNTU_CHEF_CLIENT=${UBUNTU_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.10.4-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
||||||
|
export UBUNTU_CHEF_CLIENT_HUAWEI=${UBUNTU_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.10.4-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
||||||
# Set Chef password for Chef web UI
|
# Set Chef password for Chef web UI
|
||||||
export CHEF_PASSWD=${CHEF_PASSWD:-"root1234"}
|
export CHEF_PASSWD=${CHEF_PASSWD:-"root1234"}
|
||||||
|
|
||||||
|
@ -34,46 +34,11 @@ export ADAPTERS_SOURCE='http://git.openstack.org/stackforge/compass-adapters'
|
|||||||
# set the default cobbler user "cobbler" password, if not set, the default will be cobbler/cobbler
|
# set the default cobbler user "cobbler" password, if not set, the default will be cobbler/cobbler
|
||||||
export CBLR_USER=cobbler
|
export CBLR_USER=cobbler
|
||||||
export CBLR_PASSWD=cobbler
|
export CBLR_PASSWD=cobbler
|
||||||
|
|
||||||
# IMAGE_SOURCE is where you host your CentOS image
|
|
||||||
export IMAGE_TYPE=${IMAGE_TYPE:-"CentOS"}
|
|
||||||
export IMAGE_TYPE_OTHER=${IMAGE_TYPE_OTHER:-"el"}
|
|
||||||
export IMAGE_VERSION_MAJOR=${IMAGE_VERSION_MAJOR:-"6"}
|
|
||||||
export IMAGE_VERSION_MINOR=${IMAGE_VERSION_MINOR:-"5"}
|
|
||||||
export IMAGE_VERSION=${IMAGE_VERSION:-"${IMAGE_VERSION_MAJOR}.${IMAGE_VERSION_MINOR}"}
|
|
||||||
export IMAGE_NAME=${IMAGE_NAME:-"${IMAGE_TYPE}-${IMAGE_VERSION}"}
|
|
||||||
export IMAGE_ARCH=${IMAGE_ARCH:-"x86_64"}
|
|
||||||
|
|
||||||
export CENTOS_IMAGE_TYPE=${CENTOS_IMAGE_TYPE:-"CentOS"}
|
|
||||||
export CENTOS_IMAGE_TYPE_OTHER=${CENTOS_IMAGE_TYPE_OTHER:-"el"}
|
|
||||||
export CENTOS_IMAGE_VERSION_MAJOR=${CENTOS_IMAGE_VERSION_MAJOR:-"6"}
|
|
||||||
export CENTOS_IMAGE_VERSION_MINOR=${CENTOS_IMAGE_VERSION_MINOR:-"5"}
|
|
||||||
export CENTOS_IMAGE_VERSION=${CENTOS_IMAGE_VERSION:-"${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_VERSION_MINOR}"}
|
|
||||||
export CENTOS_IMAGE_NAME=${CENTOS_IMAGE_NAME:-"${CENTOS_IMAGE_TYPE}-${CENTOS_IMAGE_VERSION}"}
|
|
||||||
export CENTOS_IMAGE_ARCH=${CENTOS_IMAGE_ARCH:-"x86_64"}
|
|
||||||
export CENTOS_IMAGE_SOURCE=${CENTOS_IMAGE_SOURCE:-"http://mirror.rackspace.com/${CENTOS_IMAGE_TYPE,,}/${CENTOS_IMAGE_VERSION}/isos/${CENTOS_IMAGE_ARCH}/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}-minimal.iso"}
|
|
||||||
|
|
||||||
export UBUNTU_IMAGE_TYPE=${UBUNTU_IMAGE_TYPE:-"Ubuntu"}
|
|
||||||
export UBUNTU_IMAGE_VERSION_MAJOR=${UBUNTU_IMAGE_VERSION_MAJOR:-"12"}
|
|
||||||
export UBUNTU_IMAGE_VERSION_MINOR=${UBUNTU_IMAGE_VERSION_MINOR:-"04"}
|
|
||||||
export UBUNTU_IMAGE_PATCH_VERSION=${UBUNTU_IMAGE_PATCH_VERSION:=".4"}
|
|
||||||
export UBUNTU_IMAGE_VERSION=${UBUNTU_IMAGE_VERSION:-"${UBUNTU_IMAGE_VERSION_MAJOR}.${UBUNTU_IMAGE_VERSION_MINOR}"}
|
|
||||||
export UBUNTU_IMAGE_NAME=${UBUNTU_IMAGE_NAME:-"${UBUNTU_IMAGE_TYPE}-${UBUNTU_IMAGE_VERSION}"}
|
|
||||||
export UBUNTU_IMAGE_ARCH=${UBUNTU_IMAGE_ARCH:-"x86_64"}
|
|
||||||
export UBUNTU_IMAGE_ARCH_OTHER=${UBUNTU_IMAGE_ARCH_OTHER:-"amd64"}
|
|
||||||
export UBUNTU_IMAGE_SOURCE=${UBUNTU_IMAGE_SOURCE:-"http://releases.ubuntu.com/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_TYPE,,}-${UBUNTU_IMAGE_VERSION}${UBUNTU_IMAGE_PATCH_VERSION}-server-${UBUNTU_IMAGE_ARCH_OTHER}.iso"}
|
|
||||||
|
|
||||||
export COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"}
|
export COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"}
|
||||||
|
|
||||||
# Currently the use of Javascript MVC is set to version 3.2.4
|
# Currently the use of Javascript MVC is set to version 3.2.4
|
||||||
export JS_MVC=javascriptmvc-3.2.4
|
export JS_MVC=javascriptmvc-3.2.4
|
||||||
|
|
||||||
# set the chef packages download path
|
|
||||||
export CHEF_SRV=${CHEF_SRV:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
|
||||||
export CHEF_CLIENT=${CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-11.8.0-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
|
||||||
export CENTOS_CHEF_CLIENT=${CENTOS_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.8.0-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
|
||||||
export UBUNTU_CHEF_CLIENT=${UBUNTU_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.8.0-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
|
||||||
|
|
||||||
# Set Chef password for Chef web UI
|
# Set Chef password for Chef web UI
|
||||||
export CHEF_PASSWD=root1234
|
export CHEF_PASSWD=root1234
|
||||||
|
|
||||||
|
@ -5,17 +5,24 @@ fastesturl()
|
|||||||
{
|
{
|
||||||
shortest=99999
|
shortest=99999
|
||||||
fastest_url=""
|
fastest_url=""
|
||||||
|
good_code=[200,206]
|
||||||
while [ $1 ]; do
|
while [ $1 ]; do
|
||||||
url=$1
|
url=$1
|
||||||
time=`curl -o /dev/null --header "Range: bytes=0-20000" -s -w %{time_total} $url`
|
result=($(curl --max-time 20 -o /dev/null --header "Range: bytes=0-20000" -s -w "%{http_code} %{time_total}" $url))
|
||||||
if [ $(echo "$shortest > $time" | bc) -eq 1 ]; then
|
code=${result[0]}
|
||||||
shortest=$time
|
time=${result[1]}
|
||||||
echo "$url" > /tmp/url
|
if [[ ${good_code[*]} =~ $code ]]; then
|
||||||
fastest_url=$url
|
if [ $(echo "$shortest > $time" | bc) -eq 1 ]; then
|
||||||
|
shortest=$time
|
||||||
|
fastest_url=$url
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
echo "$fastest_url is the fastest source, using it"
|
if [[ -z $fastest_url ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "$fastest_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
copy2dir()
|
copy2dir()
|
||||||
|
@ -236,12 +236,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# download cobbler related packages
|
# download cobbler related packages
|
||||||
fastesturl "http://mirrors.hustunique.com" "http://mirror.centos.org"
|
CENTOS_PPA_SOURCE=`fastesturl "http://mirrors.hustunique.com" "http://mirror.centos.org"`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for centos ppa rpms"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r CENTOS_PPA_SOURCE</tmp/url
|
|
||||||
centos_ppa_repo_packages="
|
centos_ppa_repo_packages="
|
||||||
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||||
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||||
@ -265,38 +260,25 @@ for f in $centos_ppa_repo_rsyslog_packages; do
|
|||||||
download http://rpms.adiscon.com/v7-stable/epel-${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/RPMS/$f $f || exit $?
|
download http://rpms.adiscon.com/v7-stable/epel-${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/RPMS/$f $f || exit $?
|
||||||
done
|
done
|
||||||
|
|
||||||
download $CHEF_CLIENT `basename $CHEF_CLIENT` || exit $?
|
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||||
download $CENTOS_CHEF_CLIENT `basename $CENTOS_CHEF_CLIENT` || exit $?
|
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` || exit $?
|
||||||
download $UBUNTU_CHEF_CLIENT `basename $UBUNTU_CHEF_CLIENT` || exit $?
|
UBUNTU_CHEF_CLIENT_SOURCE=`fastesturl "$UBUNTU_CHEF_CLIENT" "$UBUNTU_CHEF_CLIENT_HUAWEI"`
|
||||||
|
download $UBUNTU_CHEF_CLIENT_SOURCE `basename $UBUNTU_CHEF_CLIENT_SOURCE` || exit $?
|
||||||
|
|
||||||
# download chef related packages
|
# download chef related packages
|
||||||
download $CHEF_SRV chef-server || exit $?
|
CHEF_SRV_SOURCE=`fastesturl "$CHEF_SRV" "$CHEF_SRV_HUAWEI"`
|
||||||
|
download $CHEF_SRV_SOURCE chef-server || exit $?
|
||||||
|
|
||||||
# download os images
|
# download os images
|
||||||
fastesturl $CENTOS_IMAGE_SOURCE $CENTOS_IMAGE_SOURCE_ASIA
|
CENTOS_ISO_SOURCE=`fastesturl $CENTOS_IMAGE_SOURCE $CENTOS_IMAGE_SOURCE_ASIA`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for centos image"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r CENTOS_ISO_SOURCE</tmp/url
|
|
||||||
download $CENTOS_ISO_SOURCE ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso || exit $?
|
download $CENTOS_ISO_SOURCE ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso || exit $?
|
||||||
|
|
||||||
fastesturl $UBUNTU_IMAGE_SOURCE $UBUNTU_IMAGE_SOURCE_ASIA
|
UBUNTU_ISO_SOURCE=`fastesturl $UBUNTU_IMAGE_SOURCE $UBUNTU_IMAGE_SOURCE_ASIA`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for ubuntu image"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r UBUNTU_ISO_SOURCE</tmp/url
|
|
||||||
download $UBUNTU_ISO_SOURCE ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso || exit $?
|
download $UBUNTU_ISO_SOURCE ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso || exit $?
|
||||||
|
|
||||||
# download local repo
|
# download local repo
|
||||||
if [[ $LOCAL_REPO = "y" ]]; then
|
if [[ $LOCAL_REPO = "y" ]]; then
|
||||||
fastesturl $LOCAL_REPO_US $LOCAL_REPO_HUAWEI
|
LOCAL_REPO_SOURCE=`fastesturl $LOCAL_REPO_US $LOCAL_REPO_HUAWEI`
|
||||||
if [[ "$?" != "0" ]]; then
|
|
||||||
echo "failed to determine the fastest source for local repo"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
read -r LOCAL_REPO_SOURCE</tmp/url
|
|
||||||
download $LOCAL_REPO_SOURCE local_repo.tar.gz || exit $?
|
download $LOCAL_REPO_SOURCE local_repo.tar.gz || exit $?
|
||||||
fi
|
fi
|
||||||
# Install net-snmp
|
# Install net-snmp
|
||||||
|
Loading…
Reference in New Issue
Block a user