Page MenuHomeFreeBSD

rc.subr add Exists so we can find sed
ClosedPublic

Authored by sjg on Feb 11 2024, 1:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 31, 6:45 AM
Unknown Object (File)
Tue, May 14, 12:58 AM
Unknown Object (File)
Fri, May 10, 1:32 AM
Unknown Object (File)
Tue, May 7, 10:35 PM
Unknown Object (File)
Apr 27 2024, 7:31 AM
Unknown Object (File)
Apr 27 2024, 7:30 AM
Unknown Object (File)
Apr 27 2024, 7:30 AM
Unknown Object (File)
Apr 27 2024, 6:12 AM

Details

Summary

SED=Exists -x /usr/bin/sed /rescue/sed

avoids adding /rescure to $PATH, and allows use of sed
before /usr is mounted (if a separate filesystem).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sjg requested review of this revision.Feb 11 2024, 1:01 AM
sjg created this revision.

This looks good. It makes an extra effort to find sed.
I just wonder if it is possible to define SED=${SED:-$(Exists -x /usr/bin/sed /rescue/sed)} only once in rc.subr, maybe at the beginning?
ShellCheck usually recommends avoiding backticks (https://www.shellcheck.net/wiki/SC2006).

This looks good. It makes an extra effort to find sed.
I just wonder if it is possible to define SED=${SED:-$(Exists -x /usr/bin/sed /rescue/sed)} only once in rc.subr, maybe at the beginning?

we could but it is only needed if /usr isn't mounted which is checked by have basename
the extra SED=${SED:- in rc_trace is just incase that is called from local.rc.subr before we check for basename.

ShellCheck usually recommends avoiding backticks (https://www.shellcheck.net/wiki/SC2006).

old habits...

Use $() rather than backticks, and only look once.

This revision is now accepted and ready to land.Feb 12 2024, 4:04 AM
This revision was automatically updated to reflect the committed changes.