mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-30 19:28:09 +08:00
29 lines
594 B
Bash
Executable File
29 lines
594 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
VERSION="$1"
|
|
|
|
# ensure dir
|
|
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
|
|
|
DOWNLOAD_URL='https://dgiot-dev-1306147891.cos.ap-nanjing.myqcloud.com'
|
|
|
|
download() {
|
|
wget ${DOWNLOAD_URL}/${VERSION}/rebar3
|
|
}
|
|
|
|
# get the version number from the second line of the escript
|
|
# because command `rebar3 -v` tries to load rebar.config
|
|
# which is slow and may print some logs
|
|
version() {
|
|
head -n 2 ./rebar3 | tail -n 1 | tr ' ' '\n' | grep -E '^.+-emqx-.+'
|
|
}
|
|
|
|
if [ -f 'rebar3' ] && [ "$(version)" = "$VERSION" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
download
|
|
chmod +x ./rebar3
|