Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request, Allow additional directories included in config with include /etc/finit.d/*.conf #184

Open
hongkongkiwi opened this issue Aug 18, 2021 · 7 comments
Milestone

Comments

@hongkongkiwi
Copy link
Contributor

Hi there,

I would like to use the "include" feature to include another finit.d directory.

In my case, I would like to include both /etc/finit.d and /mnt/flash/etc/finit.d. Users are only allowed to edit files in /mnt/flash/etc/finit.d .

Could I propose that the "include" config also allows directories as well as files? or that we have a separate includedir config.

Can I also suggest that we have a '-' flag (like with env files), so we can allow it to include without this (and just ignore the file or directory being missing) or if '-' is passed then it will error if the include file or directory is not passed.

So it could be like this:

include -/mnt/flash/etc/finit.conf
include /mnt/flash/etc/finit-is-optional.conf
includedir -/mnt/flash/etc/finit.d
includedir /mnt/flash/etc/finit.d-dir-is-optional
@hongkongkiwi hongkongkiwi changed the title Allow directories in "include" config and allow optionally missing (like env) [Suggestion] Allow directories in "include" config and allow optionally missing config files (like env) Aug 19, 2021
@troglobit
Copy link
Owner

Like the env issue, this is a neat idea but a lot of work. Finit has a built-in dependency handler that monitors the configuration for changes so it's ready when a user issues reload, supporting more/any directory is a lot of work and nothing I've got time or interest to do myself.

What could be interesting is a glob like feature, like include /etc/finit.d/*.conf or something, but there is currently no plan for that either.

@troglobit troglobit added this to the FUTURE milestone Aug 19, 2021
@hongkongkiwi
Copy link
Contributor Author

I do have another request which may deserve it's own issue? I would love to just simply change the finit.d directory in the bootstrap config. Right now I have to hardcode during compilation. Is there any reason that it's done this way rather than a config?

The way I've worked around the issue now is to setup all system services in the bootstrap /etc/finit.conf file, then hardcoded finit to look in /mnt/flash/etc/finit.d

This works well, but I have two devices using the same core image, one has services on /mnt/flash/etc/finit.d and one is on /mnt/mmcblk0p1/etc/finit.d rather than having two compiled versions of finit, it would be nice to change this in a config file instead.

@hongkongkiwi hongkongkiwi changed the title [Suggestion] Allow directories in "include" config and allow optionally missing config files (like env) Feature request, Allow additional directories included in config with include /etc/finit.d/*.conf Aug 22, 2021
@troglobit
Copy link
Owner

The reason is simply because we have no use for it ourselves, and supporting all possible variant in every case is not sustainable.

@hongkongkiwi
Copy link
Contributor Author

Hi, just wanted to follow up on this.

Adding support for dynamic directories definitely sounds like a bit of work, with lots of cases where things could go wrong.

Could I modify the idea a little bit.... Is it possible to add support for adding some additional fixed RCSD directories as part of the compile stage?
.e.g. --with-rcsd="/etc/finit.d,/config/finit.d"

This way I could specify one or more additional directories to search. Then when your reloading or watching updated files, you have a fixed number of directories to watch and search that won't ever change.

@troglobit
Copy link
Owner

Either way, it's a lot of work and will not be in the upcoming v4.4 release. (I'm actually about to start the -rc phase.)

Have you considered setting up OverlayFS instead? Your /mnt/flash/etc could overlay /etc and you'd have an editable /etc without all this additional complexity.

Here's what I do in myLinux, notice the use of mount helpers (extra config option in BusyBox):

@hongkongkiwi
Copy link
Contributor Author

I didn't think of overlayfs, it could be a good option depending on CPU usage (we are quite limited in this regard). I'll look into it.

Thanks for the examples.

@troglobit
Copy link
Owner

We've used overlayfs on NXP i.MX27 (Armv5 no L2 cache), without any issues. Very quick to mount and gives the illusion of a regular system. Users love it.

Notice the last section of the mnt script. We have a small C program, called "factory" that can be used as login shell (for a factory/reset user/pass), shell tool for users in a given group, or a regular tool for the root user to touch a file on /mnt and trigger a reboot to erase any changes made to the device having left the factory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants