From 08de1e0676623a1b127b3a57166036515fbe8e0f Mon Sep 17 00:00:00 2001 From: decentral1se Date: Wed, 7 Apr 2021 19:54:48 +0200 Subject: [PATCH] Fix plugin require logic --- abra | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/abra b/abra index 2eb5884..606b923 100755 --- a/abra +++ b/abra @@ -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"