refactor: update package lists only when stale #346

Merged
cravl-dev merged 11 commits from fix-334 into master 2023-06-17 18:08:24 +02:00
Showing only changes of commit 7788e7cd87 - Show all commits

View File

@@ -375,10 +375,13 @@ function update_system_package_lists() {
# update if cache is greater than 48 hours old
if [[ $update_age -gt $((48*60*60)) ]]; then
if [[ ! $silent ]]; then status_msg "Updating package lists..."; fi
if ! sudo apt-get update --allow-releaseinfo-change; then
if ! sudo apt-get update --allow-releaseinfo-change &>/dev/null; then
log_error "Failure while updating package lists!"
if [[ ! $silent ]]; then error_msg "Updating package lists failed!"; fi
exit 1
else
log_info "Package lists updated successfully"
if [[ ! $silent ]]; then status_msg "Updated package lists."; fi
fi
else
log_info "Package lists updated recently, skipping update..."