From 69eb6a0ad6e56b4954bd5f3e542d13372f3b027e Mon Sep 17 00:00:00 2001 From: Botspot <54716352+Botspot@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:03:44 -0600 Subject: [PATCH] Tor: fix update notification, install to ~/.local/share Frees up home folder, stops the unclickable update popup issue on wayland (does not solve the issue of Tor being horribly outdated unfortunately) --- apps/Tor/description | 2 +- apps/Tor/install-32 | 45 ++++++++++++++++++++++++++++---------------- apps/Tor/install-64 | 45 ++++++++++++++++++++++++++++---------------- apps/Tor/uninstall | 14 +++++++------- 4 files changed, 66 insertions(+), 40 deletions(-) diff --git a/apps/Tor/description b/apps/Tor/description index 3aa12ea071..33d6bc787a 100644 --- a/apps/Tor/description +++ b/apps/Tor/description @@ -1,4 +1,4 @@ The Tor Browser is a web broswer that anonymizes your web traffic using the Tor network, making it easy to protect your identity online. To run: Menu -> Internet -> Tor Browser -To run in a terminal: ~/tor-browser/Browser/start-tor-browser +To run in a terminal: ~/.local/share/tor-browser/Browser/start-tor-browser diff --git a/apps/Tor/install-32 b/apps/Tor/install-32 index 554a5ce76e..f97376556e 100755 --- a/apps/Tor/install-32 +++ b/apps/Tor/install-32 @@ -2,30 +2,43 @@ version=13.0.9 -#if ~/tor-browser_en-US folder exists, prepare to import its user-data +#if ~/tor-browser_en-US folder exists, prepare to import its user-data (OLDEST folder location) if [ -d ~/tor-browser_en-US/Browser/TorBrowser/Data/Browser ];then - mv -f ~/tor-browser_en-US ~/tor-browser.temp + mv -f ~/tor-browser_en-US ~/.local/share/tor-browser.temp +#if ~/tor-browser folder exists, prepare to import its user-data (OLD folder location) +elif [ -d ~/tor-browser/Browser/TorBrowser/Data/Browser ];then + mv -f ~/tor-browser ~/.local/share/tor-browser.temp +#if ~/.local/share/tor-browser folder exists, prepare to import its user-data (NEW folder location) +elif [ -d ~/.local/share/tor-browser/Browser/TorBrowser/Data/Browser ];then + mv -f ~/.local/share/tor-browser ~/.local/share/tor-browser.temp fi -#if ~/tor-browser folder exists, prepare to import its user-data -if [ -d ~/tor-browser/Browser/TorBrowser/Data/Browser ];then - mv -f ~/tor-browser ~/tor-browser.temp -fi +rm -f /tmp/tor.tar.xz +wget -O /tmp/tor.tar.xz https://sourceforge.net/projects/tor-browser-ports/files/${version}/tor-browser-linux-armhf-${version}.tar.xz/download || error "Failed to download!" +status -n "Extracting... " +tar -xf /tmp/tor.tar.xz -C ~/.local/share || error "Failed to extract!" +rm -f /tmp/tor.tar.xz +status_green Done -rm -f ~/tor.tar.xz -wget -O ~/tor.tar.xz https://sourceforge.net/projects/tor-browser-ports/files/${version}/tor-browser-linux-armhf-${version}.tar.xz/download || error "Failed to download!" -tar -xf ~/tor.tar.xz || error "Failed to extract!" -rm -f ~/tor.tar.xz +#if tor-browser.temp folder exists, import its user-data +if [ -d ~/.local/share/tor-browser.temp ];then + rm -rf ~/.local/share/tor-browser/Browser/TorBrowser/Data/Browser + mv -f ~/.local/share/tor-browser.temp/Browser/TorBrowser/Data/Browser ~/.local/share/tor-browser/Browser/TorBrowser/Data && rm -rf ~/.local/share/tor-browser.temp +fi -#if ~/tor-browser.temp folder exists, import its user-data -if [ -d ~/tor-browser.temp ];then - rm -rf ~/tor-browser/Browser/TorBrowser/Data/Browser - mv -f ~/tor-browser.temp/Browser/TorBrowser/Data/Browser ~/tor-browser/Browser/TorBrowser/Data && rm -rf ~/tor-browser.temp +#disable buggy update notification +if [ ! -f ~/.local/share/tor-browser/Browser/distribution/policies.json ];then + mkdir -p ~/.local/share/tor-browser/Browser/distribution + echo '{ + "policies": { + "DisableAppUpdate": true + } +}' > ~/.local/share/tor-browser/Browser/distribution/policies.json fi #copy icon for wayfire mkdir -p ~/.local/share/icons -cp -f $HOME/tor-browser/Browser/browser/chrome/icons/default/default128.png ~/.local/share/icons/tor-browser.png +cp -f ~/.local/share/tor-browser/Browser/browser/chrome/icons/default/default128.png ~/.local/share/icons/tor-browser.png echo "[Desktop Entry] Type=Application @@ -33,7 +46,7 @@ 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/Browser/start-tor-browser --class 'tor-browser' --name 'tor-browser' +Exec=$HOME/.local/share/tor-browser/Browser/start-tor-browser --class 'tor-browser' --name 'tor-browser' X-TorBrowser-ExecShell=./Browser/start-tor-browser --detach Icon=tor-browser StartupWMClass=tor-browser" > ~/.local/share/applications/tor.desktop diff --git a/apps/Tor/install-64 b/apps/Tor/install-64 index b1f4e38bfb..6691011151 100755 --- a/apps/Tor/install-64 +++ b/apps/Tor/install-64 @@ -2,30 +2,43 @@ version=13.0.9 -#if ~/tor-browser_en-US folder exists, prepare to import its user-data +#if ~/tor-browser_en-US folder exists, prepare to import its user-data (OLDEST folder location) if [ -d ~/tor-browser_en-US/Browser/TorBrowser/Data/Browser ];then - mv -f ~/tor-browser_en-US ~/tor-browser.temp + mv -f ~/tor-browser_en-US ~/.local/share/tor-browser.temp +#if ~/tor-browser folder exists, prepare to import its user-data (OLD folder location) +elif [ -d ~/tor-browser/Browser/TorBrowser/Data/Browser ];then + mv -f ~/tor-browser ~/.local/share/tor-browser.temp +#if ~/.local/share/tor-browser folder exists, prepare to import its user-data (NEW folder location) +elif [ -d ~/.local/share/tor-browser/Browser/TorBrowser/Data/Browser ];then + mv -f ~/.local/share/tor-browser ~/.local/share/tor-browser.temp fi -#if ~/tor-browser folder exists, prepare to import its user-data -if [ -d ~/tor-browser/Browser/TorBrowser/Data/Browser ];then - mv -f ~/tor-browser ~/tor-browser.temp -fi +rm -f /tmp/tor.tar.xz +wget -O /tmp/tor.tar.xz https://sourceforge.net/projects/tor-browser-ports/files/${version}/tor-browser-linux-arm64-${version}.tar.xz/download || error "Failed to download!" +status -n "Extracting... " +tar -xf /tmp/tor.tar.xz -C ~/.local/share || error "Failed to extract!" +rm -f /tmp/tor.tar.xz +status_green Done -rm -f ~/tor.tar.xz -wget -O ~/tor.tar.xz https://sourceforge.net/projects/tor-browser-ports/files/${version}/tor-browser-linux-arm64-${version}.tar.xz/download || error "Failed to download!" -tar -xf ~/tor.tar.xz || error "Failed to extract!" -rm -f ~/tor.tar.xz +#if tor-browser.temp folder exists, import its user-data +if [ -d ~/.local/share/tor-browser.temp ];then + rm -rf ~/.local/share/tor-browser/Browser/TorBrowser/Data/Browser + mv -f ~/.local/share/tor-browser.temp/Browser/TorBrowser/Data/Browser ~/.local/share/tor-browser/Browser/TorBrowser/Data && rm -rf ~/.local/share/tor-browser.temp +fi -#if ~/tor-browser.temp folder exists, import its user-data -if [ -d ~/tor-browser.temp ];then - rm -rf ~/tor-browser/Browser/TorBrowser/Data/Browser - mv -f ~/tor-browser.temp/Browser/TorBrowser/Data/Browser ~/tor-browser/Browser/TorBrowser/Data && rm -rf ~/tor-browser.temp +#disable buggy update notification +if [ ! -f ~/.local/share/tor-browser/Browser/distribution/policies.json ];then + mkdir -p ~/.local/share/tor-browser/Browser/distribution + echo '{ + "policies": { + "DisableAppUpdate": true + } +}' > ~/.local/share/tor-browser/Browser/distribution/policies.json fi #copy icon for wayfire mkdir -p ~/.local/share/icons -cp -f $HOME/tor-browser/Browser/browser/chrome/icons/default/default128.png ~/.local/share/icons/tor-browser.png +cp -f ~/.local/share/tor-browser/Browser/browser/chrome/icons/default/default128.png ~/.local/share/icons/tor-browser.png echo "[Desktop Entry] Type=Application @@ -33,7 +46,7 @@ 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/Browser/start-tor-browser --class 'tor-browser' --name 'tor-browser' +Exec=$HOME/.local/share/tor-browser/Browser/start-tor-browser --class 'tor-browser' --name 'tor-browser' X-TorBrowser-ExecShell=./Browser/start-tor-browser --detach Icon=tor-browser StartupWMClass=tor-browser" > ~/.local/share/applications/tor.desktop diff --git a/apps/Tor/uninstall b/apps/Tor/uninstall index c040a982b9..5c7ef011f8 100755 --- a/apps/Tor/uninstall +++ b/apps/Tor/uninstall @@ -4,24 +4,24 @@ rm -f ~/.local/share/applications/tor.desktop #before removing the tor-browser_en-US folder, move the browser configuration like bookmarks, etc -if [ -d ~/tor-browser ];then - mkdir -p ~/tor-browser.temp/Browser/TorBrowser/Data - mv -n ~/tor-browser/Browser/TorBrowser/Data/Browser ~/tor-browser.temp/Browser/TorBrowser/Data +if [ -d ~/.local/share/tor-browser ];then + mkdir -p ~/.local/share/tor-browser.temp/Browser/TorBrowser/Data + mv -n ~/.local/share/tor-browser/Browser/TorBrowser/Data/Browser ~/.local/share/tor-browser.temp/Browser/TorBrowser/Data fi #remove all browser internals (except for user-data which we moved already) -rm -rf ~/tor-browser +rm -rf ~/.local/share/tor-browser #remove icon rm -f ~/.local/share/icons/tor-browser.png #move back the temporary folder containing user-data -if [ -d ~/tor-browser.temp ];then - mv ~/tor-browser.temp ~/tor-browser +if [ -d ~/.local/share/tor-browser.temp ];then + mv ~/.local/share/tor-browser.temp ~/.local/share/tor-browser #let the user know where configuration is echo "Tor Browser has been uninstalled, but user-data like settings and bookmarks remain intact. To remove these files, run this command: -rm -rf ~/tor-browser" +rm -rf ~/.local/share/tor-browser" fi