mirror of
https://github.com/kasmtech/workspaces-images.git
synced 2025-01-24 22:48:56 +01:00
KASM-1362 Update Tor-Browser to support persistent profiles
This commit is contained in:
parent
315d9a69eb
commit
f1b208d839
@ -25,31 +25,10 @@ RUN $INST_SCRIPTS/gtk/install_restricted_file_chooser.sh
|
|||||||
|
|
||||||
# Setup the custom startup script that will be invoked when the container starts
|
# Setup the custom startup script that will be invoked when the container starts
|
||||||
ENV LAUNCH_URL about:blank
|
ENV LAUNCH_URL about:blank
|
||||||
RUN echo $' \n\
|
|
||||||
set -x \n\
|
|
||||||
FORCE=$2 \n\
|
|
||||||
URL=${1:-$LAUNCH_URL} \n\
|
|
||||||
if [ -n "$URL" ] && ( [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ) ; then \n\
|
|
||||||
if [ -f /tmp/custom_startup.lck ] ; then \n\
|
|
||||||
echo "custom_startup already running!" \n\
|
|
||||||
exit 1 \n\
|
|
||||||
fi \n\
|
|
||||||
touch /tmp/custom_startup.lck \n\
|
|
||||||
while true \n\
|
|
||||||
do \n\
|
|
||||||
if ! pgrep firefox > /dev/null \n\
|
|
||||||
then \n\
|
|
||||||
/usr/bin/desktop_ready \n\
|
|
||||||
/tmp/tor-browser_en-US/Browser/start-tor-browser --detach --allow-remote --new-tab $URL \n\
|
|
||||||
fi \n\
|
|
||||||
sleep 1 \n\
|
|
||||||
done \n\
|
|
||||||
rm /tmp/custom_startup.lck \n\
|
|
||||||
fi \n\
|
|
||||||
' >$STARTUPDIR/custom_startup.sh
|
|
||||||
|
|
||||||
# Ensure the startup script is executable
|
COPY ./src/ubuntu/install/torbrowser/custom_startup.sh $STARTUPDIR/custom_startup.sh
|
||||||
RUN chmod 755 $STARTUPDIR/custom_startup.sh
|
RUN chmod +x $STARTUPDIR/custom_startup.sh
|
||||||
|
|
||||||
|
|
||||||
######### End Customizations ###########
|
######### End Customizations ###########
|
||||||
|
|
||||||
|
29
src/ubuntu/install/torbrowser/custom_startup.sh
Normal file
29
src/ubuntu/install/torbrowser/custom_startup.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
FORCE=$2
|
||||||
|
if [ -n "$1" ] ; then
|
||||||
|
URL=$1
|
||||||
|
else
|
||||||
|
URL=$LAUNCH_URL
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$URL" ] && ( [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ) ; then
|
||||||
|
if [ -f /tmp/custom_startup.lck ] ; then
|
||||||
|
echo "custom_startup already running!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
touch /tmp/custom_startup.lck
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
if ! pgrep firefox > /dev/null
|
||||||
|
then
|
||||||
|
/usr/bin/filter_ready
|
||||||
|
/usr/bin/desktop_ready
|
||||||
|
set +e
|
||||||
|
$HOME/tor-browser/tor-browser_en-US/Browser/start-tor-browser --detach --allow-remote --new-tab $URL
|
||||||
|
set -e
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
rm /tmp/custom_startup.lck
|
||||||
|
fi
|
@ -3,26 +3,33 @@ set -xe
|
|||||||
echo "Install TorBrowser"
|
echo "Install TorBrowser"
|
||||||
|
|
||||||
apt-get install -y xz-utils curl
|
apt-get install -y xz-utils curl
|
||||||
|
TOR_HOME=$HOME/tor-browser/
|
||||||
|
mkdir -p $TOR_HOME
|
||||||
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)
|
||||||
wget --quiet https://www.torproject.org/${TOR_URL} -O /tmp/torbrowser.tar.xz
|
wget --quiet https://www.torproject.org/${TOR_URL} -O /tmp/torbrowser.tar.xz
|
||||||
tar -xJf /tmp/torbrowser.tar.xz -C /tmp/
|
tar -xJf /tmp/torbrowser.tar.xz -C $TOR_HOME
|
||||||
|
rm /tmp/torbrowser.tar.xz
|
||||||
# Patch up the Tor Launcher file so we can move the icon to the deskop but not the folder
|
|
||||||
cp /tmp/tor-browser_en-US/start-tor-browser.desktop /tmp/tor-browser_en-US/start-tor-browser.desktop.bak
|
|
||||||
sed -i 's/^Name=.*/Name=Tor Browser/g' /tmp/tor-browser_en-US/start-tor-browser.desktop
|
|
||||||
sed -i 's/Icon=.*/Icon=\/tmp\/tor-browser_en-US\/Browser\/browser\/chrome\/icons\/default\/default128.png/g' /tmp/tor-browser_en-US/start-tor-browser.desktop
|
|
||||||
sed -i 's/Exec=.*/Exec=sh -c \x27"\/tmp\/tor-browser_en-US\/Browser\/start-tor-browser" --detach || ([ ! -x "\/tmp\/tor-browser_en-US\/Browser\/start-tor-browser" ] \&\& "$(dirname "$*")"\/Browser\/start-tor-browser --detach)\x27 dummy %k/g' /tmp/tor-browser_en-US/start-tor-browser.desktop
|
|
||||||
|
|
||||||
|
|
||||||
cat >>/tmp/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/prefs.js <<EOL
|
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_en-US/Browser/browser/chrome/icons/default/default128.png /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/Icon=.*/Icon=\/usr\/share\/icons\/tor.png/g' $TOR_HOME/tor-browser_en-US/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
|
||||||
|
|
||||||
|
|
||||||
|
cat >> $TOR_HOME/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/prefs.js <<EOL
|
||||||
user_pref("extensions.torlauncher.prompt_at_startup", false);
|
user_pref("extensions.torlauncher.prompt_at_startup", false);
|
||||||
user_pref("browser.download.lastDir", "/home/kasm-user/Downloads");
|
user_pref("browser.download.lastDir", "/home/kasm-user/Downloads");
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
chown -R 1000:0 /tmp/tor-browser_en-US/
|
# Maintain backwards compatability with old image definitions that expect tor to be launched from /tmp
|
||||||
|
mkdir -p /tmp/tor-browser_en-US/Browser/
|
||||||
|
ln -s $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop /tmp/tor-browser_en-US/Browser/start-tor-browser.desktop
|
||||||
|
|
||||||
|
chown -R 1000:0 $TOR_HOME/
|
||||||
|
|
||||||
|
|
||||||
cp /tmp/tor-browser_en-US/start-tor-browser.desktop $HOME/Desktop/
|
cp $TOR_HOME/tor-browser_en-US/start-tor-browser.desktop $HOME/Desktop/
|
||||||
chown 1000:0 $HOME/Desktop/start-tor-browser.desktop
|
chown 1000:0 $HOME/Desktop/start-tor-browser.desktop
|
||||||
|
|
||||||
rm /tmp/torbrowser.tar.xz
|
|
||||||
|
Loading…
Reference in New Issue
Block a user