Add script
This commit is contained in:
parent
30a26a8385
commit
ea89071081
128
install.sh
Normal file
128
install.sh
Normal file
|
@ -0,0 +1,128 @@
|
|||
|
||||
#!/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"
|
||||
|
||||
if [ $(id -u) != 0 ] ; then
|
||||
echo "Super-user (root) rights are required to install "
|
||||
echo "Please run 'sudo $0' or login as root, then restart $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt_install() {
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${ROUGE}Cannot install $@ - Cancellation${NORMAL}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
step_1_upgrade() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}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}"
|
||||
}
|
||||
|
||||
step_2_node_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}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}"
|
||||
}
|
||||
|
||||
step_3_yarn_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}Starting step 3 Yarn install${NORMAL}"
|
||||
npm install --global yarn
|
||||
echo "${VERT}Step 3 completed${NORMAL}"
|
||||
}
|
||||
|
||||
step_4_packages_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}Starting step 4 XO packages install${NORMAL}"
|
||||
apt install -y build-essential
|
||||
apt install -y redis-server
|
||||
apt install -y libpng-dev
|
||||
apt install -y git
|
||||
apt install -y python3-minimal
|
||||
apt install -y libvhdi-utils
|
||||
apt install -y lvm2
|
||||
apt install -y cifs-utils
|
||||
echo "${VERT}Step 4 completed${NORMAL}"
|
||||
}
|
||||
|
||||
step_5_fetching_xo_code() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}Starting step 5 fetching the XO code${NORMAL}"
|
||||
git clone -b master https://github.com/vatesfr/xen-orchestra
|
||||
echo "${VERT}Step 5 completed${NORMAL}"
|
||||
}
|
||||
|
||||
step_6_dependencies_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}Starting step 6 Dependency install${NORMAL}"
|
||||
cd xen-orchestra
|
||||
yarn
|
||||
yarn build
|
||||
cd packages/xo-server
|
||||
mkdir -p ~/.config/xo-server
|
||||
cp sample.config.toml ~/.config/xo-server/config.toml
|
||||
echo "${VERT}Step 6 completed${NORMAL}"
|
||||
}
|
||||
|
||||
step_7_xo_running() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${JAUNE}Starting step 7 running XO${NORMAL}"
|
||||
yarn start
|
||||
echo "${VERT}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}"
|
||||
|
||||
case ${STEP} in
|
||||
0)
|
||||
echo "${JAUNE}Commence toutes les étapes de l'installation${NORMAL}"
|
||||
step_1_upgrade
|
||||
step_2_node_install
|
||||
step_3_yarn_install
|
||||
step_4_packages_install
|
||||
step_5_fetching_xo_code
|
||||
step_6_dependencies_install
|
||||
step_7_xo_running
|
||||
echo "Installation complete."
|
||||
;;
|
||||
1) step_1_upgrade
|
||||
;;
|
||||
2) step_2_node_install
|
||||
;;
|
||||
3) step_3_yarn_install
|
||||
;;
|
||||
4) step_4_packages_install
|
||||
;;
|
||||
5) step_5_fetching_xo_code
|
||||
;;
|
||||
6) step_6_dependencies_install
|
||||
;;
|
||||
7) step_7_xo_running
|
||||
;;
|
||||
*) echo "${ROUGE}Sorry, I cannot select a ${STEP} step for you!${NORMAL}"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user