troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
634 stars 64 forks source link

Additional cond's via kernel cmdline #250

Closed troglobit closed 2 years ago

troglobit commented 2 years ago

Discussed in https://github.com/troglobit/finit/discussions/249

Originally posted by **hongkongkiwi** April 26, 2022 It would be neat if we could use the kernel cmdline mechanism to pass a custom condition to finit. This allows some very simple and flexible options to be set in the bootloader script. e.g. -- finit.cond=mycond1 finit.cond=mycond2 Then when the system starts it can react to a specific condition. It may make sense to make these something like instead of but the downside is then you couldn't clear them like a normal usr signal with initctl clear .... (but maybe that's fine, I can't think of a reason why you want to clear it to be honest, but just a thought. As a real life example, this could be useful for a mfgtest mode for the device, so the bootloader can set finit.cond=test_mode or finit.cond=user_mode and then specific services can start up in test mode which wouldn't normally start. Or perhaps a custom firmware update mode such as finit.cond=fw_update_mode which performs some specific firmware update steps and doesn't launch normal processes. P.S. The same behaviour can currently be done via a task, which then sets the usr signals, but it's nice if the extra step isn't needed since finit already reads it's input vars and in some cases you might not want normal services to start at all (e.g. if a firmware update mode). Alternatively a run could also work, but my preference is not to slow down system booting by holding up for a run script to complete (even if it's fast).