Add ability to install 3rd party plugins
Depending on the situation, a user might have third party plugins that are needed for their XO setup. We're using a mysql auth plugin, but github has a handful of other third party plugins. Added: config setting ADDITIONAL_PLUGINS to specify git repo URLs. Added: InstallAdditionalXOPlugins function to download/update these repos and add them to the XO source tree before building.
This commit is contained in:
@@ -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"
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user