Date: Tue, 18 Aug 2026 06:58:41 -0700
From: Jason Thorpe <[email protected]>
Message-ID: <[email protected]>
| > On Aug 18, 2026, at 6:51â¯AM, Mouse <[email protected]> wrote:
| > If this really bothers someone, perhaps there could be a way for a
| > script to declare itself a barrier script? Perhaps something a la
| > make's .PHONY, perhaps a naming convention, perhaps something else.
|
| The number of barriers is tiny, and it doesnât seem like the right
| engineering trade-off to add more decoration support for them
I'd agree with that, but in any case, no more decoration support would be
needed - one could use the "naming convention" mouse suggested, the (purely)
barrier scripts (the ones in question, as distinct from things like fsck
which are both barriers, and do work) have names that are entirely upper case
and nothing else even has a single upper case character in their names, or
not anything I'm aware of.
But that wouldn't be the best way, as some new script could have an all
upper case name for other reasons, so, if one wanted to exclude them, the
sh code (or the equivalent in any other language) is better to detect them:
if [ -z "$(sed -n -e '/^$/d' -e '/^#/d' -e p -e q < "${SCRIPT}" )" ]
then
printf '%s is not needed\n' "${SCRIPT}"
fi
with the printf replaced by whatever code is needed to cause the
script to be ignored, perhaps just "continue", and SCRIPT is the name
of the script being considered.
That just finds files that contain nothing except empty lines and comments,
which (as they are all sh scripts) and as they contain no code, accomplish
nothing (when run, as distinct from used for ordering, which uses the comments).
This will skip any script which has been neutered by commenting everything out,
as well as the barrier scripts.
I think I agree that it isn't really worth the bother excluding the 6 of
them, but there would be a very small saving in doing so (in many of the
scripts, the real cost is parsing rc.subr not in anything else they do,
when they're not needed, and none of these barrier scripts do that.)
My only reservation about the proposed technique is in convincing myself
that there is absolutely no way that the caching method can ever fail to
fail to be used when something has been altered (even if, for example,
I were to use my "nmvi" script - which edits files without altering their
modification date - the files st_ctime does get changed however - to edit
rc.conf, and that it can always detect added and removed rc.d files.
And one question, how does any of this apply to shutting the system down,
and running the appropriate scripts (in reverse order) at shutdown time?
kre
ps: when I run the above in a "for SCRIPT in *; do >the above< ; done" loop,
it finds exactly the upper case named barrier scripts, and nothing else.