blob: e6ef493489b096a828561f1cd0a2dd3ccb781b4b (
plain)
1 #!/bin/sh
2
3 TAGDIR=/run/console
4
5 [ -n "$CK_SESSION_USER_UID" ] || exit 1
6 [ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
7
8 TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
9
10 if [ "$1" = "session_added" ]; then
11 mkdir -p "$TAGDIR"
12 echo "$CK_SESSION_ID" >> "$TAGFILE"
13 fi
14
15 if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
16 sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
17 [ -s "$TAGFILE" ] || rm -f "$TAGFILE"
18 fi
|