Commit 0ef77dab authored by anonym's avatar anonym
Browse files

Refactor GNOME/X env exporting to Tails' shell library.

parent 0a55453a
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
# Get LIVE_USERNAME # Get LIVE_USERNAME
. /etc/live/config.d/username.conf . /etc/live/config.d/username.conf
# Import export_gnome_env().
. /usr/local/lib/tails-shell-library/gnome.sh
# Import tor_control_*(), tor_is_working(), TOR_LOG, TOR_DIR # Import tor_control_*(), tor_is_working(), TOR_LOG, TOR_DIR
. /usr/local/lib/tails-shell-library/tor.sh . /usr/local/lib/tails-shell-library/tor.sh
...@@ -207,11 +210,7 @@ is_clock_way_off() { ...@@ -207,11 +210,7 @@ is_clock_way_off() {
} }
start_notification_helper() { start_notification_helper() {
export DISPLAY=':0.0' export_gnome_env
export XAUTHORITY="$(echo /var/run/gdm3/auth-for-$LIVE_USERNAME-*/database)"
GNOME_SHELL_PID="$(pgrep --newest --euid ${LIVE_USERNAME} gnome-shell)"
export "$(tr '\0' '\n' < /proc/${GNOME_SHELL_PID}/environ | \
grep '^DBUS_SESSION_BUS_ADDRESS=')"
exec /bin/su -c /usr/local/bin/tails-htp-notify-user "$LIVE_USERNAME" & exec /bin/su -c /usr/local/bin/tails-htp-notify-user "$LIVE_USERNAME" &
} }
......
export_gnome_env() {
# Get LIVE_USERNAME
. /etc/live/config.d/username.conf
export DISPLAY=':0.0'
export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
GNOME_SHELL_PID="$(pgrep --newest --euid ${LIVE_USERNAME} gnome-shell)"
export "$(tr '\0' '\n' < /proc/${GNOME_SHELL_PID}/environ | \
grep '^DBUS_SESSION_BUS_ADDRESS=')"
}
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
set -e set -e
# Import export_gnome_env().
. /usr/local/lib/tails-shell-library/gnome.sh
# Get LIVE_USERNAME # Get LIVE_USERNAME
. /etc/live/config.d/username.conf . /etc/live/config.d/username.conf
...@@ -27,8 +30,7 @@ until pgrep -u "${LIVE_USERNAME}" "^ibus-daemon" >/dev/null ; do ...@@ -27,8 +30,7 @@ until pgrep -u "${LIVE_USERNAME}" "^ibus-daemon" >/dev/null ; do
done done
export LANG export LANG
export DISPLAY=':0.0' export_gnome_env
export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
( (
sudo -u ${LIVE_USERNAME} xhost +SI:localuser:vidalia sudo -u ${LIVE_USERNAME} xhost +SI:localuser:vidalia
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
set -e set -e
# Import export_gnome_env().
. /usr/local/lib/tails-shell-library/gnome.sh
# Get LIVE_USERNAME # Get LIVE_USERNAME
. /etc/live/config.d/username.conf . /etc/live/config.d/username.conf
...@@ -18,11 +21,6 @@ if [ -n "$3" ]; then ...@@ -18,11 +21,6 @@ if [ -n "$3" ]; then
timeout_args="--expire-time=$3" timeout_args="--expire-time=$3"
fi fi
( (
export DISPLAY=':0.0' export_gnome_env
export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
GNOME_SHELL_PID="$(pgrep --newest --euid ${LIVE_USERNAME} gnome-shell)"
export "$(tr '\0' '\n' < /proc/${GNOME_SHELL_PID}/environ | \
grep '^DBUS_SESSION_BUS_ADDRESS=')"
exec /bin/su -c "notify-send ${timeout_args} \"${summary}\" \"${body}\"" "${LIVE_USERNAME}" & exec /bin/su -c "notify-send ${timeout_args} \"${summary}\" \"${body}\"" "${LIVE_USERNAME}" &
) )
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
set -e set -e
# Import export_gnome_env().
. /usr/local/lib/tails-shell-library/gnome.sh
unset TOR_CONTROL_PASSWD unset TOR_CONTROL_PASSWD
unset TOR_FORCE_NET_CONFIG unset TOR_FORCE_NET_CONFIG
TOR_CONFIGURE_ONLY=1 TOR_CONFIGURE_ONLY=1
...@@ -29,8 +32,7 @@ until pgrep -u "${LIVE_USERNAME}" '^ibus-daemon' >/dev/null ; do ...@@ -29,8 +32,7 @@ until pgrep -u "${LIVE_USERNAME}" '^ibus-daemon' >/dev/null ; do
done done
export LANG export LANG
export DISPLAY=':0.0' export_gnome_env
export XAUTHORITY="`echo /var/run/gdm3/auth-for-${LIVE_USERNAME}-*/database`"
sudo -u ${LIVE_USERNAME} xhost +SI:localuser:tor-launcher sudo -u ${LIVE_USERNAME} xhost +SI:localuser:tor-launcher
gksudo -u tor-launcher /usr/bin/tor-launcher gksudo -u tor-launcher /usr/bin/tor-launcher
RET=${?} RET=${?}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment