mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-19 00:37:03 +00:00
* 🎨 Split off cli into separate binaries This commit splits off the cli into 3 binaries: - agent - cli - provider The provider now is a separate component that can be tested by itself and have its own lifecycle. This paves the way to a ligher c3os variant, HA support and other features that can be provided on runtime. This is working, but still there are low hanging fruit to care about. Fixes #14 * 🤖 Add provider bin to releases * ⚙️ Handle signals * ⚙️ Reduce buildsize footprint * 🎨 Scan for providers also in /system/providers * 🤖 Run goreleaser * 🎨 Refactoring
34 lines
595 B
Go
34 lines
595 B
Go
package utils
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"os/exec"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
func SH(c string) (string, error) {
|
|
o, err := exec.Command("/bin/sh", "-c", c).CombinedOutput()
|
|
return string(o), err
|
|
}
|
|
|
|
func WriteEnv(envFile string, config map[string]string) error {
|
|
content, _ := ioutil.ReadFile(envFile)
|
|
env, _ := godotenv.Unmarshal(string(content))
|
|
|
|
for key, val := range config {
|
|
env[key] = val
|
|
}
|
|
|
|
return godotenv.Write(env, envFile)
|
|
}
|
|
|
|
func Shell() *exec.Cmd {
|
|
cmd := exec.Command("/bin/sh")
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
cmd.Stdin = os.Stdin
|
|
return cmd
|
|
}
|