add v6 variant
This commit is contained in:
364
xo-install.sh
364
xo-install.sh
@@ -25,6 +25,7 @@ SELFUPGRADE=${SELFUPGRADE:-"true"}
|
|||||||
PORT=${PORT:-80}
|
PORT=${PORT:-80}
|
||||||
INSTALLDIR=${INSTALLDIR:-"/opt/xo"}
|
INSTALLDIR=${INSTALLDIR:-"/opt/xo"}
|
||||||
BRANCH=${BRANCH:-"master"}
|
BRANCH=${BRANCH:-"master"}
|
||||||
|
INCLUDE_V6=${INCLUDE_V6:-"false"}
|
||||||
LOGPATH=${LOGPATH:-$(dirname "$(realpath "$0")")/logs}
|
LOGPATH=${LOGPATH:-$(dirname "$(realpath "$0")")/logs}
|
||||||
AUTOUPDATE=${AUTOUPDATE:-"true"}
|
AUTOUPDATE=${AUTOUPDATE:-"true"}
|
||||||
PRESERVE=${PRESERVE:-"3"}
|
PRESERVE=${PRESERVE:-"3"}
|
||||||
@@ -632,14 +633,14 @@ function PrepInstall {
|
|||||||
printinfo "No changes to $XO_SVC_DESC since previous install. Run update anyway?"
|
printinfo "No changes to $XO_SVC_DESC since previous install. Run update anyway?"
|
||||||
read -r -p "[y/N]: " answer
|
read -r -p "[y/N]: " answer
|
||||||
case "$answer" in
|
case "$answer" in
|
||||||
y)
|
y)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printinfo "Cleaning up install directory: $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
|
printinfo "Cleaning up install directory: $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
|
||||||
runcmd "rm -rf $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
|
runcmd "rm -rf $INSTALLDIR/xo-builds/xen-orchestra-$TIME"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
printinfo "No changes to $XO_SVC_DESC since previous install. Skipping build. Use the --force to update anyway."
|
printinfo "No changes to $XO_SVC_DESC since previous install. Skipping build. Use the --force to update anyway."
|
||||||
@@ -700,6 +701,7 @@ function InstallXO {
|
|||||||
echo
|
echo
|
||||||
printprog "Running installation"
|
printprog "Running installation"
|
||||||
runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn --network-timeout ${YARN_NETWORK_TIMEOUT} && yarn --network-timeout ${YARN_NETWORK_TIMEOUT} build"
|
runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn --network-timeout ${YARN_NETWORK_TIMEOUT} && yarn --network-timeout ${YARN_NETWORK_TIMEOUT} build"
|
||||||
|
[ $INCLUDE_V6 == "true" ] && runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn --network-timeout ${YARN_NETWORK_TIMEOUT} run turbo run build --filter @xen-orchestra/web"
|
||||||
printok "Running installation"
|
printok "Running installation"
|
||||||
|
|
||||||
# Install plugins (takes care of 3rd party plugins as well)
|
# Install plugins (takes care of 3rd party plugins as well)
|
||||||
@@ -1101,36 +1103,36 @@ function HandleArgs {
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--force)
|
--force)
|
||||||
shift
|
shift
|
||||||
FORCE="true"
|
FORCE="true"
|
||||||
;;
|
;;
|
||||||
--update)
|
--update)
|
||||||
shift
|
shift
|
||||||
local UPDATEARG=1
|
local UPDATEARG=1
|
||||||
TASK="Update"
|
TASK="Update"
|
||||||
;;
|
;;
|
||||||
--install)
|
--install)
|
||||||
shift
|
shift
|
||||||
local INSTALLARG=1
|
local INSTALLARG=1
|
||||||
TASK="Installation"
|
TASK="Installation"
|
||||||
;;
|
;;
|
||||||
--rollback)
|
--rollback)
|
||||||
shift
|
shift
|
||||||
local ROLLBACKARG=1
|
local ROLLBACKARG=1
|
||||||
;;
|
;;
|
||||||
--proxy)
|
--proxy)
|
||||||
shift
|
shift
|
||||||
local PROXYARG=1
|
local PROXYARG=1
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1196,18 +1198,18 @@ function RollBackInstallation {
|
|||||||
echo "3. Exit"
|
echo "3. Exit"
|
||||||
read -r -p ": " answer
|
read -r -p ": " answer
|
||||||
case $answer in
|
case $answer in
|
||||||
1)
|
1)
|
||||||
XO_SVC="xo-server"
|
XO_SVC="xo-server"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
XO_SVC="xo-proxy"
|
XO_SVC="xo-proxy"
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
XO_SVC="xo-proxy"
|
XO_SVC="xo-proxy"
|
||||||
@@ -1222,38 +1224,38 @@ function RollBackInstallation {
|
|||||||
local INSTALLATION
|
local INSTALLATION
|
||||||
select INSTALLATION in "${INSTALLATIONS[@]}"; do
|
select INSTALLATION in "${INSTALLATIONS[@]}"; do
|
||||||
case $INSTALLATION in
|
case $INSTALLATION in
|
||||||
*xen-orchestra*)
|
*xen-orchestra*)
|
||||||
|
echo
|
||||||
|
if [[ "$XO_SVC" == "xo-server" ]]; then
|
||||||
|
printinfo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
|
||||||
|
runcmd "ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server"
|
||||||
|
printinfo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
|
||||||
|
runcmd "ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web"
|
||||||
|
printinfo "Setting $INSTALLDIR/xo-cli symlink to $INSTALLATION/packages/xo-cli"
|
||||||
|
runcmd "ln -sfn $INSTALLATION/packages/xo-cli $INSTALLDIR/xo-cli"
|
||||||
echo
|
echo
|
||||||
if [[ "$XO_SVC" == "xo-server" ]]; then
|
printinfo "Replacing xo.server.service systemd configuration file"
|
||||||
printinfo "Setting $INSTALLDIR/xo-server symlink to $INSTALLATION/packages/xo-server"
|
runcmd "/bin/cp -f $INSTALLATION/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service"
|
||||||
runcmd "ln -sfn $INSTALLATION/packages/xo-server $INSTALLDIR/xo-server"
|
runcmd "/bin/systemctl daemon-reload"
|
||||||
printinfo "Setting $INSTALLDIR/xo-web symlink to $INSTALLATION/packages/xo-web"
|
echo
|
||||||
runcmd "ln -sfn $INSTALLATION/packages/xo-web $INSTALLDIR/xo-web"
|
printinfo "Restarting xo-server..."
|
||||||
printinfo "Setting $INSTALLDIR/xo-cli symlink to $INSTALLATION/packages/xo-cli"
|
runcmd "/bin/systemctl restart xo-server"
|
||||||
runcmd "ln -sfn $INSTALLATION/packages/xo-cli $INSTALLDIR/xo-cli"
|
echo
|
||||||
echo
|
break
|
||||||
printinfo "Replacing xo.server.service systemd configuration file"
|
fi
|
||||||
runcmd "/bin/cp -f $INSTALLATION/packages/xo-server/xo-server.service /etc/systemd/system/xo-server.service"
|
if [[ "$XO_SVC" == "xo-proxy" ]]; then
|
||||||
runcmd "/bin/systemctl daemon-reload"
|
printinfo "Setting $INSTALLDIR/xo-proxy symlink to $INSTALLATION/@xen-orchestra/proxy"
|
||||||
echo
|
runcmd "ln -sfn $INSTALLATION/@xen-orchestra/proxy $INSTALLDIR/xo-proxy"
|
||||||
printinfo "Restarting xo-server..."
|
echo
|
||||||
runcmd "/bin/systemctl restart xo-server"
|
printinfo "Restating xo-proxy..."
|
||||||
echo
|
runcmd "/bin/systemctl restart xo-proxy"
|
||||||
break
|
echo
|
||||||
fi
|
break
|
||||||
if [[ "$XO_SVC" == "xo-proxy" ]]; then
|
fi
|
||||||
printinfo "Setting $INSTALLDIR/xo-proxy symlink to $INSTALLATION/@xen-orchestra/proxy"
|
;;
|
||||||
runcmd "ln -sfn $INSTALLATION/@xen-orchestra/proxy $INSTALLDIR/xo-proxy"
|
*)
|
||||||
echo
|
printfail "Try again"
|
||||||
printinfo "Restating xo-proxy..."
|
;;
|
||||||
runcmd "/bin/systemctl restart xo-proxy"
|
|
||||||
echo
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printfail "Try again"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1396,12 +1398,12 @@ function CheckMemory {
|
|||||||
fi
|
fi
|
||||||
read -r -p "continue anyway? y/N: " answer
|
read -r -p "continue anyway? y/N: " answer
|
||||||
case $answer in
|
case $answer in
|
||||||
y)
|
y)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1419,12 +1421,12 @@ function CheckDiskFree {
|
|||||||
fi
|
fi
|
||||||
read -r -p "continue anyway? y/N: " answer
|
read -r -p "continue anyway? y/N: " answer
|
||||||
case $answer in
|
case $answer in
|
||||||
y)
|
y)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1467,102 +1469,102 @@ function StartUpScreen {
|
|||||||
read -r -p ": " option
|
read -r -p ": " option
|
||||||
|
|
||||||
case $option in
|
case $option in
|
||||||
1)
|
1)
|
||||||
if [[ $(runcmd_stdout "pgrep -f '^([a-zA-Z0-9_\/-]+?)node.*xo-server'") ]]; then
|
if [[ $(runcmd_stdout "pgrep -f '^([a-zA-Z0-9_\/-]+?)node.*xo-server'") ]]; then
|
||||||
echo "Looks like xo-server process is already running, consider running update instead. Continue anyway?"
|
echo "Looks like xo-server process is already running, consider running update instead. Continue anyway?"
|
||||||
read -r -p "[y/N]: " answer
|
read -r -p "[y/N]: " answer
|
||||||
case $answer in
|
case $answer in
|
||||||
y)
|
y)
|
||||||
echo "Stopping xo-server..."
|
echo "Stopping xo-server..."
|
||||||
runcmd "/bin/systemctl stop xo-server" ||
|
runcmd "/bin/systemctl stop xo-server" ||
|
||||||
{
|
{
|
||||||
printfail "failed to stop service, exiting..."
|
printfail "failed to stop service, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
n)
|
n)
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
TASK="Installation"
|
|
||||||
XO_SVC="xo-server"
|
|
||||||
|
|
||||||
if [ "$PKG_FORMAT" == "rpm" ]; then
|
|
||||||
InstallDependenciesRPM
|
|
||||||
InstallXO
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
if [ "$PKG_FORMAT" == "deb" ]; then
|
*)
|
||||||
InstallDependenciesDeb
|
|
||||||
InstallXO
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
;;
|
esac
|
||||||
2)
|
fi
|
||||||
TASK="Update"
|
|
||||||
XO_SVC="xo-server"
|
|
||||||
UpdateNodeYarn
|
|
||||||
UpdateXO
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
3)
|
|
||||||
RollBackInstallation
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
4)
|
|
||||||
if [[ $(runcmd_stdout "pgrep -f '^([a-zA-Z0-9_\/-]+?)node.*xo-proxy'") ]]; then
|
|
||||||
echo "Looks like xo-proxy process is already running, consider running update instead. Continue anyway?"
|
|
||||||
read -r -p "[y/N]: " answer
|
|
||||||
case $answer in
|
|
||||||
y)
|
|
||||||
echo "Stopping xo-proxy..."
|
|
||||||
runcmd "/bin/systemctl stop xo-proxy" ||
|
|
||||||
{
|
|
||||||
printfail "failed to stop service, exiting..."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
TASK="Installation"
|
TASK="Installation"
|
||||||
XO_SVC="xo-proxy"
|
XO_SVC="xo-server"
|
||||||
|
|
||||||
if [[ "$PKG_FORMAT" == "rpm" ]]; then
|
if [ "$PKG_FORMAT" == "rpm" ]; then
|
||||||
InstallDependenciesRPM
|
InstallDependenciesRPM
|
||||||
InstallXOProxy
|
InstallXO
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$PKG_FORMAT" == "deb" ]; then
|
||||||
|
InstallDependenciesDeb
|
||||||
|
InstallXO
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
TASK="Update"
|
||||||
|
XO_SVC="xo-server"
|
||||||
|
UpdateNodeYarn
|
||||||
|
UpdateXO
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
RollBackInstallation
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
if [[ $(runcmd_stdout "pgrep -f '^([a-zA-Z0-9_\/-]+?)node.*xo-proxy'") ]]; then
|
||||||
|
echo "Looks like xo-proxy process is already running, consider running update instead. Continue anyway?"
|
||||||
|
read -r -p "[y/N]: " answer
|
||||||
|
case $answer in
|
||||||
|
y)
|
||||||
|
echo "Stopping xo-proxy..."
|
||||||
|
runcmd "/bin/systemctl stop xo-proxy" ||
|
||||||
|
{
|
||||||
|
printfail "failed to stop service, exiting..."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
if [[ "$PKG_FORMAT" == "deb" ]]; then
|
esac
|
||||||
InstallDependenciesDeb
|
fi
|
||||||
InstallXOProxy
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
5)
|
TASK="Installation"
|
||||||
TASK="Update"
|
XO_SVC="xo-proxy"
|
||||||
XO_SVC="xo-proxy"
|
|
||||||
UpdateNodeYarn
|
if [[ "$PKG_FORMAT" == "rpm" ]]; then
|
||||||
UpdateXO
|
InstallDependenciesRPM
|
||||||
|
InstallXOProxy
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
fi
|
||||||
6)
|
if [[ "$PKG_FORMAT" == "deb" ]]; then
|
||||||
|
InstallDependenciesDeb
|
||||||
|
InstallXOProxy
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
fi
|
||||||
*)
|
;;
|
||||||
echo "Please choose one of the options"
|
|
||||||
echo
|
5)
|
||||||
exit 0
|
TASK="Update"
|
||||||
;;
|
XO_SVC="xo-proxy"
|
||||||
|
UpdateNodeYarn
|
||||||
|
UpdateXO
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Please choose one of the options"
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user