Created
July 23, 2024 18:47
-
-
Save BuddhiLW/ead11ca08ac38d539d45ba2607bcc985 to your computer and use it in GitHub Desktop.
Install latest Tor Browser version
This file contains 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/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." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to create another script to start the browser, wherever you downloaded it