openbsd-ports/sysutils/consolekit/files/ck-get-x11-server-pid
ajacoutot eb874011f3 Bring in several fixes from FreeBSD and fd.o bugzilla.
Fix tty names, cmd arguments... Install the stop/restart scripts.
Remove policykit support for now.
2009-11-13 14:52:33 +00:00

18 lines
334 B
Bash

#!/bin/sh
SED="/usr/bin/sed"
CAT="/bin/cat"
dispnum=0
if [ ! -z "${DISPLAY}" ]; then
dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
fi
if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
echo "ERROR: Failed to find X lock file for display ${dispnum}"
exit 1
fi
pid=$(${CAT} "/tmp/.X${dispnum}-lock")
echo ${pid}