refresh the package index in pre-flight, not inside a skippable step

The refresh lived inside "System update", which `step` skips when its name is
already in the progress file. So a resumed run — the common case, since that is
what the progress file is for — installed core utils, added the fastfetch PPA and
set up the Docker repo against whatever the index happened to say hours or days
earlier. On a box left overnight that is a stale index and a "package not found"
somewhere unrelated.

It now runs in pre-flight, unconditionally, before any step exists to skip it.
`apt-get upgrade` stays where it was and stays confirmable: refreshing the index
changes nothing on the machine, upgrading is the one thing that does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 17:45:19 +00:00
co-authored by Claude Opus 5
parent 6480788979
commit b5948f9673
+11 -3
View File
@@ -76,6 +76,14 @@ fi
USER_HOME="/home/$USERNAME" USER_HOME="/home/$USERNAME"
# Always, and outside any step: everything below reads this index — core utils,
# the fastfetch PPA, the Docker repo — and `step` skips a step whose name is
# already in the progress file. With the refresh inside one of those, a resumed
# run installed against whatever the index happened to say hours or days ago.
echo ""
info "Refreshing the package index..."
pkg_refresh >/dev/null
# ============================================================================= # =============================================================================
# 2. System update # 2. System update
# ============================================================================= # =============================================================================
@@ -83,12 +91,12 @@ USER_HOME="/home/$USERNAME"
# Its own section because it is the only thing in the script that moves versions # Its own section because it is the only thing in the script that moves versions
# of software already on the machine. Everything else only ever adds what is # of software already on the machine. Everything else only ever adds what is
# absent, so this is the one that deserves to be refused on its own. # absent, so this is the one that deserves to be refused on its own.
#
# The index refresh is NOT here — it runs in pre-flight, unconditionally, because
# every later step reads it and this one can be skipped.
step "System update" step "System update"
if ! skip; then if ! skip; then
info "Refreshing the package index..."
pkg_refresh >/dev/null
mapfile -t UPGRADABLE < <(pkg_upgradable) mapfile -t UPGRADABLE < <(pkg_upgradable)
echo "" echo ""