diff --git a/sample.xo-install.cfg b/sample.xo-install.cfg index d11acd8..42bc5fa 100644 --- a/sample.xo-install.cfg +++ b/sample.xo-install.cfg @@ -28,6 +28,9 @@ BRANCH="master" # (default) all plugins will be installed PLUGINS="all" +# Additional 3rd-party plugins to fetch +#ADDITIONAL_PLUGINS="https://github.com/user/repo.git,https://github.com/user/repo2.git" + # NodeJS and Yarn are automatically updated when running update/install. Can be disabled but not recommended (installation might fail because of too old node.js or yarn) # Note that if nodejs is updated when script's update feature is used, it might not be possible to use rollback option anymore without manually downgrading nodejs version to previous one AUTOUPDATE="true" diff --git a/xo-install.sh b/xo-install.sh index 7b1e561..6e7b060 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -368,6 +368,46 @@ function UpdateNodeYarn { fi } +function InstallAdditionalXOPlugins { + + set -euo pipefail + + trap ErrorHandling ERR INT + + if [[ -z "$ADDITIONAL_PLUGINS" ]] || [[ "$ADDITIONAL_PLUGINS" == "none" ]]; then + echo + printinfo "No additional plugins to install" + return 0 + fi + + echo + printprog "Installing additional plugins" + + local ADDITIONAL_PLUGINSARRAY=($(echo "$ADDITIONAL_PLUGINS" | tr ',' ' ')) + for x in "${ADDITIONAL_PLUGINSARRAY[@]}"; do + local PLUGIN_NAME=$(basename "$x" | rev | cut -c 5- | rev) + local PLUGIN_SRC_DIR=$(realpath -m "$XO_SRC_DIR/../$PLUGIN_NAME") + + if [[ ! -d "$PLUGIN_SRC_DIR" ]]; then + cmdlog "mkdir -p \"$PLUGIN_SRC_DIR\"" + mkdir -p "$PLUGIN_SRC_DIR" + cmdlog "git clone \"${x}\" \"$PLUGIN_SRC_DIR\"" + git clone "${x}" "$PLUGIN_SRC_DIR" >>$LOGFILE 2>&1 + else + cmdlog "cd \"$PLUGIN_SRC_DIR\"" + cd "$PLUGIN_SRC_DIR" >>$LOGFILE 2>&1 + cmdlog "git pull" + git pull >>$LOGFILE 2>&1 + cd $(dirname $0) >>$LOGFILE 2>&1 + cmdlog "cd $(dirname $0)" + fi + + cmdlog "cp -r $PLUGIN_SRC_DIR $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/" + cp -r "$PLUGIN_SRC_DIR" "$INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/" >>$LOGFILE 2>&1 + done + printok "Installing additional plugins" +} + function InstallXOPlugins { set -euo pipefail @@ -572,6 +612,9 @@ function InstallXO { TASK="Installation" fi + # Install additional plugins + InstallAdditionalXOPlugins + echo echo printinfo "xo-server and xo-web build takes quite a while. Grab a cup of coffee and lay back"