mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-09-04 16:50:28 +00:00
🌱 pass by the container image used in run.sh (#8)
Signed-off-by: mudler <mudler@c3os.io>
This commit is contained in:
committed by
GitHub
parent
5188423783
commit
7a148fe5bb
@@ -177,7 +177,10 @@ func (l *ContainerRunner) Install(config *BundleConfig) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We want to expect tempDir as context
|
// We want to expect tempDir as context
|
||||||
out, err = utils.SHInDir(fmt.Sprintf("CONTAINERDIR=%s %s/run.sh", tempDir, tempDir), tempDir)
|
out, err = utils.SHInDir(
|
||||||
|
filepath.Join(tempDir, "run.sh"),
|
||||||
|
tempDir,
|
||||||
|
fmt.Sprintf("CONTAINERDIR=%s", tempDir), fmt.Sprintf("BUNDLE_TARGET=%s", target))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not execute container: %w - %s", err, out)
|
return fmt.Errorf("could not execute container: %w - %s", err, out)
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,11 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/denisbrodbeck/machineid"
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
|
"github.com/denisbrodbeck/machineid"
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SH(c string) (string, error) {
|
func SH(c string) (string, error) {
|
||||||
@@ -15,9 +16,9 @@ func SH(c string) (string, error) {
|
|||||||
return string(o), err
|
return string(o), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func SHInDir(c, dir string) (string, error) {
|
func SHInDir(c, dir string, envs ...string) (string, error) {
|
||||||
cmd := exec.Command("/bin/sh", "-c", c)
|
cmd := exec.Command("/bin/sh", "-c", c)
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = append(os.Environ(), envs...)
|
||||||
cmd.Dir = dir
|
cmd.Dir = dir
|
||||||
o, err := cmd.CombinedOutput()
|
o, err := cmd.CombinedOutput()
|
||||||
return string(o), err
|
return string(o), err
|
||||||
|
Reference in New Issue
Block a user