Files
toolbox-dev-env/install-bins.bash

57 lines
2.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
latest_doctl=$(curl -sSL https://api.github.com/repos/digitalocean/doctl/releases/latest | jq -r '.tag_name')
latest_tflint=$(curl -sSL https://api.github.com/repos/terraform-linters/tflint/releases/latest | jq -r '.tag_name')
latest_butane=$(curl -sSL https://api.github.com/repos/coreos/butane/releases/latest | jq -r '.tag_name')
latest_act=$(curl -sSL https://api.github.com/repos/nektos/act/releases/latest | jq -r '.tag_name')
latest_hadolint=$(curl -sSL https://api.github.com/repos/hadolint/hadolint/releases/latest | jq -r '.tag_name')
mkdir -p /tmp/bins
working=$(mktemp -d)
doctl_url="https://github.com/digitalocean/doctl/releases/download/${latest_doctl}/doctl-${latest_doctl:1}-linux-amd64.tar.gz"
echo "Downloading doctl-${latest_doctl}: ${doctl_url}"
curl --fail-with-body -sSLo "${working}/doctl.tar.gz" "${doctl_url}"
cd "${working}"
tar -xf doctl.tar.gz
mv "${working}/doctl" /tmp/bins/doctl
chmod +x /tmp/bins/doctl
cd ~
rm -rf "${working}"
working=$(mktemp -d)
tflint_url="https://github.com/terraform-linters/tflint/releases/download/${latest_tflint}/tflint_linux_amd64.zip"
echo "Downloading tflint-${latest_tflint}: ${tflint_url}"
curl --fail-with-body -sSLo "${working}/tflint.zip" "${tflint_url}"
cd "${working}"
unzip tflint.zip
mv tflint /tmp/bins/tflint
chmod +x /tmp/bins/tflint
cd ~
rm -rf "${working}"
butane_url="https://github.com/coreos/butane/releases/download/${latest_butane}/butane-x86_64-unknown-linux-gnu"
echo "Downloading butane-${latest_butane}: ${butane_url}"
curl --fail-with-body -sSLo "/tmp/bins/butane" "${butane_url}"
chmod +x /tmp/bins/butane
working=$(mktemp -d)
act_url="https://github.com/nektos/act/releases/download/${latest_act}/act_Linux_x86_64.tar.gz"
echo "Downloading act-${latest_act}: ${act_url}"
curl --fail-with-body -sSLo "${working}/act.tar.gz" "${act_url}"
cd "${working}"
tar -xf act.tar.gz
mv "${working}/act" /tmp/bins/act
chmod +x /tmp/bins/act
cd ~
rm -rf "${working}"
hadolint_url="https://github.com/hadolint/hadolint/releases/download/${latest_hadolint}/hadolint-Linux-x86_64"
echo "Downloading hadolint-${latest_hadolint}: ${hadolint_url}"
curl --fail-with-body -sSLo "/tmp/bins/hadolint" "${hadolint_url}"
chmod +x /tmp/bins/hadolint
mv /tmp/bins/* /usr/local/bin/