Further improve the rc.d script example:
1. Since the example program is called doormand, update the references to doorman in the script and examples to match the name of the program, as it is typically done. 2. Fix the comments about the variables to avoid line wrap past 80 columns 3. Re-sort the variables (such as command, etc.) to be in the order that they are generally listed in the base scripts, and in rc(8). 4. Simplify the rcvar variable to be what `set rcvar` would return anyway
This commit is contained in:
parent
bf20e2fc8a
commit
a1b063a2ea
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=27064
1 changed files with 18 additions and 16 deletions
|
@ -5904,7 +5904,7 @@ USE_SDL+= mixer
|
|||
|
||||
<para>One or more rc scripts can be installed:</para>
|
||||
|
||||
<programlisting>USE_RC_SUBR= doorman.sh</programlisting>
|
||||
<programlisting>USE_RC_SUBR= doormand.sh</programlisting>
|
||||
|
||||
<para>Scripts must be placed in the <filename>files</filename>
|
||||
subdirectory and a <literal>.in</literal> suffix must be added to their
|
||||
|
@ -5933,29 +5933,31 @@ USE_SDL+= mixer
|
|||
|
||||
<programlisting>#!/bin/sh
|
||||
|
||||
# PROVIDE: doorman
|
||||
# PROVIDE: doormand
|
||||
# REQUIRE: LOGIN
|
||||
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf to enable doorman:
|
||||
# doorman_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable doorman
|
||||
# doorman_config (path): Set to "%%PREFIX%%/etc/doormand/doormand.cf" by default.
|
||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
||||
# to enable this service:
|
||||
#
|
||||
# doormand_enable (bool): Set to NO by default.
|
||||
# Set it to YES to enable doormand.
|
||||
# doormand_config (path): Set to %%PREFIX%%/etc/doormand/doormand.cf
|
||||
# by default.
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="doorman"
|
||||
rcvar=`set_rcvar`
|
||||
name="doormand"
|
||||
rcvar=${name}_enable
|
||||
|
||||
command=%%PREFIX%%/sbin/doormand
|
||||
command_args="-p $pidfile -f $doormand_config"
|
||||
pidfile=/var/run/doormand.pid
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${doorman_enable="NO"}
|
||||
: ${doorman_config="%%PREFIX%%/etc/doormand/doormand.cf"}
|
||||
|
||||
command=%%PREFIX%%/sbin/doormand
|
||||
pidfile=/var/run/doormand.pid
|
||||
command_args="-p $pidfile -f $doorman_config"
|
||||
: ${doormand_enable="NO"}
|
||||
: ${doormand_config="%%PREFIX%%/etc/doormand/doormand.cf"}
|
||||
|
||||
run_rc_command "$1"</programlisting>
|
||||
|
||||
|
@ -5965,7 +5967,7 @@ run_rc_command "$1"</programlisting>
|
|||
and the latter sets one if the variable is unset
|
||||
<emphasis>or</emphasis> null.
|
||||
A user might very well include something like
|
||||
<programlisting>doorman_flags=""</programlisting> in their
|
||||
<programlisting>doormand_flags=""</programlisting> in their
|
||||
<filename>rc.conf.local</filename> file, and a variable
|
||||
substitution using ":=" would inappropriately
|
||||
override the user's intention.</para>
|
||||
|
|
Loading…
Reference in a new issue