Merge remote-tracking branch 'flapflap/de-network_configuration'
[tails-test.git] / config / chroot_local-includes / usr / local / sbin / tails-tor-launcher
blob24b50af5bdfd04cd1ab991ac5f5954c8aa356530
1 #!/bin/sh
3 set -e
5 unset TOR_CONTROL_PASSWD
6 unset TOR_FORCE_NET_CONFIG
7 TOR_CONFIGURE_ONLY=1
8 TOR_CONTROL_PORT=9051
9 TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
10 export TOR_CONFIGURE_ONLY
11 export TOR_CONTROL_PORT
12 export TOR_CONTROL_COOKIE_AUTH_FILE
14 if echo "$@" | grep -qw -- --force-net-config; then
15 TOR_FORCE_NET_CONFIG=1
16 export TOR_FORCE_NET_CONFIG
19 # Get LIVE_USERNAME
20 . /etc/live/config.d/username.conf
22 # Get LANG
23 . /etc/default/locale
25 until pgrep -u "${LIVE_USERNAME}" nm-applet >/dev/null ; do
26 sleep 5
27 done
29 export LANG
30 export DISPLAY=':0.0'
31 export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
32 sudo -u ${LIVE_USERNAME} xhost +SI:localuser:tor-launcher
33 gksudo -u tor-launcher /usr/bin/tor-launcher
34 RET=${?}
35 sudo -u ${LIVE_USERNAME} xhost -SI:localuser:tor-launcher
37 # Save ~10 RAM (due to the tmpfs) by removing this unused file
38 rm -f /usr/Data/Browser/*.default/places.sqlite
40 exit ${RET}