Skip to content

Instantly share code, notes, and snippets.

@k3karthic
Created November 4, 2021 16:17
Show Gist options
  • Save k3karthic/9353af86db76e9e0b102517dbd69dc07 to your computer and use it in GitHub Desktop.
Save k3karthic/9353af86db76e9e0b102517dbd69dc07 to your computer and use it in GitHub Desktop.
Update rclone
#!/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 "rclone/rclone")
echo "Fetching $ver..."
cd /tmp
echo https://downloads.rclone.org/v$ver/rclone-v$ver-linux-amd64.zip
curl -OL https://downloads.rclone.org/v$ver/rclone-v$ver-linux-amd64.zip
unzip rclone-v$ver-linux-amd64.zip
mv /tmp/rclone-v$ver-linux-amd64/rclone ~/bin/rclone
chmod u+x ~/bin/rclone
rm -rf /tmp/rclone-v$ver-linux-amd64*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment