refactor: update package lists only when stale (#346)

Co-authored-by: th33xitus <th33xitus@googlemail.com>
This commit is contained in:
cravl-dev
2023-06-17 12:08:24 -04:00
committed by GitHub
parent 5d7debd65e
commit 8eb2924832
9 changed files with 104 additions and 97 deletions

View File

@@ -197,7 +197,7 @@ function compare_crowsnest_versions() {
}
function install_crowsnest_dependencies() {
local packages
local packages log_name="Crowsnest"
local install_script="${CROWSNEST_DIR}/tools/install.sh"
### read PKGLIST from official install-script
@@ -208,21 +208,11 @@ function install_crowsnest_dependencies() {
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
read -r -a packages <<< "${packages}"
### Update system package info
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
fi
### Update system package lists if stale
update_system_package_lists
### Install required packages
status_msg "Installing required packages..."
if ! sudo apt-get install --yes "${packages[@]}"; then
log_error "failure while installing required crowsnest packages"
error_msg "Installing required packages failed!"
exit 1
fi
install_system_packages "${log_name}" "packages[@]"
}
function update_crowsnest() {