1
0

Implements check for required commands

This commit is contained in:
dump_stack() 2018-11-19 15:31:25 +00:00
parent cc3f536c62
commit 119c2eea58

View File

@ -7,6 +7,7 @@ package main
import ( import (
"log" "log"
"os" "os"
"os/exec"
"os/user" "os/user"
kingpin "gopkg.in/alecthomas/kingpin.v2" kingpin "gopkg.in/alecthomas/kingpin.v2"
@ -57,6 +58,14 @@ func main() {
kernelCommand := app.Command("kernel", "Manipulate kernels") kernelCommand := app.Command("kernel", "Manipulate kernels")
kernelListCommand := kernelCommand.Command("list", "List kernels") kernelListCommand := kernelCommand.Command("list", "List kernels")
// Check for required commands
for _, cmd := range []string{"timeout", "docker", "qemu"} {
_, err := exec.Command("which", cmd).CombinedOutput()
if err != nil {
log.Fatalln("Command not found:", cmd)
}
}
kingpin.MustParse(app.Parse(os.Args[1:])) kingpin.MustParse(app.Parse(os.Args[1:]))
kcfg, err := config.ReadKernelConfig(*kcfgPath) kcfg, err := config.ReadKernelConfig(*kcfgPath)