From owner-svn-ports-head@freebsd.org Mon Nov 26 05:52:57 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64723114E6B0; Mon, 26 Nov 2018 05:52:57 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 082D488105; Mon, 26 Nov 2018 05:52:57 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBE87279B6; Mon, 26 Nov 2018 05:52:56 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wAQ5quGP053816; Mon, 26 Nov 2018 05:52:56 GMT (envelope-from novel@FreeBSD.org) Received: (from novel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAQ5qtAK053811; Mon, 26 Nov 2018 05:52:55 GMT (envelope-from novel@FreeBSD.org) Message-Id: <201811260552.wAQ5qtAK053811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: novel set sender to novel@FreeBSD.org using -f From: Roman Bogorodskiy Date: Mon, 26 Nov 2018 05:52:55 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r485917 - in head/sysutils/cbsd: . files X-SVN-Group: ports-head X-SVN-Commit-Author: novel X-SVN-Commit-Paths: in head/sysutils/cbsd: . files X-SVN-Commit-Revision: 485917 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 082D488105 X-Spamd-Result: default: False [1.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.68)[0.678,0]; NEURAL_SPAM_SHORT(0.52)[0.516,0]; NEURAL_SPAM_MEDIUM(0.68)[0.676,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2018 05:52:57 -0000 Author: novel Date: Mon Nov 26 05:52:55 2018 New Revision: 485917 URL: https://svnweb.freebsd.org/changeset/ports/485917 Log: sysutils/cbsd: update to 12.0.2 PR: 233476 Submitted by: maintainer Added: head/sysutils/cbsd/files/cbsd-statsd-bhyve.in (contents, props changed) head/sysutils/cbsd/files/cbsd-statsd-hoster.in (contents, props changed) head/sysutils/cbsd/files/cbsd-statsd-jail.in (contents, props changed) Modified: head/sysutils/cbsd/Makefile head/sysutils/cbsd/distinfo head/sysutils/cbsd/files/cbsdd.in Modified: head/sysutils/cbsd/Makefile ============================================================================== --- head/sysutils/cbsd/Makefile Mon Nov 26 05:43:00 2018 (r485916) +++ head/sysutils/cbsd/Makefile Mon Nov 26 05:52:55 2018 (r485917) @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= cbsd -DISTVERSION= 12.0.1 +DISTVERSION= 12.0.2 CATEGORIES= sysutils MAINTAINER= olevole@olevole.ru @@ -19,7 +19,7 @@ LIB_DEPENDS= libssh2.so:security/libssh2 \ USES= libedit pkgconfig USE_GITHUB= yes -USE_RC_SUBR= cbsdd cbsdrsyncd +USE_RC_SUBR= cbsdd cbsdrsyncd cbsd-statsd-bhyve cbsd-statsd-hoster cbsd-statsd-jail SUB_FILES= pkg-message pkg-deinstall Modified: head/sysutils/cbsd/distinfo ============================================================================== --- head/sysutils/cbsd/distinfo Mon Nov 26 05:43:00 2018 (r485916) +++ head/sysutils/cbsd/distinfo Mon Nov 26 05:52:55 2018 (r485917) @@ -1,3 +1,3 @@ -TIMESTAMP = 1542455908 -SHA256 (cbsd-cbsd-12.0.1_GH0.tar.gz) = 6de79c8b76bda4c4aaa19c9641ef7e9e3c3e49b98e17db060b83bce31cd26c72 -SIZE (cbsd-cbsd-12.0.1_GH0.tar.gz) = 5749969 +TIMESTAMP = 1543086929 +SHA256 (cbsd-cbsd-12.0.2_GH0.tar.gz) = 2e1703e366ad8070d19beb7d3b77304901e0d1ca52b8395290102fdcf6e6a009 +SIZE (cbsd-cbsd-12.0.2_GH0.tar.gz) = 5764315 Added: head/sysutils/cbsd/files/cbsd-statsd-bhyve.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cbsd/files/cbsd-statsd-bhyve.in Mon Nov 26 05:52:55 2018 (r485917) @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_bhyve +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_bhyve_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_bhyve +rcvar=cbsd_statsd_bhyve_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_bhyve_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-bhyve-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-bhyve-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_bhyve_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-bhyve: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-bhyve: RACCT not enabled" + + readconf racct-bhyve-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-bhyve-statsd ${args} +} + +cbsd_statsd_bhyve_restart() +{ + cbsd_statsd_bhyve_stop + cbsd_statsd_bhyve_start +} + +run_rc_command "$1" Added: head/sysutils/cbsd/files/cbsd-statsd-hoster.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cbsd/files/cbsd-statsd-hoster.in Mon Nov 26 05:52:55 2018 (r485917) @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_hoster +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_hoster_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_hoster +rcvar=cbsd_statsd_hoster_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_hoster_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-hoster-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-hoster-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_hoster_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-hoster: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-hoster: RACCT not enabled" + + readconf racct-hoster-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-hoster-statsd ${args} +} + +cbsd_statsd_hoster_restart() +{ + cbsd_statsd_hoster_stop + cbsd_statsd_hoster_start +} + +run_rc_command "$1" Added: head/sysutils/cbsd/files/cbsd-statsd-jail.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cbsd/files/cbsd-statsd-jail.in Mon Nov 26 05:52:55 2018 (r485917) @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_jail +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_jail_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_jail +rcvar=cbsd_statsd_jail_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_jail_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-jail-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-jail-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_jail_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-jail: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-jail: RACCT not enabled" + + readconf racct-jail-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-jail-statsd ${args} +} + +cbsd_statsd_jail_restart() +{ + cbsd_statsd_jail_stop + cbsd_statsd_jail_start +} + +run_rc_command "$1" Modified: head/sysutils/cbsd/files/cbsdd.in ============================================================================== --- head/sysutils/cbsd/files/cbsdd.in Mon Nov 26 05:43:00 2018 (r485916) +++ head/sysutils/cbsd/files/cbsdd.in Mon Nov 26 05:52:55 2018 (r485917) @@ -49,8 +49,8 @@ start_precmd=${name}_prestart stop_precmd=${name}_prestop stop_cmd=${name}_stop status_cmd="${name}_status" -reload_cmd=${name}_reload -extra_commands="reload" +restart_cmd=${name}_restart +extra_commands="restart" command="${toolsdir}/cbsdd" pidfile="/var/run/$name.pid" @@ -58,7 +58,6 @@ command_args="&" cbsdd_prestart() { %%PREFIX%%/bin/cbsd task mode=flushall > /dev/null 2>&1 - . ${distdir}/initenv.subr . ${inventory} @@ -67,7 +66,7 @@ cbsdd_prestart() { update_netinfo env sqlcolnames="1" ${miscdir}/sqlcli ${dbdir}/local.sqlite "SELECT * FROM local" > ${inventory} ${miscdir}/sqlcli ${dbdir}/local.sqlite "UPDATE jails SET status='0' WHERE status='3'" - [ -n "$nat_enable" ] && %%PREFIX%%/bin/cbsd naton + [ -n "${nat_enable}" ] && %%PREFIX%%/bin/cbsd naton /usr/sbin/daemon -f ${rcddir}/jails-astart start } @@ -80,15 +79,21 @@ cbsdd_prestop() cbsdd_stop() { if [ -f "${pidfile}" ]; then - kill -9 $( /bin/cat ${pidfile} ) - /bin/rm -f ${pidfile} + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + if [ ${_err} -eq 0 ]; then + kill -9 ${pids} && /bin/rm -f ${pidfile} + else + echo "pgrep: ${pids}" + return ${_err} + fi fi } -cbsdd_reload() +cbsdd_restart() { if [ -f "${pidfile}" ]; then - kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1 + pkill -9 -f ${pidfile} > /dev/null 2>&1 /bin/rm -f ${pidfile} fi run_rc_command "start" @@ -97,9 +102,17 @@ cbsdd_reload() cbsdd_status() { + local _err + if [ -f "${pidfile}" ]; then - pids=$( /bin/cat ${pidfile} ) - echo "${name} is running as pid ${pids}." + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + if [ ${_err} -eq 0 ]; then + echo "${name} is running as pid ${pids}." + else + echo "pgrep: ${pids}" + return ${_err} + fi else echo "${name} is not running." return 1