Red Hat Bugzilla – Bug 105372
RFE: Add /etc/inittab.d/ for improved modularity
Last modified: 2014-03-16 22:38:58 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703
Description of problem:
The attached patch adds support to SysVinit for optionally splitting all or part
of /etc/inittab into files in /etc/inittab.d. It accomplishes for supervised
services what /etc/init.d/ provides for unsupervised services. I have submitted
it upstream to Miquel van Smoorenburg <email@example.com>, but have not heard
back from him yet. I'm posting it here as an RFE to solicit feedback.
The patch currently uses readdir(3), which does not return the file names in
lexicographic order. It would be trivial to use scandir(3) to sort the file
list, but I have not done so, for two reasons: (1) increased memory usage, and
(2) scandir is a non-POSIX interface. Is order important?
I chose to ignore hidden files and files ending in '~'; this is fairly common
for other tools that include files from a directory, such as cron or logrotate.
Any comments are welcome; I will be happy to rework it to
your liking, if you are inclined to add this functionality.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Packages that wish to have their daemons supervised by init need to edit
/etc/inittab on [un]install. The same is true for dynamically added terminal
devices, e.g., "mgetty ttyACM0".
Created attachment 94717 [details]
Add support for /etc/inittab.d/
I'm running this patch on my laptop with all mingetty services in
/etc/inittab.d/tty*. Adding and removing files and invoking "telinit q" works
as expected. Reading a directory instead of a single file introduces races, but
they seem no worse than similar races elsewhere.
Created attachment 94719 [details]
Add missing continue statement to stat() error path
Deferring; I'm not quite certain how often use cases for this would
come up from a packaging standpoint that would require a .d directory
(as opposed to a local use standpoint, where editing inittab is simpler.)