diff options
author | Bart Ribbers <bribbers@disroot.org> | 2017-08-23 00:46:46 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2017-08-30 16:34:57 +0000 |
commit | d7f4c260d1287526e7030413504fef9e52c5b9a3 (patch) | |
tree | 4bac9494d56be94c074748c2af4a97c44d8b56ec /main/consolekit2/pam-foreground-compat.ck | |
parent | 24e6b26f69a01184a93003a97f816c6452ae46b3 (diff) | |
download | aports-d7f4c260d1287526e7030413504fef9e52c5b9a3.tar.bz2 aports-d7f4c260d1287526e7030413504fef9e52c5b9a3.tar.xz |
main/consolekit: replaced by consolekit2
Diffstat (limited to 'main/consolekit2/pam-foreground-compat.ck')
-rw-r--r-- | main/consolekit2/pam-foreground-compat.ck | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/main/consolekit2/pam-foreground-compat.ck b/main/consolekit2/pam-foreground-compat.ck new file mode 100644 index 0000000000..c9255503c4 --- /dev/null +++ b/main/consolekit2/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 |