pkgbuilds/condor-libs/pkexec-gui

21 lines
725 B
Plaintext
Raw Permalink Normal View History

2024-10-13 09:19:50 -06:00
#!/bin/bash
# Elevate
if [[ $EUID -ne 0 ]]; then
exec pkexec /usr/lib/condor/pkexec-gui "$@"
exit 1
fi
# Launch dbus session if not already running
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
eval $(dbus-launch --sh-syntax --exit-with-session)
fi
# Restore some variables from parent process
while IFS= read -rd '' var; do export "$var"; done < <(grep --null-data -ae "^\(XDG_CURRENT_DESKTOP\|WAYLAND_DISPLAY\|XDG_RUNTIME_DIR\|XDG_SESSION_TYPE\|XCURSOR_SIZE\|LC_.*\|LANG\|LANGUAGE\|QT_WAYLAND_FORCE_DPI\|QT_QPA_PLATFORMTHEME\|QT_STYLE_OVERRIDE\|\)=.*\$" /proc/$PPID/environ)
if [[ -v WAYLAND_DISPLAY ]]; then
export WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"
fi
export XDG_RUNTIME_DIR="/run/user/0"
exec "$@"