dbus-1/dbus_at_console.ck
Marcus Meissner 74a1b3bed4 Accepting request 155728 from home:rmilasan:branches:Base:System
- Revert patch: dbus-move-everything-to-run-directory.patch (bnc#802525). 

- Revert patch: dbus-move-everything-to-run-directory.patch (bnc#802525).

OBS-URL: https://build.opensuse.org/request/show/155728
OBS-URL: https://build.opensuse.org/package/show/Base:System/dbus-1?expand=0&rev=114
2013-02-19 14:25:57 +00:00

28 lines
636 B
Plaintext

#!/bin/bash
#
# use consolekit to support legacy at_console setting
#
reason="$1"
dir=/var/run/dbus/at_console
# for at_console we are only interested in local sessions
test "$CK_SESSION_IS_LOCAL" = true || exit 0
test "$reason" = "session_added" -o "$reason" = "session_removed" || exit 0
sessid=${CK_SESSION_ID##*/}
sessid=${sessid//[^A-Za-z0-9]/_}
test -n "$sessid" || exit 1
name=`getent passwd "$CK_SESSION_USER_UID" 2>/dev/null | awk -F: '{print $1}'`
test -n "$name" || exit 1
if test "$reason" = "session_added"; then
mkdir -p "$dir/$name"
touch "$dir/$name/$sessid"
else
rm "$dir/$name/$sessid"
rmdir "$dir/$name"
fi