skip running apt-get update if we are very sure that it was already run

This commit is contained in:
Johannes Schauer Marin Rodrigues 2023-01-16 07:39:15 +01:00
parent 644ac62ecd
commit 9945e65701
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -2275,8 +2275,19 @@ sub run_update() {
CHDIR => $options->{root},
};
# Maybe "apt-get update" was already run in the setup hook? If yes, skip
# running it here. We are overly strict on purpose because better to run it
# twice on accident than not at all.
if ( !-d "$options->{root}/var/lib/apt/lists/auxfiles"
|| !-d "$options->{root}/var/lib/apt/lists/partial"
|| !-e "$options->{root}/var/lib/apt/lists/lock"
|| !-e "$options->{root}/var/cache/apt/pkgcache.bin"
|| !-e "$options->{root}/var/cache/apt/srcpkgcache.bin") {
info "running apt-get update...";
run_apt_progress($aptopts);
} else {
info "skipping apt-get update because it was already run";
}
# check if anything was downloaded at all
{