1
0

fix: check if cache already exists

This commit is contained in:
dump_stack() 2023-05-13 16:08:59 +00:00
parent 065aca24b0
commit 39f4cd4cfd
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

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