1
0

refactor: move fs-related functions to submodule

This commit is contained in:
2023-05-13 09:17:57 +00:00
parent 9b987bcc82
commit da5797766b
8 changed files with 63 additions and 47 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/rs/zerolog/log"
"code.dumpstack.io/tools/out-of-tree/config"
"code.dumpstack.io/tools/out-of-tree/fs"
)
type KernelCmd struct {
@@ -352,7 +353,7 @@ func generateBaseDockerImage(registry string, commands []config.DockerCommand,
return
}
if exists(dockerPath) && string(rawOutput) != "" {
if fs.PathExists(dockerPath) && string(rawOutput) != "" {
log.Info().Msgf("Base image for %s:%s found",
sk.DistroType.String(), sk.DistroRelease)
if !forceUpdate {
@@ -650,7 +651,7 @@ func genRootfsImage(d containerImageInfo, download bool) (rootfs string, err err
os.MkdirAll(imagesPath, os.ModePerm)
rootfs = imagesPath + imageFile
if !exists(rootfs) {
if !fs.PathExists(rootfs) {
if download {
log.Info().Msgf("%v not available, start download", imageFile)
err = downloadImage(imagesPath, imageFile)