Skip to content

Commit

Permalink
Tor: fix update notification, install to ~/.local/share
Browse files Browse the repository at this point in the history
Frees up home folder, stops the unclickable update popup issue on
wayland (does not solve the issue of Tor being horribly outdated
unfortunately)
  • Loading branch information
Botspot committed Nov 26, 2024
1 parent 691a9a3 commit 69eb6a0
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 40 deletions.
2 changes: 1 addition & 1 deletion apps/Tor/description
Original file line number Diff line number Diff line change
@@ -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
45 changes: 29 additions & 16 deletions apps/Tor/install-32
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,51 @@

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
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
45 changes: 29 additions & 16 deletions apps/Tor/install-64
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,51 @@

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
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
14 changes: 7 additions & 7 deletions apps/Tor/uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 69eb6a0

Please sign in to comment.