pkgbuilds/condor-libs/pkexec-gui
2024-10-13 10:19:50 -05:00

21 lines
725 B
Bash

#!/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 "$@"