From 1b55df97711ae3521c1a7257431e85729ca6aa45 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Wed, 11 Mar 2026 02:45:01 +0000 Subject: [PATCH] fix: Show apt-fast install progress and handle errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use tee instead of redirect so install output is visible in the workflow log while still being captured to the install log file - Check PIPESTATUS[0] for the actual apt-fast exit code (since tee always succeeds) and exit with a clear error message on failure - Remove the redundant installed package list logging — the full install output is now visible via tee, and the individual cache lines already show each package being processed Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6) --- install_and_cache_pkgs.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/install_and_cache_pkgs.sh b/install_and_cache_pkgs.sh index 70636ac..9c7742a 100755 --- a/install_and_cache_pkgs.sh +++ b/install_and_cache_pkgs.sh @@ -76,21 +76,19 @@ install_log_filepath="${cache_dir}/install.log" log "Clean installing ${package_count} packages..." # Zero interaction while installing or upgrading the system via apt. -sudo DEBIAN_FRONTEND=noninteractive apt-fast --yes install ${packages} > "${install_log_filepath}" -log "done" -log "Installation log written to ${install_log_filepath}" +# Explicitly check exit status since set +e (from lib.sh) is active. +sudo DEBIAN_FRONTEND=noninteractive apt-fast --yes install ${packages} 2>&1 | tee "${install_log_filepath}" +install_rc=${PIPESTATUS[0]} + +if [ "${install_rc}" -ne 0 ]; then + log_err "Failed to install packages. apt-fast exited with an error (see messages above)." + exit 5 +fi +log "Install completed successfully." log_empty_line installed_packages=$(get_installed_packages "${install_log_filepath}") -log "Installed package list:" -for installed_package in ${installed_packages}; do - # Reformat for human friendly reading. - log "- $(echo ${installed_package} | awk -F\= '{print $1" ("$2")"}')" -done - -log_empty_line - installed_packages_count=$(wc -w <<< "${installed_packages}") log "Caching ${installed_packages_count} installed packages..." for installed_package in ${installed_packages}; do