#!/bin/sh --
set -eu
XORG="/usr/bin/X"
if [ -x /usr/libexec/Xorg ]; then
    # bypass setuid-root wrapper, we don't need root here
    XORG=/usr/libexec/Xorg
fi
if [ -f /etc/X11/Xsession ]; then
    # Debian installs Xorg without setuid root bit, with a setuid wrapper.
    # The wrapper is not useful for qubes, but it does not matter since
    # we can Xorg with qubes drivers without root. But we need to call
    # Xorg directly, not X (which is the wrapper).
    if [ -x /usr/lib/xorg/Xorg ]; then
        XORG="/usr/lib/xorg/Xorg"
    else
        XORG="/usr/bin/Xorg"
    fi
fi
exec "$XORG" "$@"
