feat: update package lists only when stale (#334)

This commit is contained in:
Cameron Ryder
2023-06-03 16:48:27 -04:00
parent 8228943850
commit d97cca69a6
6 changed files with 71 additions and 28 deletions

View File

@@ -321,12 +321,16 @@ function install_klipper_packages() {
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
read -r -a packages <<< "${packages}"
### Update system package info
### Update system package info if lists > 3 days old
status_msg "Updating package lists..."
if ! sudo apt-get update --allow-releaseinfo-change; then
log_error "failure while updating package lists"
error_msg "Updating package lists failed!"
exit 1
if [[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -3)" ]]; then
if ! sudo apt-get update --allow-releaseinfo-change; then
log_error "failure while updating package lists"
error_msg "Updating package lists failed!"
exit 1
fi
else
status_msg "Package lists updated recently, skipping..."
fi
### Install required packages