Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 97a4f18

Browse files
committed
[master] check libvirt0 before install deb packge
1 parent d900cdc commit 97a4f18

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

hyper-bootstrap.sh

+21-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LINUX_MINT_CODE=(rafaela rebecca qiana)
3333
UBUNTU_CODE=(trusty utopic vivid wily xenial)
3434
DEBIAN_CODE=(jessie wheezy)
3535
CENTOS_VER=(6 7)
36-
FEDORA_VER=(20 21 22 23)
36+
FEDORA_VER=(20 21 22 23 24)
3737
#Color Constant
3838
RED=`tput setaf 1`
3939
GREEN=`tput setaf 2`
@@ -53,6 +53,7 @@ ERR_QEMU_LOW_VERSION=(41 "Need Qemu version 2.0 at least!")
5353
ERR_XEN_NOT_INSTALL=(50 "Please install xen 4.5+ first!")
5454
ERR_XEN_GET_VER_FAILED=(51 "Can not get xen version, xen daemon isn't running!")
5555
ERR_XEN_VER_LOW=(52 "Sorry, hyper only support xen 4.5+")
56+
ERR_LIBVIRT_NOT_INSTALL=(53 "hypercontainer depends on libvirt0, please install libvirt0 first!")
5657
ERR_FETCH_INST_PKG_FAILED=(60 "Fetch install package failed, please retry!")
5758
ERR_INST_PKG_MD5_ERROR=(61 "Checksum of install package error, please retry!")
5859
ERR_UNTAR_PKG_FAILED=(62 "Untar install package failed!")
@@ -72,6 +73,8 @@ main() {
7273
install_from_rpm "centos7"
7374
elif [[ "${LSB_DISTRO}" == "fedora" ]] && [[ "${CMAJOR}" == "23" ]];then
7475
install_from_rpm "fedora23"
76+
elif [[ "${LSB_DISTRO}" == "fedora" ]] && [[ "${CMAJOR}" == "24" ]];then
77+
install_from_rpm "fedora24"
7578
elif [[ "${LSB_DISTRO}" == "ubuntu" ]];then
7679
check_deps
7780
install_from_deb "ubuntu"
@@ -438,7 +441,7 @@ install_from_rpm(){
438441
handle_hyper_rpm_rename
439442
${BASH_C} "yum ${_ACT} -y ${S3_URL}/${CENTOS7_QEMU_HYPER}.rpm ${S3_URL}/${CENTOS7_HYPERSTART}.rpm ${S3_URL}/${CENTOS7_HYPER}.rpm"
440443
;;
441-
fedora23)
444+
fedora23|fedora24)
442445
rpm -qa | grep ${FC23_HYPER} > /dev/null 2>&1
443446
if [[ $? -eq 0 ]];then
444447
show_message info "${ERR_HYPER_NO_NEW_VERSION[1]}"; exit 1
@@ -458,6 +461,15 @@ install_from_rpm(){
458461
install_from_deb(){
459462
show_message info "Fetch deb package for $1...\n"
460463
set +e
464+
local USE_WGET=$( echo $(get_curl) | awk -F"|" '{print $1}' )
465+
local CURL_C=$( echo $(get_curl) | awk -F"|" '{print $2}' )
466+
LIBVIRT0=`dpkg -s libvirt0 2>/dev/null| grep Version| wc -l`
467+
if [ ${LIBVIRT0} -eq 0 ];then
468+
show_message info "hypercontainer depends on libvirt0(1.2.16-2+), start install libvirt0...\n"
469+
show_message error "${ERR_LIBVIRT_NOT_INSTALL[1]}"
470+
exit ${ERR_LIBVIRT_NOT_INSTALL[0]}
471+
fi
472+
461473
${BASH_C} "ping -c 3 -W 2 hypercontainer-install.s3.amazonaws.com >/dev/null 2>&1"
462474
if [[ $? -ne 0 ]];then
463475
S3_URL="http://mirror-hypercontainer-install.s3.amazonaws.com"
@@ -475,8 +487,13 @@ install_from_deb(){
475487
else
476488
_ACT="install"
477489
fi
478-
${BASH_C} "wget -q -O /tmp/${DEBIAN_HYPERSTART}.deb ${S3_URL}/${DEBIAN_HYPERSTART}.deb && dpkg -i /tmp/${DEBIAN_HYPERSTART}.deb"
479-
${BASH_C} "wget -q -O /tmp/${DEBIAN_HYPER}.deb ${S3_URL}/${DEBIAN_HYPER}.deb && dpkg -i /tmp/${DEBIAN_HYPER}.deb"
490+
if [[ "${USE_WGET}" == "true" ]];then
491+
${BASH_C} "${CURL_C} -O /tmp/${DEBIAN_HYPERSTART}.deb ${S3_URL}/${DEBIAN_HYPERSTART}.deb && dpkg -i /tmp/${DEBIAN_HYPERSTART}.deb"
492+
${BASH_C} "${CURL_C} -O /tmp/${DEBIAN_HYPER}.deb ${S3_URL}/${DEBIAN_HYPER}.deb && dpkg -i /tmp/${DEBIAN_HYPER}.deb"
493+
else
494+
${BASH_C} "${CURL_C} /tmp/${DEBIAN_HYPERSTART}.deb ${S3_URL}/${DEBIAN_HYPERSTART}.deb && dpkg -i /tmp/${DEBIAN_HYPERSTART}.deb"
495+
${BASH_C} "${CURL_C} /tmp/${DEBIAN_HYPER}.deb ${S3_URL}/${DEBIAN_HYPER}.deb && dpkg -i /tmp/${DEBIAN_HYPER}.deb"
496+
fi
480497
;;
481498
*) show_message error "deb install support debian & ubuntu only"; exit 1;;
482499
esac

0 commit comments

Comments
 (0)