Cy Schubert <c...@freebsd.org> wrote
  in <201903220130.x2m1uq0p042...@repo.freebsd.org>:

cy> Author: cy
cy> Date: Fri Mar 22 01:30:51 2019
cy> New Revision: 345400
cy> URL: https://svnweb.freebsd.org/changeset/base/345400
cy>
cy> Log:
cy>   Add rc.d support for ippool(8).
cy>
cy>   I've been using ippool at my site for approximately two years. It's
cy>   about time this was committed.
cy>
cy>   PR:               218433
cy>   MFC after:        2 weeks

cy> Added: head/libexec/rc/rc.d/ippool
cy> 
==============================================================================
cy> --- /dev/null       00:00:00 1970   (empty, because file is newly added)
cy> +++ head/libexec/rc/rc.d/ippool     Fri Mar 22 01:30:51 2019        
(r345400)
cy> @@ -0,0 +1,40 @@
cy> +#!/bin/sh
cy> +#
cy> +# $FreeBSD$
cy> +#
cy> +
cy> +# PROVIDE: ippool
cy> +# REQUIRE: FILESYSTEMS
cy> +# BEFORE:  ipfilter
cy> +# KEYWORD: nojail
cy> +
cy> +. /etc/rc.subr
cy> +
cy> +name="ippool"
cy> +desc="user interface to the IPFilter pools"
cy> +rcvar="ippool_enable"
cy> +load_rc_config $name
cy> +start_cmd="ippool_start"
cy> +stop_cmd="${ippool_program} -F"
cy> +reload_cmd="ippool_reload"
cy> +extra_commands="reload"
cy> +required_files="${ippool_rules}"
cy> +required_modules="ipl:ipfilter"
cy> +
cy> +ippool_start()
cy> +{
cy> +   if [ -r "${ippool_rules}" ]; then
cy> +           echo "Loading IP Pools."
cy> +           ${ippool_program} -f ${ippool_rules} ${ippool_flags}
cy> +   fi

 This conditional is redundant.  $required_files will check
 readability of $ippool_rules.

 And if you want to add a flag, use of precmd is the right way like
 the following:

----
 start_precmd="ippool_start_precmd"

 ippool_start_precmd()
 {
        rc_flags="-f ${ippool_rules} ${rc_flags}"
 }
----

-- Hiroki

Attachment: pgpiD2KyVYp19.pgp
Description: PGP signature

Reply via email to