Skip to content

Instantly share code, notes, and snippets.

@ekussa
Last active February 8, 2021 17:24
Show Gist options
  • Save ekussa/3908364666372b1c81073beccc0e8da1 to your computer and use it in GitHub Desktop.
Save ekussa/3908364666372b1c81073beccc0e8da1 to your computer and use it in GitHub Desktop.
Download latest release of Balena Cli and Gui from github - Linux
sudo apt install wget curl unzip
# Get latest version url
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/balena-io/balena-cli/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/' | grep 'linux' > balenaCliLink.txt
# Set first line of a file, that contains a url, to a variable
read -r url < balenaCliLink.txt
# Delete from disk, if already downloaded
rm -f ${url##*/}
# Download it
wget $url
# Delete extraction folder from disk, if already downloaded
rm -rf -d balena-cli
# Decompress
unzip -q ${url##*/}
# Delete temporary from disk
rm -f balenaCliLink.txt
# Get latest version url
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/balena-io/etcher/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/' | grep 'x64.AppImage' > etcherLink.txt
# Set first line of a file, that contains a url, to a variable
read -r url < etcherLink.txt
# Delete from disk, if already downloaded
rm -f ${url##*/}
# Download it
wget $url
# Allow execution, read and write
chmod +rwx ${url##*/}
# Delete temporary from disk
rm -f etcherLink.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment