summaryrefslogtreecommitdiff
path: root/pcr/consolekit/pam-foreground-compat.ck
diff options
context:
space:
mode:
authorOmar Vega Ramos <ovruni@gnu.org.pe>2017-03-21 12:01:42 -0500
committerOmar Vega Ramos <ovruni@gnu.org.pe>2017-03-21 12:01:42 -0500
commit9b16ca2f9be52bb51f1d643b6bfb49a99a3fc1a7 (patch)
treee29d4eced7c3af54d2c4d31f8c31a7fee0dc0599 /pcr/consolekit/pam-foreground-compat.ck
parentd504129dd82d1e6b153e498e544a6bd9f30d5ab2 (diff)
downloadabslibre-9b16ca2f9be52bb51f1d643b6bfb49a99a3fc1a7.tar.gz
abslibre-9b16ca2f9be52bb51f1d643b6bfb49a99a3fc1a7.tar.bz2
abslibre-9b16ca2f9be52bb51f1d643b6bfb49a99a3fc1a7.zip
consolekit: re-add package to [pcr]
Diffstat (limited to 'pcr/consolekit/pam-foreground-compat.ck')
-rw-r--r--pcr/consolekit/pam-foreground-compat.ck17
1 files changed, 17 insertions, 0 deletions
diff --git a/pcr/consolekit/pam-foreground-compat.ck b/pcr/consolekit/pam-foreground-compat.ck
new file mode 100644
index 000000000..90b8081e4
--- /dev/null
+++ b/pcr/consolekit/pam-foreground-compat.ck
@@ -0,0 +1,17 @@
+#!/bin/sh
+TAGDIR=/run/console
+
+[ -n "$CK_SESSION_USER_UID" ] || exit 1
+
+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
+