Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2018 05:52:55 +0000 (UTC)
From:      Roman Bogorodskiy <novel@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r485917 - in head/sysutils/cbsd: . files
Message-ID:  <201811260552.wAQ5qtAK053811@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811260552.wAQ5qtAK053811>