From 5886c8d4919f7b8902f3eeb8fd3ea26a83033d13 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 26 Sep 2026 10:40:06 +0200 Subject: Recap a pending clean-system in non-interactive runs Unattended clean-system lists removable packages but removes nothing by design, and with no reminder they were easy to miss. Non-interactive clean-system exits 0 when it listed candidates and 20 when there were none, so set CLEAN_PENDING from the return code and print a closing line telling the user to re-run with -i. --- README.md | 3 ++- dist-upgrade | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86f6098..d49b986 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ asks. A second occurrence aborts with a message instead of looping. Unattended mode runs the package commands with `-batch=on -default_answer=y`. `clean-system` is the exception: unattended it only lists packages that are not part of the official Slackware set and removes nothing, so third-party or -local packages are never deleted silently. Use `-i` to review and remove. +local packages are never deleted silently. When it does find such packages, the +closing recap reminds you to re-run with `-i` to review and remove them. ## Requirements diff --git a/dist-upgrade b/dist-upgrade index 57594ed..0b2f7a1 100755 --- a/dist-upgrade +++ b/dist-upgrade @@ -25,6 +25,7 @@ INTERACTIVE=0 TMPDIR_SNAP="" ORIG_ARGS=("$@") RESTARTS=${DIST_UPGRADE_RESTARTS:-0} +CLEAN_PENDING=0 die() { printf 'dist-upgrade: %s\n' "$*" >&2; exit 1; } warn() { printf 'WARNING: %s\n' "$*" >&2; } @@ -307,9 +308,11 @@ run_step upgrade-all if [ "$INTERACTIVE" -eq 1 ]; then run_step clean-system else - info "clean-system: listing packages not in the official tree only, removing nothing (use -i to review)." + info "clean-system: listing packages not in the official tree only, removing nothing (review at the end)." slackpkg -batch=on -default_answer=n clean-system - handle_rc clean-system $? + clean_rc=$? + [ "$clean_rc" -eq 0 ] && CLEAN_PENDING=1 + handle_rc clean-system "$clean_rc" fi run_step new-config @@ -317,6 +320,10 @@ check_initrd report_leftovers +if [ "$CLEAN_PENDING" -eq 1 ]; then + info "clean-system listed packages not in the official set; re-run dist-upgrade with -i (or run 'slackpkg clean-system') to review and remove them. See $LOG." +fi + running=$(uname -r) newver=$(newest_kernel) if [ -n "$newver" ] && [ "$running" != "$newver" ]; then -- cgit v1.2.3