#!/bin/bash

DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1
}

wget https://sourceforge.net/projects/tor-browser-ports/files/10.0.4-arm64/tor-browser-linux-arm64-10.0.4_en-US.tar.xz/download -O tor.tar.xz || error "Failed to download!"

tar -xf ~/tor.tar.xz || error "Failed to extract!"

echo "[Desktop Entry]
Type=Application
Name=Tor Browser
GenericName=Web Browser
Comment=Tor Browser is +1 for privacy and −1 for mass surveillance
Categories=Network;WebBrowser;Security;
Exec=$HOME/tor-browser_en-US/Browser/start-tor-browser
X-TorBrowser-ExecShell=./Browser/start-tor-browser --detach
Icon=$(dirname "$0")/icon-64.png
StartupWMClass=Tor Browser" > ~/.local/share/applications/tor.desktop
