3 ms·
The reality is not quite as the article paints it. First of all, there was a system before Mewburn rc. FreeBSD had an /etc/rc.local.d/ mechanism for drop-in s
by JdeBP 6y ago
The reality is not quite as the article paints it.
First of all, there was a system before Mewburn rc. FreeBSD had an /etc/rc.local.d/ mechanism for drop-in scripts in the middle 1990s, added by Jordan Hubbard and Garrett Wollman.
* http://jdebp.uk./FGA/rc.local-is-history.html http://jdebp.uk./FGA/rc.local-is-history.html
Second, /etc/rc.conf is not the only service configuration file in FreeBSD's version of Mewburn rc. The primary configuration file is in fact /etc/defaults/rc.conf , and that file lists, in a variable, the name of other secondary configuration files, including /etc/rc.conf and /etc/rc.conf.local . On PC-BSD of old, and then TrueOS, it also named things like /etc/rc.conf.pcbsd for example.
% sysrc -f /etc/defaults/rc.conf rc_conf_files
rc_conf_files: /etc/rc.conf.pcbsd /etc/rc.conf /etc/rc.conf.local
%
Third, if you go back to Usenet of the 1980s, and indeed contemporary books about system administration, you'll find that the distinction between /etc/rc and /etc/rc.local was problematic and not what people tell you it is supposed to be. People then too thought that /etc/rc was for the operating system manufacturer, and /etc/rc.local was for the system administrator. But in practice operating system resellers ended up putting their stuff in /etc/rc.local making it also something that system administrators touched at their peril, lest they break operating system upgrades.
Fourth, the article says "You might even want to support a separate location for user-created services". That already exists. It's /usr/local/etc/rc.d/ . And to highlight the point about resellers invading "local" stuff, note that PC-BSD and TrueOS fill it with additional PC-BSD services like pcdm and pc-samba and the problem of "reseller"-provided add-ons being "local" continues to this day.
% sysrc -f /etc/defaults/rc.conf local_startup
local_startup: /usr/local/etc/rc.d /usr/pbi/rc.d
%
Fifth, systemd unit files are not scripts. This is one of their defining features, and one of the things widely touted about them, in fact. As the systemd developers will themselves tell you, and have, they are configuration files. Hence the systemd developers thinking that it was a mistake to provide an EnvironmentFile setting. systemd isn't dividing things up into "configuration files" and "code", as this article talks about. It has multiple sets of things all of which are configuration files.
* https://unix.stackexchange.com/a/419061/5132 https://unix.stackexchange.com/a/419061/5132
Sixth, the systemd search order for unit files isn't that simple, and has a history of being improperly documented. It searches 17 directories nowadays, including subdirectories of /usr/local .
* http://jdebp.uk./FGA/systemd-documentation-errata.html#MissingUsrLocalLibSystemd http://jdebp.uk./FGA/systemd-documentation-errata.html#Missi...
For completeness, note that Debian's 2014 improvements to van Smoorenburg rc put new things like init-d-script into /lib/init/ .
* https://manpages.debian.org/sid/sysvinit-utils/init-d-script.5.en.html https://manpages.debian.org/sid/sysvinit-utils/init-d-script...