tidy up plugin installation function

This commit is contained in:
ronivay
2021-05-03 15:07:39 +03:00
parent 3b517d79d9
commit 1f7e0d1a75

View File

@@ -370,16 +370,19 @@ function InstallXOPlugins {
trap ErrorHandling ERR INT
if [[ -n "$PLUGINS" ]] && [[ "$PLUGINS" != "none" ]]; then
if [[ -z "$PLUGINS" ]] || [[ "$PLUGINS" == "none" ]]; then
echo
printinfo "No plugins to install"
return 0
fi
if [[ "$PLUGINS" == "all" ]]; then
echo
printprog "Installing plugins"
if [[ "$PLUGINS" == "all" ]]; then
cmdlog "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/\""
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/" \; >>$LOGFILE 2>&1
else
echo
printprog "Installing plugins"
local PLUGINSARRAY=($(echo "$PLUGINS" | tr ',' ' '))
for x in "${PLUGINSARRAY[@]}"; do
if [[ $(find $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages -type d -name "$x") ]]; then
@@ -392,10 +395,6 @@ function InstallXOPlugins {
cmdlog "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn && yarn build"
cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn >>$LOGFILE 2>&1 && yarn build >>$LOGFILE 2>&1 || false
printok "Installing plugins"
else
echo
printinfo "No plugins to install"
fi
}