Skip to content

Instantly share code, notes, and snippets.

@vicenterusso
Created April 12, 2024 12:56
Show Gist options
  • Save vicenterusso/585edd26122540622d09d5e3de52446c to your computer and use it in GitHub Desktop.
Save vicenterusso/585edd26122540622d09d5e3de52446c to your computer and use it in GitHub Desktop.
[Fedora / Brave] Automatically download latest stable brave browser version RPM from Github
#!/bin/bash
# GitHub user/repo
USER="brave"
REPO="brave-browser"
# Base URL for GitHub API
API_URL="https://api.github.com/repos/$USER/$REPO/releases/latest"
# Use curl to fetch the latest release data
json=$(curl -s $API_URL)
# Check if the request was successful
if [[ $(echo $json | jq -r '.message') == "Not Found" ]]; then
echo "Error: Repository or release not found."
exit 1
fi
# Parse the tag name
tag_name=$(echo $json | jq -r '.tag_name')
# Remove the 'v' at the start of the tag_name if it exists
tag_name="${tag_name#v}"
# Build file name
file_name="brave-browser-$tag_name-1.x86_64.rpm"
# Construct the download URL
download_url="https://github.com/$USER/$REPO/releases/download/v$tag_name/$file_name"
# Download the file using wget
wget $download_url -O $file_name
echo "Downloaded $file_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment