mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-05-09 11:33:16 +00:00
fix: Show apt-fast install progress and handle errors
- 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)
This commit is contained in:
parent
3269da2d67
commit
1b55df9771
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue