Skip to content

Commit

Permalink
webui: Handle XAUTHORITY and XDG_RUNTIME_DIR
Browse files Browse the repository at this point in the history
The titlebar with "Mozilla Firefox" has been fixed but there
are some more bits that can be cleaned up.

This commit achieves that by:

1. Make sure more of the environment is bubbled through anaconda to
   the webui launcher. In particular, we need XDG_CURRENT_DESKTOP, but
   this commit brings it all through, so firefox runs in an environment
   as close to getting run directly by the live user as possible.
2. Two exceptions are XAUTHORITY and XDG_RUNTIME_DIR which need to
   remain unset until we can run firefox as a normal user instead of root.
  • Loading branch information
halfline authored and adamkankovsky committed Jun 5, 2024
1 parent 6ab4232 commit c628fca
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions data/liveinst/liveinst
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ BACKEND_READY_FLAG=/run/anaconda/backend_ready
# unprivileged, restart running as root.
if [ "$(id -u)" -ne 0 ]; then
xhost +si:localuser:root
unset XAUTHORITY
pkexec "$0" "$@"
fi

# pkexec clears DBUS_SESSION_BUS_ADDRESS from environment
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${PKEXEC_UID}/bus
# pkexec clears the environment, so get it back
if [ -n "${PKEXEC_UID}" ]; then
INSTALLER_USER=$(id -n -u "${PKEXEC_UID}")
readarray -t user_environment < <(pkexec --user "${INSTALLER_USER}" env XDG_RUNTIME_DIR="/run/user/${PKEXEC_UID}" systemctl --user show-environment)

for variable in "${user_environment[@]}"; do
export "${variable?}"
done
fi

# Allow running another command in the place of anaconda, but in this same
Expand Down

0 comments on commit c628fca

Please sign in to comment.