chore(scripts): get-dashboard.sh accepts URL as arg
Also move it to scripts dir
This commit is contained in:
parent
0a51bd4c2f
commit
534b6c0062
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ $(REBAR): ensure-rebar3
|
|||
|
||||
.PHONY: get-dashboard
|
||||
get-dashboard:
|
||||
$(CURDIR)/get-dashboard.sh $(DASHBOARD_VERSION)
|
||||
$(CURDIR)/scripts/get-dashboard.sh $(DASHBOARD_VERSION)
|
||||
|
||||
.PHONY: eunit
|
||||
eunit: $(REBAR)
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
## NOTE: execute this script in the project root
|
||||
|
||||
VERSION="$1"
|
||||
set -euo pipefail
|
||||
|
||||
# ensure dir
|
||||
cd -P -- "$(dirname -- "$0")"
|
||||
if [[ "$1" == https://* ]]; then
|
||||
VERSION='*' # alwyas download
|
||||
DOWNLOAD_URL="$1"
|
||||
else
|
||||
VERSION="$1"
|
||||
DOWNLOAD_URL="https://github.com/emqx/emqx-dashboard-frontend/releases/download/${VERSION}/emqx-dashboard.zip"
|
||||
fi
|
||||
|
||||
DOWNLOAD_URL='https://github.com/emqx/emqx-dashboard-frontend/releases/download'
|
||||
|
||||
if [ "$EMQX_ENTERPRISE" = 'true' ] || [ "$EMQX_ENTERPRISE" == '1' ]; then
|
||||
if [ "${EMQX_ENTERPRISE:-}" = 'true' ] || [ "${EMQX_ENTERPRISE:-}" == '1' ]; then
|
||||
DASHBOARD_PATH='lib-ee/emqx_dashboard/priv'
|
||||
else
|
||||
DASHBOARD_PATH='lib-ce/emqx_dashboard/priv'
|
||||
|
@ -28,7 +31,7 @@ if [ -d "$DASHBOARD_PATH/www" ] && [ "$(version)" = "$VERSION" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
curl -f -L "${DOWNLOAD_URL}/${VERSION}/emqx-dashboard.zip" -o ./emqx-dashboard.zip
|
||||
curl -f -L "${DOWNLOAD_URL}" -o ./emqx-dashboard.zip
|
||||
unzip -q ./emqx-dashboard.zip -d "$DASHBOARD_PATH"
|
||||
rm -rf "$DASHBOARD_PATH/www"
|
||||
mv "$DASHBOARD_PATH/dist" "$DASHBOARD_PATH/www"
|
Loading…
Reference in New Issue