2016-03-01 13:26:35 -08:00
|
|
|
#!/usr/bin/env bash
|
2019-01-07 01:04:17 -05:00
|
|
|
set -eo pipefail
|
|
|
|
|
[[ $DOKKU_TRACE ]] && set -x
|
2016-03-01 13:26:35 -08:00
|
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
|
|
|
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
2018-04-27 12:33:33 -04:00
|
|
|
source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
|
2016-03-01 13:26:35 -08:00
|
|
|
|
2020-02-09 22:41:39 -05:00
|
|
|
cmd-plugin-install() {
|
2016-03-08 15:30:34 -05:00
|
|
|
declare desc="installs a plugin from URL and calls install plugin trigger via command line"
|
2020-02-10 01:40:30 -05:00
|
|
|
declare cmd="plugin:install"
|
|
|
|
|
[[ "$1" == "$cmd" ]] && shift 1
|
|
|
|
|
declare FLAG="$1"
|
|
|
|
|
|
|
|
|
|
case "$FLAG" in
|
2016-03-01 13:26:35 -08:00
|
|
|
--core)
|
2020-02-10 01:40:30 -05:00
|
|
|
[[ "$#" -gt 1 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
|
2016-03-01 13:26:35 -08:00
|
|
|
PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install
|
|
|
|
|
;;
|
2019-04-23 15:23:35 +07:00
|
|
|
https:* | git* | ssh:* | file:* | *.tar.gz | *.tgz)
|
2016-03-01 13:26:35 -08:00
|
|
|
download_and_enable_plugin "$@"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2021-01-18 00:29:10 -05:00
|
|
|
if [[ -n "$FLAG" ]]; then
|
|
|
|
|
dokku_log_warn "First argument must be --core or url to plugin"
|
|
|
|
|
dokku_log_warn "Valid prefixes: https:, git:, ssh:, file:"
|
|
|
|
|
dokku_log_warn "Valid suffixes: .tar.gz, .tgz"
|
|
|
|
|
dokku_log_fail "Please retry with valid arguments"
|
|
|
|
|
fi
|
2016-03-01 13:26:35 -08:00
|
|
|
plugn trigger install
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2018-04-27 04:09:53 -04:00
|
|
|
plugin_prime_bash_completion
|
2016-03-01 13:26:35 -08:00
|
|
|
}
|
|
|
|
|
|
2020-02-09 22:41:39 -05:00
|
|
|
cmd-plugin-install "$@"
|