Bug 95708 - freebsd startup script for sec port
Summary: freebsd startup script for sec port
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-13 18:40 UTC by Jo Rhett
Modified: 2006-10-07 22:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jo Rhett 2006-04-13 18:40:18 UTC
This is a startup script for the 'sec' port. It uses rc.conf variables to start up a customizable number of sec instances.

Fix: 

#!/bin/sh
#
# Add the following lines to /etc/rc.conf to enable sec:
# sec_enable (bool):    Set to "NO" by default.
#                          Set it to "YES" to enable sec.
#
# These flags control the first (or only) instance of sec.
# sec_flags (str):      Set to "" by default.
# sec_configfile (str): Set to "/usr/local/etc/sec.conf" by default.
#
# To handle multiple instances you can also define
# sec_instances="main auth" (list): define the instances (any string) which should be started/stopped
# sec_instance_main_flags (str): define the invocation options for the first instance
# sec_instance_main_configfile (str): define the config file for the first instance
# sec_instance_auth_flags (str): define the invocation options for the second instance
# sec_instance_auth_configfile (str): define the config file for the second instance
#   ...etc
#

. /etc/rc.subr

name="sec"
rcvar=`set_rcvar`

command="/usr/local/bin/sec"
command_args="-detach"
command_interpreter="/usr/bin/perl"
extra_commands="reload"
pidfile="/var/run/sec.pid"

start_precmd="sec_checkconfig"
reload_precmd="sec_checkconfig"
restart_precmd="sec_checkconfig"
sig_reload=HUP

load_rc_config "${name}"
[ -z "${sec_enable}" ]       && sec_enable="NO"
[ -z "${sec_flags}" ]        && sec_flags="-log=/var/log/sec.log"
[ -z "${sec_configfile}" ]   && sec_configfile="/usr/local/etc/sec.conf"
[ -z "${sec_instances}" ]    && sec_instances=""

sec_checkconfig() {
  if [ -z $instance ]
  then
        echo -n "Performing sanity check of sec configuration: "
  else
        echo -n "Performing sanity check of sec_${instance} configuration: "
  fi
  ${command} -debug=1 -testonly -conf=${sec_configfile} 2>&1 >/dev/null
  if [ $? != 0 ]; then
    echo "FAILED"
    ${command} -testonly -conf=${sec_configfile}
    return 1
  else
    echo "OK"
  fi
}

required_files="${sec_configfile}"
sec_flags="-conf=${sec_configfile} -pid=${pidfile} ${sec_flags}"

run_rc_command "$1"

# Are we handling multiple instance mode?
if [ ! -z "${sec_instances}" ]
then
        for instance in $sec_instances
        do
                # Iterate through all instances
                name="sec_${instance}"
                pidfile="/var/run/sec_${instance}.pid"
                eval required_files=\$sec_${instance}_configfile
                eval sec_${instance}_flags="\"-conf=\$sec_${instance}_configfile -pid=\$pidfile \$sec_${instance}_flags\""

                run_rc_command "$1"
        done
fi
Comment 1 Edwin Groothuis freebsd_committer 2006-04-13 23:49:17 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Nicolas Jombart 2006-04-15 10:36:23 UTC
On Thu, Apr 13, 2006 at 10:49:13PM +0000, Edwin Groothuis wrote:
> Maintainer of sysutils/sec,
> 
> Please note that PR ports/95708 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.

I can approve the fact that sysutils/sec needs a startup script, thanks
for that, but maybe submitter should use USE_RC_SUBR macros...

-- 
Nicolas
Comment 3 Jo Rhett 2006-05-04 21:06:30 UTC
First of all, why didn't Nicholas respond to me instead of Edwin?

Second, the script does use rc macros.  Is he looking at the same bug?

-- 
Jo Rhett
senior geek
Silicon Valley Colocation
Comment 4 Sam Lawrance 2006-05-05 00:56:01 UTC
On 04/05/2006, at 8:10 PM, Jo Rhett wrote:
>
> From: Jo Rhett <jrhett@svcolo.com>
> To: bug-followup@FreeBSD.org
> Cc:
> Subject: Re: ports/95708: freebsd startup script for sec port
> Date: Thu, 4 May 2006 13:06:30 -0700
>
>  First of all, why didn't Nicholas respond to me instead of Edwin?

It was Edwin's script that asked for the approval.  By replying to  
that message, you get a copy and the bug report gets one for the record.

>  Second, the script does use rc macros.  Is he looking at the same  
> bug?

I think what the maintainer would like is a complete patch to also  
add USE_RC_SUBR to the makefile.

