#!/bin/sh if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc" ]; then server=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc elif [ -r "$HOME/.xserverrc" ]; then server=$HOME/.xserverrc else server=/etc/X11/xinit/xserverrc fi if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession" ]; then client=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession elif [ -r "$HOME/.xsession" ]; then client="$HOME/.xsession" else client=/etc/X11/xinit/xinitrc fi # Automatically determine an unused $DISPLAY d=0 while true; do [ -e "/tmp/.X$d-lock" ] || [ -S "/tmp/.X11-unix/X$d" ] || break d=$((d + 1)) done display=":$d" unset d if [ -z "${XAUTHORITY+x}" ]; then XAUTHORITY=$HOME/.Xauthority export XAUTHORITY fi removelist= # check for GNU hostname if hostname --version >/dev/null 2>&1; then if ! hostname --version 2>&1 | grep GNU -q; then hostname=$(hostname -f) fi fi if [ -z "$hostname" ]; then hostname=$(hostname) fi authdisplay=${display:-:0} mcookie=$(/usr/bin/mcookie) if [ -z "${mcookie+x}" ]; then echo "Couldn't create cookie" exit 1 fi dummy=0 # create a file with auth information for the server. ':0' is a dummy. xserverauthfile=$(mktemp --tmpdir serverauth.XXXXXXXXXX) trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM xauth -q -f "$xserverauthfile" </dev/null if [ -n "${authcookie+x}" ]; then xauth -q </dev/null 2>&1; then deallocvt fi exit $retval