From 7d5305fd0fd2b80de0881e57ffe5bd028c13a257 Mon Sep 17 00:00:00 2001 From: ronivay Date: Mon, 12 Nov 2018 17:06:23 +0200 Subject: [PATCH] add option to install all available plugins, fix config file paths, fix typo and update README --- README.md | 4 ++-- sample.xo-install.cfg | 3 ++- xo-install.sh | 34 ++++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2c82f98..eeefe01 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This repo consist of script to install and update [Xen Orchestra](https://xen-or Installation is done using latest xo-server and xo-web sources. With this method Xen-Orchestra has all features unlocked which are normally available only with monthly fee. -Optional plugins can be installed. They are included in XO repository, but not installed by default. Check list from [Xen Orchestra plugins](https://github.com/vatesfr/xen-orchestra/tree/master/packages) and edit xo-install.sh accordingly. +Optional plugins can be installed. They are included in XO repository, but not installed by default. Check list from [Xen Orchestra plugins](https://github.com/vatesfr/xen-orchestra/tree/master/packages) and edit xo-install.cfg accordingly. Paid version comes with pro support and appliance and is the suggested option for larger environments. Method that this script offers comes with no support and is not the officially recommended way of using Xen-Orchestra. This is mainly intended for testing purposes and small environments which don't require support. @@ -52,7 +52,7 @@ Tool makes some checks and offers options: notes: - If you choose to install with option 2, you need to take care that required packages are already installed - - You can change xo-server and xo-web git branch by editing xo-install.sh scripts $BRANCH variable + - You can change xo-server and xo-web git branch/tag by editing xo-install.cfg $BRANCH variable ### docker You can also build the docker image locally if you wish or pull it from [docker hub](https://hub.docker.com/r/ronivay/xen-orchestra/) without using the script. diff --git a/sample.xo-install.cfg b/sample.xo-install.cfg index 16195c3..7ad731e 100644 --- a/sample.xo-install.cfg +++ b/sample.xo-install.cfg @@ -14,8 +14,9 @@ BRANCH="master" # Log path for possible errors LOGFILE="$(dirname $0)/xo-install.log" -# comma separated list of plugins to be installed, check README for more information +# Comma separated list of plugins to be installed, check README for more information. Optionally set to all, to install all plugins #PLUGINS="xo-server-transport-email,xo-server-usage-report,xo-server-perf-alert" +#PLUGINS="all" # NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it. AUTOUPDATE="true" diff --git a/xo-install.sh b/xo-install.sh index be2b8df..febf8b5 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -6,8 +6,8 @@ # Repository: https://github.com/ronivay/XenOrchestraInstallerUpdater # ######################################################################### -SAMPLE_CONFIG_FILE="sample.xo-install.cfg" -CONFIG_FILE="xo-install.cfg" +SAMPLE_CONFIG_FILE="$(dirname $0)/sample.xo-install.cfg" +CONFIG_FILE="$(dirname $0)/xo-install.cfg" # Deploy default configuration file if the user doesn't have their own yet. if [[ ! -e "$CONFIG_FILE" ]]; then @@ -201,18 +201,24 @@ function InstallXOPlugins { if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then - echo - echo "Installing plugins defined in PLUGINS variable" - echo - local PLUGINSARRAY=($(echo "$PLUGINS" | tr ',' ' ')) - for x in "${PLUGINSARRAY[@]}"; do - if [[ $(find $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages -type d -name "$x") ]]; then - ln -sn $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/$x $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/node_modules/ - else - echo "No $x plugin found from xen-orchestra packages, skipping" + if [[ "$PLUGINS" == "all" ]]; then + echo + echo "Installing all available plugins as defined in PLUGINS variable" + find "$INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/" -maxdepth 1 -mindepth 1 -not -name "xo-server" -not -name "xo-web" -not -name "xo-server-cloud" -exec ln -sn {} "$INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/node_modules/" \; + else + echo + echo "Installing plugins defined in PLUGINS variable" + echo + local PLUGINSARRAY=($(echo "$PLUGINS" | tr ',' ' ')) + for x in "${PLUGINSARRAY[@]}"; do + if [[ $(find $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages -type d -name "$x") ]]; then + ln -sn $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/$x $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/node_modules/ + else + echo "No $x plugin found from xen-orchestra packages, skipping" continue - fi - done + fi + done + fi cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn >/dev/null && yarn build >/dev/null else @@ -434,7 +440,7 @@ function InstallXO { timeout 60 bash <<-"EOF" while [[ -z $(journalctl -u xo-server | sed -n 'H; /Starting XO Server/h; ${g;p;}' | grep "https\{0,1\}:\/\/\[::\]:$PORT") ]]; do - echo "waiting port to be open" + echo "waiting for port to be open" sleep 10 done EOF