The rc script should make use of use SUB_LIST expansions.  For  
example, instead of hard coding /usr/local/bin/sec, you should use %% 
PREFIX%%/bin/sec.  %%RC_SUBR%% is another important one to use.  See  
the link that Ion-Mihai sent to you for more information about this.
Comment 5 Jo Rhett 2006-05-05 01:28:12 UTC
On May 4, 2006, at 4:56 PM, Sam Lawrance wrote:
> It was Edwin's script that asked for the approval.  By replying to  
> that message, you get a copy and the bug report gets one for the  
> record.

I never got that copy, which is why I was objecting.

>>  Second, the script does use rc macros.  Is he looking at the same  
>> bug?
>
> I think what the maintainer would like is a complete patch to also  
> add USE_RC_SUBR to the makefile.
>
> The rc script should make use of use SUB_LIST expansions.  For  
> example, instead of hard coding /usr/local/bin/sec, you should use % 
> %PREFIX%%/bin/sec.  %%RC_SUBR%% is another important one to use.   
> See the link that Ion-Mihai sent to you for more information about  
> this.

These are fairly simple changes.  I sent something that worked so  
that he could test it.  I don't assume this stuff would be accepted  
unchanged.

I'm highly amused that I would be asked to make some changes, when  
the request for said changes requires more typing than making the  
changes.  This is what, 41 characters different?

-- 
Jo Rhett
senior geek
Silicon Valley Colocation
Comment 6 Sam Lawrance 2006-05-05 03:19:39 UTC
On 05/05/2006, at 10:28 AM, Jo Rhett wrote:

> On May 4, 2006, at 4:56 PM, Sam Lawrance wrote:
>> It was Edwin's script that asked for the approval.  By replying to  
>> that message, you get a copy and the bug report gets one for the  
>> record.
>
> I never got that copy, which is why I was objecting.

Followups to the PR are sent automatically by GNATS, it's possible  
something went awry.

>>>  Second, the script does use rc macros.  Is he looking at the  
>>> same bug?
>>
>> I think what the maintainer would like is a complete patch to also  
>> add USE_RC_SUBR to the makefile.
>>
>> The rc script should make use of use SUB_LIST expansions.  For  
>> example, instead of hard coding /usr/local/bin/sec, you should use  
>> %%PREFIX%%/bin/sec.  %%RC_SUBR%% is another important one to use.   
>> See the link that Ion-Mihai sent to you for more information about  
>> this.
>
> These are fairly simple changes.  I sent something that worked so  
> that he could test it.  I don't assume this stuff would be accepted  
> unchanged.
>
> I'm highly amused that I would be asked to make some changes, when  
> the request for said changes requires more typing than making the  
> changes.  This is what, 41 characters different?

By sending an updated patch, the maintainer can test and approve it,  
and a committer can then come along and grab the same patch and  
commit it.  It might seem inconvenient, but like many processes the  
earlier you get it right, the higher the quality of the end product -  
so that's what we like to encourage.
Comment 7 Jo Rhett 2006-05-05 03:55:08 UTC
> On 05/05/2006, at 10:28 AM, Jo Rhett wrote:
>> I'm highly amused that I would be asked to make some changes, when  
>> the request for said changes requires more typing than making the  
>> changes.  This is what, 41 characters different?

> On May 4, 2006, at 7:19 PM, Sam Lawrance wrote:
> By sending an updated patch, the maintainer can test and approve  
> it, and a committer can then come along and grab the same patch and  
> commit it.  It might seem inconvenient, but like many processes the  
> earlier you get it right, the higher the quality of the end product  
> - so that's what we like to encourage.

Not inconvenient -- I'm going to do this as soon as I can get away  
from my day job commitments.  I was just amused.  I'm often amused by  
how many people will send e-mails back and forth that take more time  
than fixing the problem ;-)

-- 
Jo Rhett
senior geek
Silicon Valley Colocation
Comment 8 dfilter service freebsd_committer 2006-10-07 22:31:04 UTC
pav         2006-10-07 21:30:59 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/sec         Makefile 
  Added files:
    sysutils/sec/files   sec.in 
  Log:
  - Provide rc script
  
  PR:             ports/95708
  Submitted by:   Jo Rhett <jrhett@svcolo.com>
  Approved by:    Nicolas Jombart <ecu@ipv42.net> (maintainer)
  
  Revision  Changes    Path
  1.12      +4 -0      ports/sysutils/sec/Makefile
  1.1       +77 -0     ports/sysutils/sec/files/sec.in (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Pav Lucistnik freebsd_committer 2006-10-07 22:31:10 UTC
State Changed
From-To: feedback->closed

Committed, thanks!