desultory / ugrd

A minimalistic initramfs generator, designed for FDE
GNU General Public License v2.0
31 stars 11 forks source link

kmod_autodetect in config.yoml is ignored #6

Closed evdenis closed 6 months ago

evdenis commented 6 months ago

It looks like default options from the command line overwrite config options:

kmod_autodetect_lspci = true
kmod_autodetect_lsmod = true

When we call:

$ ugrd
...
Importing argument 'kmod_autodetect_lspci' with value: False
Importing argument 'kmod_autodetect_lsmod' with value: False
...
desultory commented 6 months ago

It looks like default options from the command line overwrite config options:

kmod_autodetect_lspci = true
kmod_autodetect_lsmod = true

When we call:

$ ugrd
...
Importing argument 'kmod_autodetect_lspci' with value: False
Importing argument 'kmod_autodetect_lsmod' with value: False
...

Thanks for pointing this out, the command line options have been changed in a recent version and I think I missed this. I may just revert it to the old style, but this gets a bit tricky because the defaults for a lot of things from the "main" function are "False", and I can't just discard False values, because you should be able to toggle things off, and command line parameters should be the final determining factor. I think I may just make it check if the value isn't the default, and if it is, it will pass it to the generator.

evdenis commented 6 months ago

Is it possible to set command line variable to 'None' by default and set them to True or False only in case --lspci or --no-lspci is used? This way it will be possible to overwrite config values in case cli lspci != None.

desultory commented 6 months ago

Is it possible to set command line variable to 'None' by default and set them to True or False only in case --lspci or --no-lspci is used? This way it will be possible to overwrite config values in case cli lspci != None.

Maybe, I'm currently using argparser, and a bit of wrapping done here: https://github.com/desultory/zenlib/blob/main/src/zenlib/util/main_funcs.py

The tricky bit is the "no-" options. the result is that both args write to the same variable. It was designed so that you could use the no- option to quickly disable things that were enabled in your config, or the opposite.

I'm thinking I may need to create some map of defaults and make it not return kwargs if there is no deviation.

desultory commented 6 months ago

I've updated zenlib and ugrd to hopefully fix this, I tested and it seems to work.

evdenis commented 6 months ago

Thanks!