63
abra
63
abra
@ -429,19 +429,63 @@ require_consent_for_update() {
|
||||
fi
|
||||
}
|
||||
|
||||
require_plugin (){
|
||||
PLUGIN="$1"
|
||||
|
||||
BRANCH="${abra___branch:-master}"
|
||||
|
||||
warning "The $PLUGIN plugin was not found, fetching via Git"
|
||||
|
||||
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
|
||||
error "Could not retrieve the $PLUGIN plugin, does it exist?"
|
||||
fi
|
||||
|
||||
if [[ $(cd "$ABRA_DIR/apps/$APP" && 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)
|
||||
fi
|
||||
|
||||
success "Fetched the $PLUGIN plugin via Git"
|
||||
}
|
||||
|
||||
require_app (){
|
||||
APP="$1"
|
||||
APP_DIR="$ABRA_DIR/apps/$APP"
|
||||
|
||||
BRANCH="${abra___branch:-master}"
|
||||
|
||||
warning "The app type '$APP' was not found, fetching via Git"
|
||||
|
||||
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
|
||||
error "Could not retrieve app type '$APP', this app type doesn't exist?"
|
||||
fi
|
||||
|
||||
if [[ $(cd "$ABRA_DIR/apps/$APP" && 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)
|
||||
fi
|
||||
|
||||
success "Fetched app configuration via Git"
|
||||
}
|
||||
|
||||
require_app_latest() {
|
||||
APP="$1"
|
||||
APP_DIR="$ABRA_DIR/apps/$APP"
|
||||
BRANCH="${abra___branch:-master}"
|
||||
|
||||
debug "Checking for type '$APP'"
|
||||
|
||||
if [ ! -d "$APP_DIR" ]; then
|
||||
warning "The app type '$APP' was not found, fetching via Git"
|
||||
if ! git clone --branch "$BRANCH" "$GIT_URL/$APP.git" "$ABRA_DIR/apps/$APP" > /dev/null 2>&1 ; then
|
||||
error "Could not retrieve app type '$APP', this app type doesn't exist?"
|
||||
fi
|
||||
success "Fetched app configuration via Git (branch: $BRANCH)"
|
||||
require_app "$APP"
|
||||
fi
|
||||
|
||||
debug "Using $APP_DIR"
|
||||
@ -1712,18 +1756,13 @@ sub_server_new() {
|
||||
require_abra_dir
|
||||
|
||||
PROVIDER="$abra__provider_"
|
||||
BRANCH="${abra___branch:-master}"
|
||||
|
||||
if [ "$PROVIDER" != "hetzner" ]; then
|
||||
error "Unknown provider plugin 'abra-${PROVIDER}'"
|
||||
fi
|
||||
|
||||
if [ ! -d "$ABRA_DIR/plugins/abra-$PROVIDER" ]; then
|
||||
warning "The 'abra-$PROVIDER' plugin was not found, fetching via Git"
|
||||
if ! git clone --branch "$BRANCH" "$GIT_URL/abra-$PROVIDER.git" "$ABRA_DIR/plugins/abra-$PROVIDER" > /dev/null 2>&1 ; then
|
||||
error "Could not retrieve the abra-$PROVIDER plugin, does it exist?"
|
||||
fi
|
||||
success "Fetched abra-$PROVIDER plugin via Git (branch: $BRANCH)"
|
||||
require_plugin "abra-$PROVIDER"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
|
Reference in New Issue
Block a user