fix: use the default config dirs provider
This commit is contained in:
@ -12,7 +12,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -326,16 +326,10 @@ func findInitrdFile(files []os.FileInfo, kname string) (name string, err error)
|
||||
}
|
||||
|
||||
func GenRootfsImage(d container.Image, download bool) (rootfs string, err error) {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
imagesPath := config.Dir("images")
|
||||
imageFile := d.Name + ".img"
|
||||
|
||||
imagesPath := usr.HomeDir + "/.out-of-tree/images/"
|
||||
os.MkdirAll(imagesPath, os.ModePerm)
|
||||
|
||||
rootfs = imagesPath + imageFile
|
||||
rootfs = filepath.Join(imagesPath, imageFile)
|
||||
if !fs.PathExists(rootfs) {
|
||||
if download {
|
||||
log.Info().Msgf("%v not available, start download", imageFile)
|
||||
@ -395,13 +389,7 @@ func UpdateKernelsCfg(host, download bool) (err error) {
|
||||
|
||||
buf = append([]byte("# Autogenerated\n# DO NOT EDIT\n\n"), buf...)
|
||||
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO move all cfg path values to one provider
|
||||
kernelsCfgPath := usr.HomeDir + "/.out-of-tree/kernels.toml"
|
||||
kernelsCfgPath := config.File("kernels.toml")
|
||||
err = ioutil.WriteFile(kernelsCfgPath, buf, 0644)
|
||||
if err != nil {
|
||||
return
|
||||
|
Reference in New Issue
Block a user