On Fri, Oct 10, 2025 at 12:54:54AM +0200, Thorsten Glaser wrote:
> Eurgh. Very colourful, slow even on the work laptop from 2025
> (not just the private laptop from 2007), and hard to use, and
> needing a JS-capable webbrowser.

OK! Well I attach the debian/ adaptations - that's where the risk area
is, the maintscripts.
>From 320301da44e469a6bbb7d2fb6aac227c8e8d020c Mon Sep 17 00:00:00 2001
From: Andrew Bower <[email protected]>
Date: Thu, 9 Oct 2025 22:34:48 +0100
Subject: [PATCH 2/2] Handle new /var/log/wtmp.db location

---
 debian/README.Debian               |  5 +++--
 debian/libwtmpdb0.postinst         | 29 +++++++++++++++++++++++++++++
 debian/libwtmpdb0.wtmpdb.logrotate |  4 +---
 debian/wtmpdb.postinst             |  2 +-
 4 files changed, 34 insertions(+), 6 deletions(-)
 create mode 100644 debian/libwtmpdb0.postinst

diff --git a/debian/README.Debian b/debian/README.Debian
index c01c89f..ce45b0d 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -11,8 +11,9 @@ Log location
 ------------
 
 The datafile for the login and reboot records is currently stored in the
-tool's state directory '/var/lib/wtmpdb' instead of the system log directory
-'/var/log'.
+system log directory '/var/log' instead of the tool's state directory
+'/var/lib/wtmpdb' as defined upstream via /usr/include/wtmpdb.h. On Debian
+/var/lib/wtmpdb/wtmp.db should be a symbolic link to /var/log/wtmp.db.
 
 
 Logging SSH sessions
diff --git a/debian/libwtmpdb0.postinst b/debian/libwtmpdb0.postinst
new file mode 100644
index 0000000..4d61119
--- /dev/null
+++ b/debian/libwtmpdb0.postinst
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+
+lib_log="${DPKG_ROOT:-}/var/lib/wtmpdb/wtmp.db"
+new_log="${DPKG_ROOT:-}/var/log/wtmp.db"
+
+# Effect the conversion from storing the live log in the state directory to
+# storing it in its proper place, the logs directory. Also set up the symlink
+# where tmpfiles.d is not available.
+if [ "$1" = "configure" ]
+then
+  if [ -s "$lib_log" ] && [ ! -h "$lib_log" ] && [ ! -s "$new_log" ]
+  then
+    mv -f "$lib_log" "$new_log"
+  fi
+
+  # The unhandled case is records in both locations. For this we need
+  # a 'wtmpdb merge' operation called in wtmpdb.postinst but no such
+  # operation yet exists.
+
+  if [ ! -f "$lib_log" ]
+  then
+    mkdir -p "$(dirname "$lib_log")"
+    ln -sf ../../log/wtmp.db "$lib_log"
+  fi
+fi
+
+#DEBHELPER#
diff --git a/debian/libwtmpdb0.wtmpdb.logrotate b/debian/libwtmpdb0.wtmpdb.logrotate
index d856fe1..cbfc00e 100644
--- a/debian/libwtmpdb0.wtmpdb.logrotate
+++ b/debian/libwtmpdb0.wtmpdb.logrotate
@@ -1,9 +1,7 @@
-/var/lib/wtmpdb/wtmp.db {
+/var/log/wtmp.db {
     missingok
     yearly
     create
     nocompress
     rotate 4
-    olddir /var/log
-    renamecopy
 }
diff --git a/debian/wtmpdb.postinst b/debian/wtmpdb.postinst
index 90a66ec..76d6dd4 100644
--- a/debian/wtmpdb.postinst
+++ b/debian/wtmpdb.postinst
@@ -11,7 +11,7 @@ then
 fi
 
 old_log="${DPKG_ROOT:-}/var/log/wtmp"
-new_log="${DPKG_ROOT:-}/var/lib/wtmpdb/wtmp.db"
+new_log="${DPKG_ROOT:-}/var/log/wtmp.db"
 tmp_log="$new_log.import-tmp"
 
 # If wtmp logs are present on first installation, import them.
-- 
2.51.0

Reply via email to