Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust checking of age of apt cache #90

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions install_and_cache_pkgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ manifest_main=""
log "Package list:"
for package in ${normalized_packages}; do
read package_name package_ver < <(get_package_name_ver "${package}")
manifest_main="${manifest_main}${package_name}:${package_ver},"
manifest_main="${manifest_main}${package_name}:${package_ver},"
log "- ${package_name}:${package_ver}"
done
write_manifest "main" "${manifest_main}" "${cache_dir}/manifest_main.log"
Expand All @@ -45,12 +45,11 @@ log "done"
log_empty_line

log "Updating APT package list..."
last_update_delta_s=$(($(date +%s) - $(date +%s -r /var/cache/apt/pkgcache.bin)))
if test $last_update_delta_s -gt 300; then
if [[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mmin -5)" ]]; then
sudo apt-fast update > /dev/null
log "done"
else
log "skipped (fresh by ${last_update_delta_s} seconds)"
log "skipped (fresh within at least 5 minutes)"
fi

log_empty_line
Expand Down