How to override start_precmd of existing rc.d script

  • Thread starter Thread starter Deleted member 65953
  • Start date Start date
  • Tags Tags
    rc.d
D

Deleted member 65953

Guest
How should I override the start_precmd of an existing rc.d script? If the rc.d script contains load_rc_config ${name} towards the end of the script (e.g. right before run_rc_command "$1"), it would be a simple matter of creating a file /etc/rc.conf.d/myexample to override the start_precmd of the corresponding /usr/local/etc/rc.d/myexample script. However, there are many rc.d scripts that place load_rc_config ${name} near the beginning of the script rather than towards the end, which means that I cannot use a /etc/rc.conf.d/ file to override variables in such rc.d scripts. For such rc.d scripts, are there other methods to override the start_precmd?

Here is an example of a "problematic" rc.d script from graphics/sane-backends that I am unable to override using the /etc/rc.conf.d/ method: https://cgit.freebsd.org/ports/tree/graphics/sane-backends/files/saned.in?h=2023Q3#n15
 
Change the existing script.

Or copy the script to some place like /etc/local/rc.d, alter it to give it a new name, modifying key variable names replacing the old variable name prefix with some new one. Disable the old script and enable the new in rc.conf.

These are a couple of ways to tackle this problem.
 
Back
Top