Update install.sh
(Change and debug message coloring)
This commit is contained in:
		
							
								
								
									
										58
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								install.sh
									
									
									
									
									
								
							@@ -1,14 +1,14 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
VERT="\\033[1;32m"
 | 
					Black='\033[0;30m'
 | 
				
			||||||
NORMAL="\\033[0;39m"
 | 
					Red='\033[0;31m'
 | 
				
			||||||
ROUGE="\\033[1;31m"
 | 
					Green='\033[0;32m'
 | 
				
			||||||
ROSE="\\033[1;35m"
 | 
					Yellow='\033[0;33m'
 | 
				
			||||||
BLEU="\\033[1;34m"
 | 
					Blue='\033[0;34m'
 | 
				
			||||||
BLANC="\\033[0;02m"
 | 
					Purple='\033[0;35m'
 | 
				
			||||||
BLANCLAIR="\\033[1;08m"
 | 
					Cyan='\033[0;36m'
 | 
				
			||||||
JAUNE="\\033[1;33m"
 | 
					White='\033[0;37m'
 | 
				
			||||||
CYAN="\\033[1;36m"
 | 
					
 | 
				
			||||||
 | 
					NORMAL=$(tput sgr0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ $(id -u) != 0 ] ; then
 | 
					if [ $(id -u) != 0 ] ; then
 | 
				
			||||||
  echo "Super-user (root) rights are required to install "
 | 
					  echo "Super-user (root) rights are required to install "
 | 
				
			||||||
@@ -18,39 +18,39 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
apt_install() {
 | 
					apt_install() {
 | 
				
			||||||
  if [ $? -ne 0 ]; then
 | 
					  if [ $? -ne 0 ]; then
 | 
				
			||||||
    echo "${ROUGE}Cannot install $@ - Cancellation${NORMAL}"
 | 
					    echo "${Red}Cannot install $@ - Cancellation${NORMAL}"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
step_1_upgrade() {
 | 
					step_1_upgrade() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  echo "---------------------------------------------------------------------"
 | 
				
			||||||
  echo "${JAUNE}Starting step 1 Update and base pakage${NORMAL}"
 | 
					  echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}"
 | 
				
			||||||
  apt update
 | 
					  apt update
 | 
				
			||||||
  apt upgrade -y
 | 
					  apt upgrade -y
 | 
				
			||||||
  apt install -y curl
 | 
					  apt install -y curl
 | 
				
			||||||
  apt install -y npm
 | 
					  apt install -y npm
 | 
				
			||||||
  echo "${VERT}Step 1 completed${NORMAL}"
 | 
					  echo "${Green}Step 1 completed${NORMAL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
step_2_node_install() {
 | 
					step_2_node_install() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  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 -
 | 
					  curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
 | 
				
			||||||
  apt install -y nodejs
 | 
					  apt install -y nodejs
 | 
				
			||||||
  echo "${VERT}Step 2 completed${NORMAL}"
 | 
					  echo "${Green}Step 2 completed${NORMAL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
step_3_yarn_install() {
 | 
					step_3_yarn_install() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  echo "---------------------------------------------------------------------"
 | 
				
			||||||
  echo "${JAUNE}Starting step 3 Yarn install${NORMAL}"
 | 
					  echo "${Yellow}Starting step 3 Yarn install${NORMAL}"
 | 
				
			||||||
  npm install --global yarn
 | 
					  npm install --global yarn
 | 
				
			||||||
  echo "${VERT}Step 3 completed${NORMAL}"
 | 
					  echo "${Green}Step 3 completed${NORMAL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
step_4_packages_install() {
 | 
					step_4_packages_install() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  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 build-essential
 | 
				
			||||||
  apt install -y redis-server
 | 
					  apt install -y redis-server
 | 
				
			||||||
  apt install -y libpng-dev
 | 
					  apt install -y libpng-dev
 | 
				
			||||||
@@ -59,19 +59,19 @@ step_4_packages_install() {
 | 
				
			|||||||
  apt install -y libvhdi-utils
 | 
					  apt install -y libvhdi-utils
 | 
				
			||||||
  apt install -y lvm2
 | 
					  apt install -y lvm2
 | 
				
			||||||
  apt install -y cifs-utils
 | 
					  apt install -y cifs-utils
 | 
				
			||||||
  echo "${VERT}Step 4 completed${NORMAL}"
 | 
					  echo "${Green}Step 4 completed${NORMAL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
step_5_fetching_xo_code() {
 | 
					step_5_fetching_xo_code() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  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
 | 
					  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() {
 | 
					step_6_dependencies_install() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  echo "---------------------------------------------------------------------"
 | 
				
			||||||
  echo "${JAUNE}Starting step 6 Dependency install${NORMAL}"
 | 
					  echo "${Yellow}Starting step 6 Dependency install${NORMAL}"
 | 
				
			||||||
  cd xen-orchestra
 | 
					  cd xen-orchestra
 | 
				
			||||||
  yarn
 | 
					  yarn
 | 
				
			||||||
  yarn build
 | 
					  yarn build
 | 
				
			||||||
@@ -83,21 +83,21 @@ step_6_dependencies_install() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
step_7_xo_running() {
 | 
					step_7_xo_running() {
 | 
				
			||||||
  echo "---------------------------------------------------------------------"
 | 
					  echo "---------------------------------------------------------------------"
 | 
				
			||||||
  echo "${JAUNE}Starting step 7 running XO${NORMAL}"
 | 
					  echo "${Yellow}Starting step 7 running XO${NORMAL}"
 | 
				
			||||||
  yarn start
 | 
					  yarn start
 | 
				
			||||||
  echo "${VERT}Step 7 completed${NORMAL}"
 | 
					  echo "${Green}Step 7 completed${NORMAL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STEP=0
 | 
					STEP=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "${JAUNE}Welcome to XO installer${NORMAL}"
 | 
					echo "${Yellow}Welcome to XO installer${NORMAL}"
 | 
				
			||||||
echo "${JAUNE}XO version : from sources${NORMAL}"
 | 
					echo "${Yellow}XO version : from sources${NORMAL}"
 | 
				
			||||||
echo "${JAUNE}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
 | 
					echo "${Yellow}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case ${STEP} in
 | 
					case ${STEP} in
 | 
				
			||||||
  0)
 | 
					  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_1_upgrade
 | 
				
			||||||
  step_2_node_install
 | 
					  step_2_node_install
 | 
				
			||||||
  step_3_yarn_install
 | 
					  step_3_yarn_install
 | 
				
			||||||
@@ -121,7 +121,7 @@ case ${STEP} in
 | 
				
			|||||||
  ;;
 | 
					  ;;
 | 
				
			||||||
  7) step_7_xo_running
 | 
					  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
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user