Skip to content

Instantly share code, notes, and snippets.

@BuddhiLW
Created July 23, 2024 18:47
Show Gist options
  • Save BuddhiLW/ead11ca08ac38d539d45ba2607bcc985 to your computer and use it in GitHub Desktop.
Save BuddhiLW/ead11ca08ac38d539d45ba2607bcc985 to your computer and use it in GitHub Desktop.
Install latest Tor Browser version
#!/usr/bin/bash
# Change to the target directory
cd "$DOTFILES/gitthings" || exit 1
# Scrape the Tor Project page to find the latest stable version
version=$(curl -s https://dist.torproject.org/torbrowser/ | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")' | sort -V | tail -n 1)
# Check if the version was found
if [ -z "$version" ]; then
echo "Failed to find the latest stable version."
exit 1
fi
echo "Latest stable version found: $version"
# Construct the download URL
url="https://www.torproject.org/dist/torbrowser/${version}/tor-browser-linux-x86_64-${version}.tar.xz"
# Download the file
wget "$url" -O "tor-browser-linux-x86_64-${version}.tar.xz"
# Check if the download was successful
if [ $? -ne 0 ]; then
echo "Failed to download the file."
exit 1
fi
# Extract the downloaded file using 7z
7z x "tor-browser-linux-x86_64-${version}.tar.xz"
# Check if extraction was successful
if [ $? -ne 0 ]; then
echo "Failed to extract the file."
exit 1
fi
7z x "tor-browser-linux-x86_64-${version}.tar"
# Check if extraction was successful
if [ $? -ne 0 ]; then
echo "Failed to extract the file."
exit 1
fi
rm "tor-browser-linux-x86_64-${version}.tar.xz"
rm "tor-browser-linux-x86_64-${version}.tar"
# Check if extraction was successful
if [ $? -ne 0 ]; then
echo "Failed to extract the file."
exit 1
fi
echo "Downloaded and extracted Tor Browser version ${version} successfully."
@BuddhiLW
Copy link
Author

In order to create another script to start the browser, wherever you downloaded it

#!/usr/bin/bash

cd $TORB # my case: TORB="$DOTFILES/gitthings", where `tor-browser` was installed
./start-tor-browser.desktop

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