Skip to content

Instantly share code, notes, and snippets.

@Benoss
Last active May 16, 2021 06:07
Show Gist options
  • Save Benoss/336aa5c3357da1bb33649869bfd1bf17 to your computer and use it in GitHub Desktop.
Save Benoss/336aa5c3357da1bb33649869bfd1bf17 to your computer and use it in GitHub Desktop.
install_docker_compose.sh Install/update docker compose with the latest released tag from github
#!/usr/bin/env bash
# -e exit on non 0 return
set -e
# -u exit on undefined variables
set -u
# -x print command before running
set -x
# bubble up the non 0 on pipes
set -o pipefail
REPO="docker/compose"
BIN_NAME="docker-compose"
LAST_GITHUB_V=$(curl -s https://api.github.com/repos/${REPO}/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
DOWNLOAD_LINK="https://github.com/${REPO}/releases/download/${LAST_GITHUB_V}/${BIN_NAME}-$(uname -s)-$(uname -m)"
sudo sh -c "curl -L $DOWNLOAD_LINK > /usr/local/bin/${BIN_NAME}"
sudo chmod +x /usr/local/bin/${BIN_NAME}
docker-compose --version
#!/usr/bin/env bash
# -e exit on non 0 return
set -e
# -u exit on undefined variables
set -u
# -x print command before running
set -x
# bubble up the non 0 on pipes
set -o pipefail
REPO="gohugoio/hugo"
FLAVOR="hugo"
LAST_GITHUB_V=$(curl -s https://api.github.com/repos/${REPO}/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
DOWNLOAD_LINK="https://github.com/${REPO}/releases/download/${LAST_GITHUB_V}/${FLAVOR}_${LAST_GITHUB_V:1}_Linux-64bit.deb"
curl -L -o /tmp/hugo_install.deb $DOWNLOAD_LINK
sudo dpkg -i /tmp/hugo_install.deb
rm -rf /tmp/hugo_install.deb
hugo version
# Install geekbench
# -u exit on undefined variables
set -u
# -x print command before running
set -x
# bubble up the non 0 on pipes
set -o pipefail
VERSION="5.4.1"
curl -s https://cdn.geekbench.com/Geekbench-${VERSION}-Linux.tar.gz | tar -xvz
mv Geekbench-${VERSION}-Linux/ geekbench
geekbench/geekbench5
rm -rf geekbench
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment