14 #PAM_TYPE=open_session
15 #PAM_TYPE=close_session
20 last_wtmp_entry
7 reboot
24 last_wtmp_entry
1 "$1"
31 for wtmp
in $
(echo /var
/log
/wtmp
* |
tr " " "\n" |
sort -t.
-k2n)
34 LD_PRELOAD
=/usr
/lib
/yazzy-preload
/openhelper.so \
35 OPENHELPER_FNMATCH
='/var/log/wtmp.*.*' \
36 OPENHELPER_COMMAND
='case "$OPENHELPER_FILE" in
37 *.xz) exec unxz -c "$OPENHELPER_FILE";;
38 *.gz) exec gunzip -c "$OPENHELPER_FILE";;
39 *.bz2) exec bunzip2 -c "$OPENHELPER_FILE";;
42 lastcsv
-f "$wtmp" -n 1 "$wtmp_match" |\
43 wtmp_match
=$wtmp_match \
44 awk -F';' '$'$wtmp_field'==ENVIRON["wtmp_match"]{print $5}'
46 if [ -n "$timestamp" ]
54 lastlogin
=`last_wtmp_login "$PAM_USER"`
55 lastreboot
=`last_reboot`
57 if [ -n "$lastlogin" ]
59 lastlogin
=$lastlogin perl
-MTime::Duration
-e 'printf "Last login: %s\n", ago(time - $ENV{"lastlogin"});'
62 if expr "$*" : '.*\<force\>' >/dev
/null ||
[ -z "$lastlogin" ] ||
[ "$lastlogin" -le "$lastreboot" ] 2>/dev
/null
67 echo "First login since last reboot: $(date -d @"$lastreboot")"