From 24ef37c302c1c7900c113dd92240000a2cacf755 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 26 Sep 2026 10:11:32 +0200 Subject: Ship a logrotate rule for the run log /var/log/dist-upgrade.log grows across runs: rotate weekly, keep 8 compressed, mode 0640 root:root. Uses create rather than copytruncate since the script reopens the file on each run. --- AGENTS.md | 9 +++++++-- README.md | 3 +++ logrotate.d/dist-upgrade | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 logrotate.d/dist-upgrade diff --git a/AGENTS.md b/AGENTS.md index 5024c4d..723408e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,6 +11,10 @@ Run all of these before calling a change done: ./dist-upgrade --self-test shellcheck --exclude=SC2218 dist-upgrade +If `logrotate` is available, the shipped rule can be checked with: + + logrotate -d logrotate.d/dist-upgrade + SC2218 is a shellcheck 0.11.0 false positive: it flags a function called on the left of a pipe inside another function definition (`b() { a | cat; }`), even when `a` is defined above. Keep it excluded; do not restructure the pipeline to @@ -21,8 +25,9 @@ silence it. - Do not run the script itself, or any `slackpkg` command, in this repo. It performs a real system upgrade and only makes sense on the user's Slackware box as root. -- Do not add config, cache or log files. The script is self-contained and - configured through the `INITRD` environment variable. +- Do not add runtime config, cache or log files. The script is self-contained + and configured through the `INITRD` and `LOG` environment variables; the only + config it ships is `logrotate.d/dist-upgrade`. ## Conventions diff --git a/README.md b/README.md index 63e35b3..86f6098 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ Environment: - `LOG` append the whole run, slackpkg output included, to this file (default `/var/log/dist-upgrade.log`; set it empty to disable) +A logrotate rule for that log ships in `logrotate.d/dist-upgrade`; install it +to `/etc/logrotate.d/`. + ## What it does 1. Snapshots the current initrd's kernel version and module list. diff --git a/logrotate.d/dist-upgrade b/logrotate.d/dist-upgrade new file mode 100644 index 0000000..30af922 --- /dev/null +++ b/logrotate.d/dist-upgrade @@ -0,0 +1,9 @@ +/var/log/dist-upgrade.log { + weekly + rotate 8 + missingok + notifempty + compress + delaycompress + create 0640 root root +} -- cgit v1.2.3