pam-foreground-compat.ck 441 B

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