Fix plugin require logic
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2021-04-07 19:54:48 +02:00
parent b2e66a01fc
commit 08de1e0676
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 5 additions and 3 deletions

8
abra
View File

@ -510,18 +510,20 @@ require_plugin() {
warning "The $PLUGIN plugin was not found, fetching via Git"
mkdir -p "$ABRA_DIR/plugins"
if [[ "$BRANCH" != "master" ]]; then
git_extra_args="--branch $BRANCH"
fi
# shellcheck disable=SC2086
if ! git clone ${git_extra_args:-} "$GIT_URL/$APP.git" "$ABRA_DIR/apps/$APP" > /dev/null 2>&1 ; then
if ! git clone ${git_extra_args:-} "$GIT_URL/$PLUGIN.git" "$ABRA_DIR/plugins/$PLUGIN" > /dev/null 2>&1 ; then
error "Could not retrieve the $PLUGIN plugin, does it exist?"
fi
if [[ $(cd "$ABRA_DIR/apps/$APP" && git branch --list | wc -l) == "0" ]]; then
if [[ $(cd "$ABRA_DIR/plugins/$PLUGIN" && git branch --list | wc -l) == "0" ]]; then
debug "Failed to clone default branch, guessing alternative is 'main'"
(cd "$ABRA_DIR/apps/$APP" && git checkout main > /dev/null 2>&1)
(cd "$ABRA_DIR/plugins/$PLUGIN" && git checkout main > /dev/null 2>&1)
fi
success "Fetched the $PLUGIN plugin via Git"