Index: security/crowdsec/Makefile =================================================================== --- security/crowdsec/Makefile +++ security/crowdsec/Makefile @@ -2,6 +2,7 @@ PORTNAME= crowdsec PORTVERSION= 1.0.9 +PORTREVISION= 1 DISTVERSIONPREFIX= v CATEGORIES= security Index: security/crowdsec/files/crowdsec.in =================================================================== --- security/crowdsec/files/crowdsec.in +++ security/crowdsec/files/crowdsec.in @@ -1,20 +1,19 @@ #!/bin/sh - +# # $FreeBSD$ # # PROVIDE: crowdsec -# REQUIRE: LOGIN DAEMON NETWORKING +# REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # crowdsec_enable (bool): Set it to YES to enable crowdsec agent. -# Default is "NO". +# Default is "NO" # crowdsec_config (str): Set the agent config path. -# Default is "%%PREFIX%%/etc/crowdsec/config.yaml". -# crowdsec_flags (str): Set the extra flags to run agent. -# Default is "" +# Default is "%%PREFIX%%/etc/crowdsec/config.yaml" +# crowdsec_flags (str): Set the extra flags to run agent. . /etc/rc.subr @@ -24,26 +23,23 @@ load_rc_config $name -: ${crowdsec_enable:="NO"} -: ${crowdsec_config:="%%PREFIX%%/etc/crowdsec/config.yaml"} -: ${crowdsec_flags:=""} - -pidfile=/var/run/${name}.pid -command="%%PREFIX%%/bin/${name}" -start_cmd="${name}_start" -configtest_cmd="${name}_configtest" +: ${crowdsec_enable:=NO} +: ${crowdsec_config:=%%PREFIX%%/etc/crowdsec/config.yaml} + +pidfile=/var/run/$name.pid +required_files="$crowdsec_config" +procname="%%PREFIX%%/bin/crowdsec" +command=/usr/sbin/daemon +command_args="-fp $pidfile -t '$desc' -- '$procname' -c '$crowdsec_config' $crowdsec_flags" +start_precmd=crowdsec_configtest +restart_precmd=crowdsec_configtest +configtest_cmd=crowdsec_configtest extra_commands="configtest reload" -crowdsec_start() -{ - /usr/sbin/daemon -f -p ${pidfile} -t "${desc}" \ - ${command} -c ${crowdsec_config} ${crowdsec_flags} -} - crowdsec_configtest() { echo "Performing sanity check on ${name} configuration." - eval ${command} -c ${crowdsec_config} -t + $procname -c "$crowdsec_config" -t } -run_rc_command "$1" +run_rc_command $1