Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3789b538e4 |
216
install.sh
216
install.sh
|
@ -16,104 +16,134 @@ if [ $(id -u) != 0 ] ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
apt_install() {
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${Red}Cannot install $@ - Cancellation${NORMAL}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
step_1_upgrade() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}"
|
||||
echo ""
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt install -y curl
|
||||
apt install -y npm
|
||||
echo "${Green}Step 1 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_2_node_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 2 Node v16 install${NORMAL}"
|
||||
echo ""
|
||||
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
|
||||
apt install -y nodejs
|
||||
echo "${Green}Step 2 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_3_yarn_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 3 Yarn install${NORMAL}"
|
||||
echo ""
|
||||
npm install --global yarn
|
||||
echo "${Green}Step 3 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_4_packages_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 4 XO packages install${NORMAL}"
|
||||
echo ""
|
||||
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 "${Green}Step 4 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_5_fetching_xo_code() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 5 fetching the XO code${NORMAL}"
|
||||
echo ""
|
||||
git clone -b master https://github.com/vatesfr/xen-orchestra
|
||||
echo "${Green}Step 5 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_6_dependencies_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 6 Dependency install${NORMAL}"
|
||||
echo ""
|
||||
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}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_7_xo_running() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 7 running XO${NORMAL}"
|
||||
echo ""
|
||||
yarn global add forever
|
||||
yarn global add forever-service
|
||||
cd /home/root/xen-orchestra/packages/xo-server/
|
||||
forever-service install orchestra -r root -s dist/cli.mjs
|
||||
service orchestra start
|
||||
echo "${Green}Step 7 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
STEP=0
|
||||
|
||||
# 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
|
||||
echo "${Red}Cannot install $@ - Cancellation${NORMAL}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
STEP=0
|
||||
|
||||
# Exit
|
||||
9) echo "Bye ..."
|
||||
exit;;
|
||||
# Default
|
||||
*) echo "invalid option";;
|
||||
|
||||
|
||||
step_1_upgrade() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 1 Update and base pakage${NORMAL}"
|
||||
echo ""
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt install -y curl
|
||||
apt install -y npm
|
||||
echo "${Green}Step 1 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_2_node_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 2 Node v16 install${NORMAL}"
|
||||
echo ""
|
||||
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
|
||||
apt install -y nodejs
|
||||
echo "${Green}Step 2 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_3_yarn_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 3 Yarn install${NORMAL}"
|
||||
echo ""
|
||||
npm install --global yarn
|
||||
echo "${Green}Step 3 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_4_packages_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 4 XO packages install${NORMAL}"
|
||||
echo ""
|
||||
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 "${Green}Step 4 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_5_fetching_xo_code() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 5 fetching the XO code${NORMAL}"
|
||||
echo ""
|
||||
git clone -b master https://github.com/vatesfr/xen-orchestra
|
||||
echo "${Green}Step 5 completed${NORMAL}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_6_dependencies_install() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 6 Dependency install${NORMAL}"
|
||||
echo ""
|
||||
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}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
step_7_xo_running() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo "${Yellow}Starting step 7 running XO${NORMAL}"
|
||||
echo ""
|
||||
yarn global add forever
|
||||
yarn global add forever-service
|
||||
cd /home/root/xen-orchestra/packages/xo-server/
|
||||
forever-service install orchestra -r root -s dist/cli.mjs
|
||||
service orchestra start
|
||||
echo "${Green}Step 7 completed${NORMAL}"
|
||||
echo ""
|
||||
};;
|
||||
|
||||
2) echo " Update in progress";;
|
||||
|
||||
# Pattern 4
|
||||
4) echo "Quiting ..."
|
||||
exit;;
|
||||
# Default Pattern
|
||||
*) echo "invalid option";;
|
||||
|
||||
|
||||
|
||||
|
||||
case ${STEP} in
|
||||
0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user