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

Commit 0028310

Browse files
committed
Merge pull request #11 from bergwolf/0.6
update linux install script for 0.6 release
2 parents d5d2564 + 61c119e commit 0028310

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

hyper-bootstrap.sh

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Description: This script is used to install hyper cli and hyperd
2+
# Description: This script is used to install hyperctl and hyperd
33
# Usage:
44
# install from remote
55
# wget -qO- http://hypercontainer.io/install | bash
@@ -14,16 +14,16 @@ CURRENT_USER="$(id -un 2>/dev/null || true)"
1414
BOOTSTRAP_DIR="/tmp/hyper-bootstrap-${CURRENT_USER}"
1515
BASH_C="bash -c"
1616
########## Parameter ##########
17-
S3_URL="http://hyper-install.s3.amazonaws.com"
17+
S3_URL="http://hypercontainer-install.s3.amazonaws.com"
1818
PKG_FILE="hyper-latest.tgz"
1919
UNTAR_DIR="hyper-pkg"
2020
SUPPORT_EMAIL="support@hyper.sh"
2121
############ RPM ##############
2222
CENTOS7_QEMU_HYPER="qemu-hyper-2.4.1-2.el7.centos.x86_64"
23-
CENTOS7_HYPERSTART="hyperstart-0.5-1.el7.centos.x86_64"
24-
CENTOS7_HYPER="hyper-0.5-1.el7.centos.x86_64"
25-
FC23_HYPERSTART="hyperstart-0.5-1.fc23.x86_64"
26-
FC23_HYPER="hyper-0.5-1.fc23.x86_64"
23+
CENTOS7_HYPERSTART="hyperstart-0.6-1.el7.centos.x86_64"
24+
CENTOS7_HYPER="hyper-container-0.6-1.el7.centos.x86_64"
25+
FC23_HYPERSTART="hyperstart-0.6-1.fc23.x86_64"
26+
FC23_HYPER="hyper-container-0.6-1.fc23.x86_64"
2727
########## Constant ##########
2828
SUPPORT_DISTRO=(debian ubuntu fedora centos linuxmint)
2929
LINUX_MINT_CODE=(rafaela rebecca qiana)
@@ -61,7 +61,7 @@ ERR_UNKNOWN_MSG_TYPE=98
6161
ERR_UNKNOWN=99
6262
########## Function Definition ##########
6363
main() {
64-
show_message info "Welcome to Install Community Edition of Hyper...\n"
64+
show_message info "Welcome to Install Community Edition of HyperContainer...\n"
6565
check_user
6666
check_os_platform
6767
check_os_distro
@@ -86,10 +86,10 @@ main() {
8686
exit 0
8787
}
8888
check_hyper_before_install() {
89-
if (command_exist hyper hyperd);then
89+
if (command_exist hyperctl hyperd);then
9090
echo "${WHITE}"
9191
cat <<COMMENT
92-
Prompt: "hyper" appears to already installed, hyperd serive will be restart during install.
92+
Prompt: "hyper-container" appears to already installed, hyperd serive will be restart during install.
9393
You may press Ctrl+C to abort this process.
9494
COMMENT
9595
echo -e -n "+ sleep ${SLEEP_SEC} seconds${RESET}"
@@ -247,11 +247,11 @@ check_deps_initsystem() {
247247
fetch_hyper_package() {
248248
show_message info "Fetch checksum and package...\n"
249249
set +e
250-
${BASH_C} "ping -c 3 -W 2 hyper-install.s3.amazonaws.com >/dev/null 2>&1"
250+
${BASH_C} "ping -c 3 -W 2 hypercontainer-install.s3.amazonaws.com >/dev/null 2>&1"
251251
if [ $? -ne 0 ];then
252-
S3_URL="http://mirror-hyper-install.s3.amazonaws.com"
252+
S3_URL="http://mirror-hypercontainer-install.s3.amazonaws.com"
253253
else
254-
S3_URL="http://hyper-install.s3.amazonaws.com"
254+
S3_URL="http://hypercontainer-install.s3.amazonaws.com"
255255
fi
256256
local SRC_URL="${S3_URL}/${PKG_FILE}"
257257
local TGT_FILE="${BOOTSTRAP_DIR}/${PKG_FILE}"
@@ -316,11 +316,11 @@ install_hyper() {
316316
show_message error "${ERR_EXEC_INSTALL_FAILED[1]}" && exit "${ERR_EXEC_INSTALL_FAILED[0]}"
317317
fi
318318
echo -n "."
319-
if [[ -f /usr/local/bin/hyper ]] && [[ -f /usr/local/bin/hyperd ]] && [[ ! -f /usr/bin/hyper ]] && [[ ! -f /usr/bin/hyperd ]] ;then
320-
${BASH_C} "ln -s /usr/local/bin/hyper /usr/bin/hyper"
319+
if [[ -f /usr/local/bin/hyperctl ]] && [[ -f /usr/local/bin/hyperd ]] && [[ ! -f /usr/bin/hyperctl ]] && [[ ! -f /usr/bin/hyperd ]] ;then
320+
${BASH_C} "ln -s /usr/local/bin/hyperctl /usr/bin/hyperctl"
321321
${BASH_C} "ln -s /usr/local/bin/hyperd /usr/bin/hyperd"
322322
fi
323-
if (command_exist hyper hyperd);then
323+
if (command_exist hyperctl hyperd);then
324324
install_hyperd_service
325325
echo -n "."
326326
else
@@ -382,8 +382,8 @@ start_hyperd_service() {
382382
show_message success "\nhyperd is running."
383383
cat <<COMMENT
384384
----------------------------------------------------
385-
To see how to use hyper cli:
386-
sudo hyper help
385+
To see how to use hyperctl:
386+
sudo hyperctl help
387387
To manage hyperd service:
388388
sudo service hyperd {start|stop|restart|status}
389389
To get more information:
@@ -399,39 +399,48 @@ COMMENT
399399
fi
400400
set -e
401401
}
402+
handle_hyper_rpm_rename(){
403+
if (command_exist hyper hyperd && ! command_exist hyperctl);then
404+
${BASH_C} "cp -f /etc/hyper/config /etc/hyper/config.rpmsave"
405+
${BASH_C} "yum remove -y hyper hyperstart"
406+
${BASH_C} "cp -f /etc/hyper/config.rpmsave /etc/hyper/config"
407+
fi
408+
}
402409
install_from_rpm(){
403410
show_message info "Fetch rpm package for $1...\n"
404411
set +e
405-
${BASH_C} "ping -c 3 -W 2 hyper-install.s3.amazonaws.com >/dev/null 2>&1"
412+
${BASH_C} "ping -c 3 -W 2 hypercontainer-install.s3.amazonaws.com >/dev/null 2>&1"
406413
if [ $? -ne 0 ];then
407-
S3_URL="http://mirror-hyper-install.s3.amazonaws.com"
414+
S3_URL="http://mirror-hypercontainer-install.s3.amazonaws.com"
408415
else
409-
S3_URL="http://hyper-install.s3.amazonaws.com"
416+
S3_URL="http://hypercontainer-install.s3.amazonaws.com"
410417
fi
411418
case "$1" in
412419
centos7)
413420
rpm -qa | grep ${CENTOS7_HYPER} > /dev/null 2>&1
414421
if [ $? -eq 0 ];then
415422
show_message info "${ERR_HYPER_NO_NEW_VERSION[1]}"; exit 1
416423
fi
417-
if (command_exist hyper hyperd);then
424+
if (command_exist hyperctl hyperd);then
418425
_ACT="update"
419426
else
420427
_ACT="install"
421428
fi
429+
handle_hyper_rpm_rename
422430
${BASH_C} "yum ${_ACT} -y ${S3_URL}/${CENTOS7_QEMU_HYPER}.rpm ${S3_URL}/${CENTOS7_HYPERSTART}.rpm ${S3_URL}/${CENTOS7_HYPER}.rpm"
423431
;;
424432
fedora23)
425433
rpm -qa | grep ${FC23_HYPER} > /dev/null 2>&1
426434
if [ $? -eq 0 ];then
427435
show_message info "${ERR_HYPER_NO_NEW_VERSION[1]}"; exit 1
428436
fi
429-
if (command_exist hyper hyperd);then
437+
if (command_exist hyperctl hyperd);then
430438
_ACT="update"
431439
else
432440
_ACT="install"
433441
fi
434-
${BASH_C} "dnf ${_ACT} ${S3_URL}/${FC23_HYPERSTART}.rpm ${S3_URL}/${FC23_HYPER}.rpm"
442+
handle_hyper_rpm_rename
443+
${BASH_C} "dnf ${_ACT} -y ${S3_URL}/${FC23_HYPERSTART}.rpm ${S3_URL}/${FC23_HYPER}.rpm"
435444
;;
436445
*) show_message error "rpm install support centos7 & fedora23 only"; exit 1;;
437446
esac

0 commit comments

Comments
 (0)