diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-26 10:40:06 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-26 10:40:06 +0200 |
| commit | 5886c8d4919f7b8902f3eeb8fd3ea26a83033d13 (patch) | |
| tree | 2d5f16c9357a8690593e5c245f1c5846daaddb6c | |
| parent | 24ef37c302c1c7900c113dd92240000a2cacf755 (diff) | |
| download | dist-upgrade-5886c8d4919f7b8902f3eeb8fd3ea26a83033d13.tar.gz dist-upgrade-5886c8d4919f7b8902f3eeb8fd3ea26a83033d13.zip | |
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.
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | dist-upgrade | 11 |
2 files changed, 11 insertions, 3 deletions
@@ -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 |
