aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2024-05-18 05:15:28 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2024-05-18 05:17:59 +0000
commit9ae1e22950e7c9114e6d0946855de4f6992ac3b4 (patch)
tree8fa395a917055fd463820c7a14ec499bb0e555ec /net-mgmt
parent492c3dfbea4af8b452381e1c445b7cc251ff4e97 (diff)
downloadports-9ae1e22950e7c9114e6d0946855de4f6992ac3b4.tar.gz
ports-9ae1e22950e7c9114e6d0946855de4f6992ac3b4.zip
net-mgmt/metronome: Add rc.d script
PR: 239819 Reported by: freebsd_at_dns_d_company, tremere_at_cainites_d_net
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/metronome/Makefile18
-rw-r--r--net-mgmt/metronome/files/metronome.in35
-rw-r--r--net-mgmt/metronome/pkg-plist1
3 files changed, 52 insertions, 2 deletions
diff --git a/net-mgmt/metronome/Makefile b/net-mgmt/metronome/Makefile
index 0d4370239897..f42f4d0bfad8 100644
--- a/net-mgmt/metronome/Makefile
+++ b/net-mgmt/metronome/Makefile
@@ -1,6 +1,6 @@
PORTNAME= metronome
DISTVERSION= 0.9.0
-PORTREVISION= 20
+PORTREVISION= 21
CATEGORIES= net-mgmt dns
MAINTAINER= krion@FreeBSD.org
@@ -13,21 +13,35 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libboost_thread.so:devel/boost-libs
USES= autoreconf:build compiler:c++11-lang eigen:3 libtool:build \
- localbase:ldflags pathfix pkgconfig
+ localbase:ldflags pathfix pkgconfig
USE_CXXSTD= c++14
USE_GITHUB= yes
GH_ACCOUNT= ahupowerdns
USE_LDCONFIG= yes
+USE_RC_SUBR= metronome
GNU_CONFIGURE= yes
INSTALL_TARGET= install-strip
SUB_FILES= pkg-message
+SUB_LIST+= METRONOME_DBDIR=${METRONOME_DBDIR} \
+ METRONOME_USER=${METRONOME_USER}
+METRONOME_USER?= _metronome
+USERS= ${METRONOME_USER}
+GROUPS= ${METRONOME_USER}
+
+PLIST_SUB+= METRONOME_DBDIR=${METRONOME_DBDIR} \
+ METRONOME_USER=${METRONOME_USER}
OPTIONS_DEFINE= DOCS
+METRONOME_DBDIR?= /var/db/metronome
+
pre-configure:
(cd ${WRKSRC}; ./bootstrap )
+post-install:
+ ${MKDIR} ${STAGEDIR}${METRONOME_DBDIR}
+
.include <bsd.port.mk>
diff --git a/net-mgmt/metronome/files/metronome.in b/net-mgmt/metronome/files/metronome.in
new file mode 100644
index 000000000000..d402442033a7
--- /dev/null
+++ b/net-mgmt/metronome/files/metronome.in
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# PROVIDE: metronome
+# REQUIRE: DAEMON SERVERS
+# KEYWORD: shutdown
+
+#
+# Add the following line to /etc/rc.conf to enable metronome:
+#
+# metronome_enable="YES"
+#
+# The next lines are optional since they have defaults
+#
+# metronome_carbonaddress="<set as needed>"
+# metronome_wsaddress="<set as needed>"
+# metronome_statsdir="<set as needed>"
+#
+
+. /etc/rc.subr
+
+name=metronome
+rcvar=${name}_enable
+
+load_rc_config ${name}
+: ${metronome_enable:=NO}
+: ${metronome_carbonaddress:=127.0.0.1:2003}
+: ${metronome_wsaddress:=127.0.0.1:8000}
+: ${metronome_statsdir:=%%METRONOME_DBDIR%%}
+
+pidfile=/var/run/${name}.pid
+actual_command="%%PREFIX%%/bin/${name} --daemon 0 --carbon-address ${metronome_carbonaddress} --webserver-address ${metronome_wsaddress} --stats-directory ${metronome_statsdir}"
+command=/usr/sbin/daemon
+command_args="-c -f -r -u %%METRONOME_USER%% -P ${pidfile} -- ${actual_command}"
+
+run_rc_command "$1"
diff --git a/net-mgmt/metronome/pkg-plist b/net-mgmt/metronome/pkg-plist
index 23b0c9115efc..b854edfbdb9b 100644
--- a/net-mgmt/metronome/pkg-plist
+++ b/net-mgmt/metronome/pkg-plist
@@ -18,3 +18,4 @@ bin/msubmit
%%DATADIR%%/html/legend.css
%%DATADIR%%/html/lines.css
%%DATADIR%%/html/local.js
+@dir(%%METRONOME_USER%%, %%METRONOME_USER%%, ) %%METRONOME_DBDIR%%