Skip to content

Instantly share code, notes, and snippets.

@k3karthic
Created May 30, 2021 15:50
Show Gist options
  • Save k3karthic/0f85d702b4038405a621c2c4cf1ce5af to your computer and use it in GitHub Desktop.
Save k3karthic/0f85d702b4038405a621c2c4cf1ce5af to your computer and use it in GitHub Desktop.
Update BorgBackup
#!/usr/bin/env sh
## https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
ver=$(get_latest_release "borgbackup/borg")
echo "Fetching $ver..."
cd /tmp
echo https://github.com/borgbackup/borg/releases/download/$ver/borg-linux64
curl -OL https://github.com/borgbackup/borg/releases/download/$ver/borg-linux64
chmod u+x /tmp/borg-linux64
mv /tmp/borg-linux64 ~/bin/borg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment