Skip to content

Instantly share code, notes, and snippets.

@ericswpark
Last active February 21, 2025 05:52
Show Gist options
  • Save ericswpark/bc53e93fbd8529655ba54dce454d5962 to your computer and use it in GitHub Desktop.
Save ericswpark/bc53e93fbd8529655ba54dce454d5962 to your computer and use it in GitHub Desktop.
Updates VueTorrent automatically
#!/usr/bin/env bash
set -e
VUETORRENT_REPO_NAME="VueTorrent/VueTorrent"
GITHUB_API_URL="https://api.github.com/repos"
GITHUB_URL="https://github.com"
GITHUB_VUETORRENT_API_URL="$GITHUB_API_URL/$VUETORRENT_REPO_NAME"
GITHUB_VUETORRENT_URL="$GITHUB_URL/$VUETORRENT_REPO_NAME"
# Check latest version on GitHub
export LATEST_VUETORRENT_VERSION=$(curl -s $GITHUB_VUETORRENT_API_URL/releases/latest | jq --raw-output '.name')
echo "The latest release of VueTorrent on GitHub is $LATEST_VUETORRENT_VERSION."
# Initialize directories
CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORK_DIR=`mktemp -d`
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "Could not create temporary directory to work in!"
exit 1
fi
function cleanup {
rm -rf "$WORK_DIR"
echo "Deleted temporary working directory $WORK_DIR"
}
trap cleanup EXIT
# Switch to work directory
pushd $WORK_DIR
echo "Downloading VueTorrent release $LATEST_VUETORRENT_VERSION..."
wget "$GITHUB_VUETORRENT_URL/releases/download/$LATEST_VUETORRENT_VERSION/vuetorrent.zip"
echo "Download complete."
echo "Unzipping release to temporary folder..."
unzip vuetorrent.zip
echo "Unzip done."
echo "Moving release to qbittorrent folder..."
mv vuetorrent $CURR_DIR/vuetorrent-$LATEST_VUETORRENT_VERSION
echo "Files moved."
popd
# Set up symlink
echo "Setting up symlinks..."
echo "Removing the previous symlink..."
rm vuetorrent
echo "Setting up the symlink for version $LATEST_VUETORRENT_VERSION..."
ln -s vuetorrent-$LATEST_VUETORRENT_VERSION vuetorrent
echo "Symlink has been set up."
echo "Setting correct permissions..."
chown -R nobody:users vuetorrent vuetorrent-$LATEST_VUETORRENT_VERSION
echo "Correct permissions set."
echo "Restarting the qbittorrent container..."
docker restart qbittorrent
echo "Container qbittorrent has been restarted."
echo "Done! VueTorrent has been updated to $LATEST_VUETORRENT_VERSION."
@ericswpark
Copy link
Author

Updated to use jq instead of python3. This should help on UnRAID where NerdTools has been deprecated (but it ships with jq by default)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment