Merge pull request #86 from ixs/add_plugins

Add ability to install 3rd party plugins
This commit is contained in:
Roni Väyrynen
2021-06-30 16:04:01 +03:00
committed by GitHub
2 changed files with 47 additions and 0 deletions

View File

@@ -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"

View File

@@ -27,6 +27,7 @@ PRESERVE=${PRESERVE:-"3"}
XOUSER=${XOUSER:-"root"}
CONFIGPATH="$(getent passwd $XOUSER | cut -d: -f6)"
PLUGINS="${PLUGINS:-"none"}"
ADDITIONAL_PLUGINS="${ADDITIONAL_PLUGINS:-"none"}"
REPOSITORY="${REPOSITORY:-"https://github.com/vatesfr/xen-orchestra"}"
OS_CHECK="${OS_CHECK:-"true"}"
ARCH_CHECK="${ARCH_CHECK:-"true"}"
@@ -368,6 +369,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 +613,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"