Now use two separate config for autogenerated and user-defined kernels
This commit is contained in:
parent
7707f75a02
commit
72aef7545a
19
main.go
19
main.go
@ -33,9 +33,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
defaultKcfgPath := usr.HomeDir + "/.out-of-tree/kernels.toml"
|
defaultKcfgPath := usr.HomeDir + "/.out-of-tree/kernels.toml"
|
||||||
|
|
||||||
kcfgPathFlag := app.Flag("kernels", "Path to kernels config")
|
kcfgPathFlag := app.Flag("kernels", "Path to main kernels config")
|
||||||
kcfgPathEnv := kcfgPathFlag.Envar("OUT_OF_TREE_KCFG")
|
kcfgPath := kcfgPathFlag.Default(defaultKcfgPath).ExistingFile()
|
||||||
kcfgPath := kcfgPathEnv.Default(defaultKcfgPath).ExistingFile()
|
|
||||||
|
defaultUserKcfgPath := usr.HomeDir + "/.out-of-tree/kernels.user.toml"
|
||||||
|
userKcfgPathFlag := app.Flag("user-kernels", "User kernels config")
|
||||||
|
userKcfgPathEnv := userKcfgPathFlag.Envar("OUT_OF_TREE_KCFG")
|
||||||
|
userKcfgPath := userKcfgPathEnv.Default(defaultUserKcfgPath).String()
|
||||||
|
|
||||||
qemuTimeoutFlag := app.Flag("qemu-timeout", "Timeout for qemu")
|
qemuTimeoutFlag := app.Flag("qemu-timeout", "Timeout for qemu")
|
||||||
qemuTimeout := qemuTimeoutFlag.Default("1m").Duration()
|
qemuTimeout := qemuTimeoutFlag.Default("1m").Duration()
|
||||||
@ -89,6 +93,15 @@ func main() {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if exists(*userKcfgPath) {
|
||||||
|
userKcfg, err := config.ReadKernelConfig(*userKcfgPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
kcfg.Kernels = append(kcfg.Kernels, userKcfg.Kernels...)
|
||||||
|
}
|
||||||
|
|
||||||
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
|
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
|
||||||
case pewCommand.FullCommand():
|
case pewCommand.FullCommand():
|
||||||
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
||||||
|
Loading…
Reference in New Issue
Block a user