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"
|
||||
|
||||
kcfgPathFlag := app.Flag("kernels", "Path to kernels config")
|
||||
kcfgPathEnv := kcfgPathFlag.Envar("OUT_OF_TREE_KCFG")
|
||||
kcfgPath := kcfgPathEnv.Default(defaultKcfgPath).ExistingFile()
|
||||
kcfgPathFlag := app.Flag("kernels", "Path to main kernels config")
|
||||
kcfgPath := kcfgPathFlag.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")
|
||||
qemuTimeout := qemuTimeoutFlag.Default("1m").Duration()
|
||||
@ -89,6 +93,15 @@ func main() {
|
||||
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:])) {
|
||||
case pewCommand.FullCommand():
|
||||
err = pewHandler(kcfg, *path, *pewKernel, *pewBinary,
|
||||
|
Loading…
Reference in New Issue
Block a user