#!/bin/sh
set -e

[ "$1" = configure -a "$2" ] \
    && dpkg --compare-versions $2 lt 961025 \
    || [ -z "$2" ] \
    || exit 0

if [ -f /etc/usertty ] ; then
    cat > /etc/usertty$$ <<EOF
# WARNING: This file isn't used by the current version of login.
# Similiar functionality is available in /etc/login.defs,
# /etc/login.access, and /etc/porttime.  See login.defs(5),
# login.access(5), and porttime(5) for details.  You may safely remove
# this file after configuring the other three.
#
EOF
    cat /etc/usertty >> /etc/usertty$$
    mv -f /etc/usertty$$ /etc/usertty

    if egrep -vqn '^#|^ *$' /etc/usertty ; then cat <<EOF
You've configured /etc/usertty, but the current version of login no
longer supports it.  Similiar functionality is available in other
files, which you will have to configure for your purposes.

A more detailed explanation has been prepended to /etc/usertty.
You'll have to do some configuration later.

Please hit return to confirm.
EOF

	read
    fi
fi

if [ ! -f /var/log/faillog ] ; then
    touch /var/log/faillog
    chown root:root /var/log/faillog
    chmod 644 /var/log/faillog
fi

update-rc.d logoutd defaults > /dev/null
