set configScanDir as package scoped var (#264)

set config.Install.env variables in environment

adding env to config to use across all stages

switch to config.Scan to read config
This commit is contained in:
Santhosh
2022-10-24 16:43:23 +05:30
committed by Itxaka
parent 0af13f655f
commit c7c68c222f
3 changed files with 21 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"os/exec"
"strings"
"syscall"
"time"
@@ -227,14 +226,8 @@ func RunInstall(options map[string]string) error {
c.Install.Reboot = true
}
for _, e := range c.Install.Env {
pair := strings.SplitN(e, "=", 2)
if len(pair) >= 2 {
os.Setenv(pair[0], pair[1])
}
}
envs := os.Environ()
env := append(c.Install.Env, c.Env...)
utils.SetEnv(env)
err := ioutil.WriteFile(f.Name(), []byte(cloudInit), os.ModePerm)
if err != nil {
@@ -246,7 +239,7 @@ func RunInstall(options map[string]string) error {
args = append(args, "-c", f.Name(), device)
cmd := exec.Command("elemental", args...)
cmd.Env = envs
cmd.Env = os.Environ()
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr