Blame SOURCES/dbus-kill-process-with-session

7e0b64
#!/bin/bash
7e0b64
# This script ensures the dbus-daemon is killed when the session closes.
7e0b64
# It's used by SSH sessions that have X forwarding (since the X display
7e0b64
# may outlive the session in those cases)
7e0b64
[ $# != 1 ] && exit 1
7e0b64
7e0b64
exec >& /dev/null
7e0b64
7e0b64
trap "kill -TERM $1" EXIT
7e0b64
7e0b64
export GVFS_DISABLE_FUSE=1
7e0b64
coproc SESSION_MONITOR (gio monitor -f "/run/systemd/sessions/${XDG_SESSION_ID}")
7e0b64
7e0b64
while grep -q ^State=active <(loginctl show-session $XDG_SESSION_ID)
7e0b64
do
7e0b64
    read -u ${SESSION_MONITOR[0]}
7e0b64
done