orion / rpms / dbus

Forked from rpms/dbus a year ago
Clone

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

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