change the way plugins are read from variables and add format check to 3rd party plugins
This commit is contained in:
@@ -372,8 +372,15 @@ function InstallAdditionalXOPlugins {
|
|||||||
echo
|
echo
|
||||||
printprog "Fetching 3rd party plugin(s) source code"
|
printprog "Fetching 3rd party plugin(s) source code"
|
||||||
|
|
||||||
local ADDITIONAL_PLUGINSARRAY=($(runcmd_stdout "echo '$ADDITIONAL_PLUGINS' | tr ',' ' '"))
|
# shellcheck disable=SC1117
|
||||||
for x in "${ADDITIONAL_PLUGINSARRAY[@]}"; do
|
local ADDITIONAL_PLUGIN_REGEX="^https?:\/\/.*.git$"
|
||||||
|
IFS=',' read -ra ADDITIONAL_PLUGIN <<< "$ADDITIONAL_PLUGINS"
|
||||||
|
for x in "${ADDITIONAL_PLUGIN[@]}"; do
|
||||||
|
if ! [[ $x =~ $ADDITIONAL_PLUGIN_REGEX ]]; then
|
||||||
|
echo
|
||||||
|
printfail "$x format is not correct for 3rd party plugin, skipping.."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
local PLUGIN_NAME=$(runcmd_stdout "basename '$x' | rev | cut -c 5- | rev")
|
local PLUGIN_NAME=$(runcmd_stdout "basename '$x' | rev | cut -c 5- | rev")
|
||||||
local PLUGIN_SRC_DIR=$(runcmd_stdout "realpath -m '$XO_SRC_DIR/../$PLUGIN_NAME'")
|
local PLUGIN_SRC_DIR=$(runcmd_stdout "realpath -m '$XO_SRC_DIR/../$PLUGIN_NAME'")
|
||||||
|
|
||||||
@@ -387,6 +394,7 @@ function InstallAdditionalXOPlugins {
|
|||||||
|
|
||||||
runcmd "cp -r $PLUGIN_SRC_DIR $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/"
|
runcmd "cp -r $PLUGIN_SRC_DIR $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/"
|
||||||
done
|
done
|
||||||
|
|
||||||
printok "Fetching 3rd party plugin(s) source code"
|
printok "Fetching 3rd party plugin(s) source code"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,8 +418,8 @@ function InstallXOPlugins {
|
|||||||
# shellcheck disable=SC1117
|
# shellcheck disable=SC1117
|
||||||
runcmd "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/\" \;"
|
runcmd "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
|
else
|
||||||
local PLUGINSARRAY=($(runcmd_stdout "echo '$PLUGINS' | tr ',' ' '"))
|
IFS=',' read -ra PLUGIN <<< "$PLUGINS"
|
||||||
for x in "${PLUGINSARRAY[@]}"; do
|
for x in "${PLUGIN[@]}"; do
|
||||||
if [[ $(runcmd_stdout "find $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages -type d -name '$x'") ]]; then
|
if [[ $(runcmd_stdout "find $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages -type d -name '$x'") ]]; then
|
||||||
runcmd "ln -sn $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/$x $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/node_modules/"
|
runcmd "ln -sn $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/$x $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/node_modules/"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user