Update install.sh

(Change and debug message coloring)
This commit is contained in:
Antho 2022-05-05 19:52:01 +00:00
parent ea89071081
commit 3f21aaeaf9

View File

@ -1,14 +1,14 @@
#!/bin/sh
VERT="\\033[1;32m"
NORMAL="\\033[0;39m"
ROUGE="\\033[1;31m"
ROSE="\\033[1;35m"
BLEU="\\033[1;34m"
BLANC="\\033[0;02m"
BLANCLAIR="\\033[1;08m"
JAUNE="\\033[1;33m"
CYAN="\\033[1;36m"
Black='\033[0;30m'
Red='\033[0;31m'
Green='\033[0;32m'
Yellow='\033[0;33m'
Blue='\033[0;34m'
Purple='\033[0;35m'
Cyan='\033[0;36m'
White='\033[0;37m'
NORMAL=$(tput sgr0)
if [ $(id -u) != 0 ] ; then
echo "Super-user (root) rights are required to install "
@ -18,39 +18,39 @@ fi
apt_install() {
if [ $? -ne 0 ]; then
echo "${ROUGE}Cannot install $@ - Cancellation${NORMAL}"
echo "${Red}Cannot install $@ - Cancellation${NORMAL}"
exit 1
fi
}
step_1_upgrade() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 1 Update and base pakage${NORMAL}"
echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}"
apt update
apt upgrade -y
apt install -y curl
apt install -y npm
echo "${VERT}Step 1 completed${NORMAL}"
echo "${Green}Step 1 completed${NORMAL}"
}
step_2_node_install() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 2 Node v14 install${NORMAL}"
echo "${Yellow}Starting step 2 Node v14 install${NORMAL}"
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt install -y nodejs
echo "${VERT}Step 2 completed${NORMAL}"
echo "${Green}Step 2 completed${NORMAL}"
}
step_3_yarn_install() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 3 Yarn install${NORMAL}"
echo "${Yellow}Starting step 3 Yarn install${NORMAL}"
npm install --global yarn
echo "${VERT}Step 3 completed${NORMAL}"
echo "${Green}Step 3 completed${NORMAL}"
}
step_4_packages_install() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 4 XO packages install${NORMAL}"
echo "${Yellow}Starting step 4 XO packages install${NORMAL}"
apt install -y build-essential
apt install -y redis-server
apt install -y libpng-dev
@ -59,19 +59,19 @@ step_4_packages_install() {
apt install -y libvhdi-utils
apt install -y lvm2
apt install -y cifs-utils
echo "${VERT}Step 4 completed${NORMAL}"
echo "${Green}Step 4 completed${NORMAL}"
}
step_5_fetching_xo_code() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 5 fetching the XO code${NORMAL}"
echo "${Yellow}Starting step 5 fetching the XO code${NORMAL}"
git clone -b master https://github.com/vatesfr/xen-orchestra
echo "${VERT}Step 5 completed${NORMAL}"
echo "${Green}Step 5 completed${NORMAL}"
}
step_6_dependencies_install() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 6 Dependency install${NORMAL}"
echo "${Yellow}Starting step 6 Dependency install${NORMAL}"
cd xen-orchestra
yarn
yarn build
@ -83,21 +83,21 @@ step_6_dependencies_install() {
step_7_xo_running() {
echo "---------------------------------------------------------------------"
echo "${JAUNE}Starting step 7 running XO${NORMAL}"
echo "${Yellow}Starting step 7 running XO${NORMAL}"
yarn start
echo "${VERT}Step 7 completed${NORMAL}"
echo "${Green}Step 7 completed${NORMAL}"
}
STEP=0
echo "${JAUNE}Welcome to XO installer${NORMAL}"
echo "${JAUNE}XO version : from sources${NORMAL}"
echo "${JAUNE}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
echo "${Yellow}Welcome to XO installer${NORMAL}"
echo "${Yellow}XO version : from sources${NORMAL}"
echo "${Yellow}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
case ${STEP} in
0)
echo "${JAUNE}Commence toutes les étapes de l'installation${NORMAL}"
echo "${Yellow}Commence toutes les étapes de l'installation${NORMAL}"
step_1_upgrade
step_2_node_install
step_3_yarn_install
@ -121,7 +121,7 @@ case ${STEP} in
;;
7) step_7_xo_running
;;
*) echo "${ROUGE}Sorry, I cannot select a ${STEP} step for you!${NORMAL}"
*) echo "${Red}Sorry, I cannot select a ${STEP} step for you!${NORMAL}"
;;
esac