1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#!/bin/sh
set -e
if [ "$1" = "configure" ] && \
dpkg --compare-versions "$2" ge "0.13.0-6~" && \
dpkg --compare-versions "$2" lt "0.72.0-2~"
then
echo "Forcibly resetting runlevels for wtmpdb-update-boot on this upgrade"
update-rc.d -f wtmpdb-update-boot remove || true
fi
old_log="${DPKG_ROOT:-}/var/log/wtmp"
new_log="${DPKG_ROOT:-}/var/log/wtmp.db"
tmp_log="$new_log.import-tmp"
# If wtmp logs are present on first installation, import them.
if [ "$1" = "configure" ] && [ -z "$2" ] && \
[ -s "$old_log" ] && [ ! -s "$new_log" ]
then
# Convert all entries or none.
printf "Converting wtmp login records into wtmpdb database ... "
if wtmpdb import -f "$tmp_log" "$old_log"
then
[ ! -s "$tmp_log" ] || mv -f "$tmp_log" "$new_log"
echo "done"
else
[ ! -s "$tmp_log" ] || rm -f "$tmp_log"
echo "failed"
fi
fi
#DEBHELPER#
|