Skip to content

Instantly share code, notes, and snippets.

@maxim
Last active October 9, 2023 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxim/0d81cd44ea2551857c2cc9fb8185aaac to your computer and use it in GitHub Desktop.
Save maxim/0d81cd44ea2551857c2cc9fb8185aaac to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# Usage:
# ./install-rclone.sh v1.65.0-beta.7390.2a30c417a.fix-b2-upload-url
# Check if the argument is supplied
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <rclone_version>"
exit 1
fi
VERSION=$1
BRANCH=$(echo "$VERSION" | rev | cut -d'.' -f1 | rev)
DEB_URL="https://beta.rclone.org/branch/${BRANCH}/${VERSION}/rclone-${VERSION}-linux-amd64.deb"
DEB_FILE="/tmp/rclone-${VERSION}-linux-amd64.deb"
# Download the .deb file for the provided version
wget -O "$DEB_FILE" "$DEB_URL"
# Check if the download was successful
if [ $? -ne 0 ]; then
echo "Failed to download the .deb file. Please check the version or your internet connection."
exit 1
fi
# Install rclone using the downloaded .deb file
sudo dpkg -i "$DEB_FILE"
# Check installation
if [ $? -eq 0 ]; then
echo "rclone ${VERSION} has been installed successfully."
else
echo "Installation failed. Please check for any errors above."
fi
# Cleanup - remove the downloaded .deb file
rm -f "$DEB_FILE"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment