tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rc.d script style guide



In working on ups-nut I am noticing several things.  We don't have a
style guide for pkgsrc-provided rc.d scripts in doc/pkgsrc.

1) conditional /etc/rc.subr

This pattern is in both tor and nut.

  if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
  then
          load_rc_config $name
          run_rc_command "$1"
  else
          eval ${start_cmd}
  fi

Often this will start but not stop, from not-really-adequate code reading.

Is this:
  - for old NetBSD (and if so how old)
  - for non-NetBSD with the rc.subr package?  (But, on macOS, that
    installs /etc/rc.subr)
  - something else?

Should it instead just depend on rc.subr?  Let it be and people should
not expect rc.d scripts to run without rc.subr?

I am inclined to clean this up, and let it be.

2) Strange formatting with then on a new line (see above)

Is this:
  - just an odd style choice?
  - accomodating some ancient sh?
  - for a good reason I don't understand?
  - something else?

I am inclined to align style to base system rc.d scripts as I edit,
absent a good raeson.


Home | Main Index | Thread Index | Old Index