Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liveinst: Allow running as a Wayland-native application #5946

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
liveinst: Allow running as a Wayland-native application
As long as we have the path to the Wayland socket, we can run
Anaconda as a Wayland-native application.
  • Loading branch information
Conan-Kudo committed Oct 26, 2024
commit 54a7098b7f70418a8a60e9e762e25f933aad07fe
34 changes: 31 additions & 3 deletions data/liveinst/liveinst
Original file line number Diff line number Diff line change
@@ -20,10 +20,23 @@

BACKEND_READY_FLAG=/run/anaconda/backend_ready

WAYLAND_DISPLAY_SOCKET=/tmp/anaconda-wldisplay

# Detect and save the wayland socket before re-exec
if [ -n "$WAYLAND_DISPLAY" ]; then
if [ -e "$WAYLAND_DISPLAY_SOCKET" ]; then
rm -f "${WAYLAND_DISPLAY_SOCKET}"
fi
touch "${WAYLAND_DISPLAY_SOCKET}"
echo "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}" > ${WAYLAND_DISPLAY_SOCKET}
fi

# The command needs to be run with root privileges, so if it was started
# unprivileged, restart running as root.
if [ "$(id -u)" -ne 0 ]; then
xhost +si:localuser:root
if [ -z "$WAYLAND_DISPLAY" ]; then
xhost +si:localuser:root
fi
pkexec "$0" "$@"
Conan-Kudo marked this conversation as resolved.
Show resolved Hide resolved
exit $?
fi
@@ -38,6 +51,19 @@ if [ -n "${PKEXEC_UID}" ]; then
done
fi

# pkexec clears WAYLAND_DISPLAY from environment
Conan-Kudo marked this conversation as resolved.
Show resolved Hide resolved
if [ -z "$WAYLAND_DISPLAY" ] && [ -e "$WAYLAND_DISPLAY_SOCKET" ]; then
WAYLAND_DISPLAY=$(cat "${WAYLAND_DISPLAY_SOCKET}")
export WAYLAND_DISPLAY
fi

# use the correct home and config directories for system settings
PKEXEC_USER=$(id -un "${PKEXEC_UID}")
Conan-Kudo marked this conversation as resolved.
Show resolved Hide resolved
HOME=$(bash -c "cd ~${PKEXEC_USER} && pwd")
export HOME
XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CONFIG_HOME

# Allow running another command in the place of anaconda, but in this same
# environment. This allows storage testing to make use of all the module
# loading and lvm control in this file, too.
@@ -175,8 +201,10 @@ start_anaconda() {
$ANACONDA "$@"
}

# Force the X11 backend since sudo and wayland do not mix
export GDK_BACKEND=x11
# If no wayland socket is set, force x11 so that it loads correctly
if [ -z "$WAYLAND_DISPLAY" ]; then
export GDK_BACKEND=x11
fi

if [ -x /usr/bin/udisks ]; then
/usr/bin/udisks --inhibit -- start_anaconda "$@"