bbgo_origin/scripts/download.sh

41 lines
807 B
Bash
Raw Normal View History

2020-12-29 09:37:21 +00:00
#!/bin/bash
2021-04-28 09:56:46 +00:00
set -e
version=$(curl -fs https://api.github.com/repos/c9s/bbgo/releases/latest | awk -F '"' '/tag_name/{print $4}')
arch=""
case $(uname -m) in
x86_64 | ia64) arch="amd64";;
arm64 | aarch64 | arm) arch="arm64";;
*)
echo "unsupported architecture: $(uname -m)"
exit 1;;
esac
2020-12-29 09:37:21 +00:00
osf=$(uname | tr '[:upper:]' '[:lower:]')
dist_file=bbgo-$version-$osf-$arch.tar.gz
2020-12-29 09:37:21 +00:00
2021-04-28 09:56:46 +00:00
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
2020-12-29 09:46:13 +00:00
2021-04-28 09:56:46 +00:00
function warn()
{
echo -e "${YELLOW}$@${NC}"
}
function error()
{
echo -e "${RED}$@${NC}"
}
2020-12-29 09:46:13 +00:00
2021-04-28 09:56:46 +00:00
function info()
{
echo -e "${GREEN}$@${NC}"
}
info "downloading..."
curl -O -L https://github.com/c9s/bbgo/releases/download/$version/$dist_file
tar xzf $dist_file
mv bbgo-$osf-$arch bbgo
2021-04-28 09:56:46 +00:00
chmod +x bbgo
info "downloaded successfully"