Created
November 4, 2021 16:17
-
-
Save k3karthic/9353af86db76e9e0b102517dbd69dc07 to your computer and use it in GitHub Desktop.
Update rclone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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