aboutsummaryrefslogtreecommitdiffstats
path: root/main/consolekit/pam-foreground-compat.ck
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-05 14:50:57 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-05 14:53:34 +0000
commit85314dd187611074fc409c6cee98720751e499f6 (patch)
tree20d56616505f01e30331ea320c4e5ebc7b6bb412 /main/consolekit/pam-foreground-compat.ck
parentbe43b4346b07ca95a52951304763151e7b979abd (diff)
downloadaports-85314dd187611074fc409c6cee98720751e499f6.tar.bz2
aports-85314dd187611074fc409c6cee98720751e499f6.tar.xz
main/consolekit: use pam compat hook from debian
this fixes 'at_console' for dbus so logged in users are allowed to communicate with org.bluez. (bluetooth-applet and bluez-simple-agent) was found here: http://git.debian.org/?p=pkg-utopia/consolekit.git;a=tree;f=debian;hb=HEAD
Diffstat (limited to 'main/consolekit/pam-foreground-compat.ck')
-rw-r--r--main/consolekit/pam-foreground-compat.ck17
1 files changed, 17 insertions, 0 deletions
diff --git a/main/consolekit/pam-foreground-compat.ck b/main/consolekit/pam-foreground-compat.ck
new file mode 100644
index 0000000000..ce221c9749
--- /dev/null
+++ b/main/consolekit/pam-foreground-compat.ck
@@ -0,0 +1,17 @@
+#!/bin/sh
+TAGDIR=/var/run/console
+
+[ -n "$CK_SESSION_USER_UID" ] || exit 1
+[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
+
+TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
+
+if [ "$1" = "session_added" ]; then
+ mkdir -p "$TAGDIR"
+ echo "$CK_SESSION_ID" >> "$TAGFILE"
+fi
+
+if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
+ sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
+ [ -s "$TAGFILE" ] || rm -f "$TAGFILE"
+fi