1
0
Fork 0

fix: check if cache already exists

master
dump_stack() 2023-05-13 16:08:59 +00:00
parent 065aca24b0
commit 39f4cd4cfd
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
"code.dumpstack.io/tools/out-of-tree/cache"
"code.dumpstack.io/tools/out-of-tree/config"
"code.dumpstack.io/tools/out-of-tree/fs"
)
type Release int
@ -131,9 +132,13 @@ func MatchImagePkg(km config.KernelMask) (pkgs []string, err error) {
CachePath = config.File("debian.cache")
log.Debug().Msgf("Use default kernels cache path: %s", CachePath)
err = cache.DownloadDebianCache(CachePath)
if err != nil {
log.Debug().Err(err).Msg("No remote cache, will take some time")
if !fs.PathExists(CachePath) {
log.Debug().Msgf("No cache, download")
err = cache.DownloadDebianCache(CachePath)
if err != nil {
log.Debug().Err(err).Msg(
"No remote cache, will take some time")
}
}
} else {
log.Debug().Msgf("Debian kernels cache path: %s", CachePath)