Merge branch 'feature/KASM-3934-disable-tor-auto-update' into 'develop'

Resolve KASM-3934 "Feature/ disable tor auto update"

Closes KASM-3934

See merge request kasm-technologies/internal/workspaces-images!95
This commit is contained in:
Justin Travis 2023-01-22 00:09:09 +00:00
commit 02f255e4aa
2 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
START_COMMAND="$HOME/tor-browser/tor-browser_en-US/Browser/start-tor-browser" START_COMMAND="$HOME/tor-browser/tor-browser/Browser/start-tor-browser"
PGREP="firefox.real" PGREP="firefox.real"
MAXIMIZE=${MAXIMIZE:-"true"} MAXIMIZE=${MAXIMIZE:-"true"}
export MAXIMIZE=$MAXIMIZE export MAXIMIZE=$MAXIMIZE

View File

@ -7,7 +7,7 @@ TOR_HOME=$HOME/tor-browser/
mkdir -p $TOR_HOME mkdir -p $TOR_HOME
if [ "$(arch)" == "aarch64" ]; then if [ "$(arch)" == "aarch64" ]; then
SF_VERSION=$(curl -sI https://sourceforge.net/projects/tor-browser-ports/files/latest/download | awk -F'(ports/|/tor)' '/location/ {print $3}') SF_VERSION=$(curl -sI https://sourceforge.net/projects/tor-browser-ports/files/latest/download | awk -F'(ports/|/tor)' '/location/ {print $3}')
FULL_TOR_URL="https://downloads.sourceforge.net/project/tor-browser-ports/${SF_VERSION}/tor-browser-linux-arm64-${SF_VERSION}_en-US.tar.xz" FULL_TOR_URL="https://downloads.sourceforge.net/project/tor-browser-ports/${SF_VERSION}/tor-browser-linux-arm64-${SF_VERSION}_ALL.tar.xz"
else else
TOR_URL=$(curl -q https://www.torproject.org/download/ | grep downloadLink | grep linux64 | sed 's/.*href="//g' | cut -d '"' -f1 | head -1) TOR_URL=$(curl -q https://www.torproject.org/download/ | grep downloadLink | grep linux64 | sed 's/.*href="//g' | cut -d '"' -f1 | head -1)
FULL_TOR_URL="https://www.torproject.org/${TOR_URL}" FULL_TOR_URL="https://www.torproject.org/${TOR_URL}"
@ -17,15 +17,19 @@ tar -xJf /tmp/torbrowser.tar.xz -C $TOR_HOME
rm /tmp/torbrowser.tar.xz rm /tmp/torbrowser.tar.xz
cp $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop.bak cp $TOR_HOME/tor-browser/start-tor-browser.desktop $TOR_HOME/tor-browser/start-tor-browser.desktop.bak
cp $TOR_HOME/tor-browser_en-US/Browser/browser/chrome/icons/default/default128.png /usr/share/icons/tor.png cp $TOR_HOME/tor-browser/Browser/browser/chrome/icons/default/default128.png /usr/share/icons/tor.png
chown 1000:0 /usr/share/icons/tor.png chown 1000:0 /usr/share/icons/tor.png
sed -i 's/^Name=.*/Name=Tor Browser/g' $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop sed -i 's/^Name=.*/Name=Tor Browser/g' $TOR_HOME/tor-browser/start-tor-browser.desktop
sed -i 's/Icon=.*/Icon=\/usr\/share\/icons\/tor.png/g' $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop sed -i 's/Icon=.*/Icon=\/usr\/share\/icons\/tor.png/g' $TOR_HOME/tor-browser/start-tor-browser.desktop
sed -i 's/Exec=.*/Exec=sh -c \x27"$HOME\/tor-browser\/tor-browser_en-US\/Browser\/start-tor-browser" --detach || ([ ! -x "$HOME\/tor-browser\/tor-browser_en-US\/Browser\/start-tor-browser" ] \&\& "$(dirname "$*")"\/Browser\/start-tor-browser --detach)\x27 dummy %k/g' $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop sed -i 's/Exec=.*/Exec=sh -c \x27"$HOME\/tor-browser\/tor-browser\/Browser\/start-tor-browser" --detach || ([ ! -x "$HOME\/tor-browser\/tor-browser\/Browser\/start-tor-browser" ] \&\& "$(dirname "$*")"\/Browser\/start-tor-browser --detach)\x27 dummy %k/g' $TOR_HOME/tor-browser/start-tor-browser.desktop
cat >> $TOR_HOME/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/prefs.js <<EOL cat >> $TOR_HOME/tor-browser/Browser/TorBrowser/Data/Browser/profile.default/prefs.js <<EOL
user_pref("app.update.download.promptMaxAttempts", 0);
user_pref("app.update.elevation.promptMaxAttempts", 0);
user_pref("app.update.checkInstallTime", false);
user_pref("app.update.background.interval", 315360000);
user_pref("extensions.torlauncher.prompt_at_startup", false); user_pref("extensions.torlauncher.prompt_at_startup", false);
user_pref("extensions.torlauncher.quickstart", true); user_pref("extensions.torlauncher.quickstart", true);
user_pref("browser.download.lastDir", "/home/kasm-user/Downloads"); user_pref("browser.download.lastDir", "/home/kasm-user/Downloads");
@ -39,11 +43,11 @@ user_pref("torbrowser.settings.quickstart.enabled", true);
EOL EOL
# Maintain backwards compatability with old image definitions that expect tor to be launched from /tmp # Maintain backwards compatability with old image definitions that expect tor to be launched from /tmp
mkdir -p /tmp/tor-browser_en-US/Browser/ mkdir -p /tmp/tor-browser/Browser/
ln -s $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop /tmp/tor-browser_en-US/Browser/start-tor-browser.desktop ln -s $TOR_HOME/tor-browser/start-tor-browser.desktop /tmp/tor-browser/Browser/start-tor-browser.desktop
chown -R 1000:0 $TOR_HOME/ chown -R 1000:0 $TOR_HOME/
cp $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop $HOME/Desktop/ cp $TOR_HOME/tor-browser/start-tor-browser.desktop $HOME/Desktop/
chown 1000:0 $HOME/Desktop/start-tor-browser.desktop chown 1000:0 $HOME/Desktop/start-tor-browser.desktop