tails-tor-launcher 843 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/bin/sh

set -e

unset TOR_CONTROL_PASSWD
unset TOR_FORCE_NET_CONFIG
TOR_CONFIGURE_ONLY=1
TOR_CONTROL_PORT=9051
TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
export TOR_CONFIGURE_ONLY
export TOR_CONTROL_PORT
export TOR_CONTROL_COOKIE_AUTH_FILE

if echo "$@" | grep -qw -- --force-net-config; then
    TOR_FORCE_NET_CONFIG=1
    export TOR_FORCE_NET_CONFIG
fi

# Get LIVE_USERNAME
. /etc/live/config.d/username.conf

# Get LANG
. /etc/default/locale

until pgrep -u "${LIVE_USERNAME}" nm-applet >/dev/null ; do
   sleep 5
done

export LANG
export DISPLAY=':0.0'
export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
sudo -u ${LIVE_USERNAME} xhost +SI:localuser:tor-launcher
sudo -n -H -u tor-launcher /usr/bin/tor-launcher
RET=${?}
sudo -u ${LIVE_USERNAME} xhost -SI:localuser:tor-launcher

exit ${RET}