svn commit: r345400 - in head/libexec/rc: . rc.d
Hiroki Sato
hrs at FreeBSD.org
Sat Mar 23 04:00:17 UTC 2019
Cy Schubert <cy at FreeBSD.org> wrote
in <201903220130.x2M1Uq0p042374 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20190323/2b212d0c/attachment-0001.sig>
More information about the svn-src-all
mailing list