#!/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 # Remove dangling systemd timer symlink from 0.73.0-2 and earlier f="${DPKG_ROOT:-}/etc/systemd/system/timers.target.wants/wtmpdb-rotate.timer" if [ -h "$f" ] && [ ! -e "$f" ] then rm -f "$f" 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#