This commit is contained in:
Antho 2022-08-08 02:26:28 +00:00
parent ad29e15cc0
commit 3789b538e4

View File

@ -16,14 +16,42 @@ if [ $(id -u) != 0 ] ; then
exit 1 exit 1
fi fi
apt_install() { # Menu for script
echo ""
echo "${Purple}Welcome to XO installer by Antho${NORMAL}"
echo "${Purple}XO version : from sources${NORMAL}"
echo "${Purple}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
echo ""
echo "SELECT YOUR FAVORITE FRUIT";
echo "1. Install"
echo "2. Update"
echo "9. Exit"
echo -n "Enter your choice [1-9]: "
while :
do
read choice
case $choice in
# Install
1) apt_install() {
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "${Red}Cannot install $@ - Cancellation${NORMAL}" echo "${Red}Cannot install $@ - Cancellation${NORMAL}"
exit 1 exit 1
fi fi
} }
step_1_upgrade() { STEP=0
# Exit
9) echo "Bye ..."
exit;;
# Default
*) echo "invalid option";;
step_1_upgrade() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}" echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}"
echo "" echo ""
@ -33,9 +61,9 @@ step_1_upgrade() {
apt install -y npm apt install -y npm
echo "${Green}Step 1 completed${NORMAL}" echo "${Green}Step 1 completed${NORMAL}"
echo "" echo ""
} }
step_2_node_install() { step_2_node_install() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 2 Node v16 install${NORMAL}" echo "${Yellow}Starting step 2 Node v16 install${NORMAL}"
echo "" echo ""
@ -43,18 +71,18 @@ step_2_node_install() {
apt install -y nodejs apt install -y nodejs
echo "${Green}Step 2 completed${NORMAL}" echo "${Green}Step 2 completed${NORMAL}"
echo "" echo ""
} }
step_3_yarn_install() { step_3_yarn_install() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 3 Yarn install${NORMAL}" echo "${Yellow}Starting step 3 Yarn install${NORMAL}"
echo "" echo ""
npm install --global yarn npm install --global yarn
echo "${Green}Step 3 completed${NORMAL}" echo "${Green}Step 3 completed${NORMAL}"
echo "" echo ""
} }
step_4_packages_install() { step_4_packages_install() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 4 XO packages install${NORMAL}" echo "${Yellow}Starting step 4 XO packages install${NORMAL}"
echo "" echo ""
@ -68,18 +96,18 @@ step_4_packages_install() {
apt install -y cifs-utils apt install -y cifs-utils
echo "${Green}Step 4 completed${NORMAL}" echo "${Green}Step 4 completed${NORMAL}"
echo "" echo ""
} }
step_5_fetching_xo_code() { step_5_fetching_xo_code() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 5 fetching the XO code${NORMAL}" echo "${Yellow}Starting step 5 fetching the XO code${NORMAL}"
echo "" echo ""
git clone -b master https://github.com/vatesfr/xen-orchestra git clone -b master https://github.com/vatesfr/xen-orchestra
echo "${Green}Step 5 completed${NORMAL}" echo "${Green}Step 5 completed${NORMAL}"
echo "" echo ""
} }
step_6_dependencies_install() { step_6_dependencies_install() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 6 Dependency install${NORMAL}" echo "${Yellow}Starting step 6 Dependency install${NORMAL}"
echo "" echo ""
@ -91,9 +119,9 @@ step_6_dependencies_install() {
cp sample.config.toml ~/.config/xo-server/config.toml cp sample.config.toml ~/.config/xo-server/config.toml
echo "${VERT}Step 6 completed${NORMAL}" echo "${VERT}Step 6 completed${NORMAL}"
echo "" echo ""
} }
step_7_xo_running() { step_7_xo_running() {
echo "---------------------------------------------------------------------" echo "---------------------------------------------------------------------"
echo "${Yellow}Starting step 7 running XO${NORMAL}" echo "${Yellow}Starting step 7 running XO${NORMAL}"
echo "" echo ""
@ -104,16 +132,18 @@ step_7_xo_running() {
service orchestra start service orchestra start
echo "${Green}Step 7 completed${NORMAL}" echo "${Green}Step 7 completed${NORMAL}"
echo "" echo ""
} };;
2) echo " Update in progress";;
# Pattern 4
4) echo "Quiting ..."
exit;;
# Default Pattern
*) echo "invalid option";;
STEP=0
echo ""
echo "${Purple}Welcome to XO installer by Antho${NORMAL}"
echo "${Purple}XO version : from sources${NORMAL}"
echo "${Purple}XO folder : xen-orchestra/packages/xo-server${NORMAL}"
echo ""
case ${STEP} in case ${STEP} in
0) 0)