1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

net-mgmt/mqtt2prometheus: Update to 0.1.7

While here add a rc.d script.
This commit is contained in:
Emmanuel Vadot 2024-11-15 08:24:48 +01:00
parent 612c485103
commit 7fa147cba3
3 changed files with 85 additions and 5 deletions

View File

@ -1,7 +1,6 @@
PORTNAME= mqtt2prometheus PORTNAME= mqtt2prometheus
DISTVERSIONPREFIX= v DISTVERSIONPREFIX= v
DISTVERSION= 0.1.6 DISTVERSION= 0.1.7
PORTREVISION= 22
CATEGORIES= net-mgmt CATEGORIES= net-mgmt
MAINTAINER= manu@FreeBSD.org MAINTAINER= manu@FreeBSD.org
@ -55,5 +54,6 @@ post-extract:
post-install: post-install:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/
${INSTALL_DATA} ${WRKSRC}/config.yaml.dist ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/ ${INSTALL_DATA} ${WRKSRC}/config.yaml.dist ${STAGEDIR}${PREFIX}/etc/mqtt2prometheus/
${INSTALL_SCRIPT} ${FILESDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d
.include <bsd.port.mk> .include <bsd.port.mk>

View File

@ -1,6 +1,6 @@
TIMESTAMP = 1679877009 TIMESTAMP = 1731654699
SHA256 (hikhvar-mqtt2prometheus-v0.1.6_GH0.tar.gz) = 61b046469b76411641d4fcb4d56ac29b4e86b4374111da60b988de91267df848 SHA256 (hikhvar-mqtt2prometheus-v0.1.7_GH0.tar.gz) = 77e59fc04a522bcf08d8380a75021f5cda008067e50435dbe24b4c85155c20fc
SIZE (hikhvar-mqtt2prometheus-v0.1.6_GH0.tar.gz) = 59608 SIZE (hikhvar-mqtt2prometheus-v0.1.7_GH0.tar.gz) = 69807
SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825 SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825
SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867 SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867
SHA256 (eclipse-paho.mqtt.golang-v1.3.5_GH0.tar.gz) = 9cfb8872e5f6347ec5e669791f28339a9f404f65ec7ad6bee341ce5b399065b9 SHA256 (eclipse-paho.mqtt.golang-v1.3.5_GH0.tar.gz) = 9cfb8872e5f6347ec5e669791f28339a9f404f65ec7ad6bee341ce5b399065b9

View File

@ -0,0 +1,80 @@
#!/bin/sh
# PROVIDE: mqtt2prometheus
# REQUIRE: DAEMON
# KEYWORD: shutdown
# This script supports running multiple instances of mqtt2prometheus.
# To run additional instances link this script to something like
# % ln -s mqtt2prometheus mqtt2prometheus_foo
# and define additional mqtt2prometheus_foo_* variables in one of
# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/mqtt2prometheus_foo
. /etc/rc.subr
name="${file}"
case "$0" in
/etc/rc*)
name="$_file"
;;
*/service)
;;
*)
name="$0"
;;
esac
name="${name:-mqtt2prometheus}" ;
name="${name##*/}"
rcvar=${name}_enable
load_rc_config $name
eval ": \${${name}_enable:=\"NO\"}"
eval ": \${${name}_user:=\"nobody\"}"
eval ": \${${name}_group:=\"nobody\"}"
eval ": \${${name}_config:=\"/usr/local/etc/mqtt2prometheus.yaml\"}"
eval ": \${${name}_pidfile:=\"/var/run/mqtt2prometheus.pid\"}"
eval ": \${${name}_listen_address:=\"0.0.0.0\"}"
eval ": \${${name}_listen_port:=\"9641\"}"
eval ": \${${name}_loglevel:=\"info\"}"
eval ": \${${name}_logformat:=\"console\"}"
eval ": \${${name}_logfile:=\"/var/log/mqtt2prometheus.log\"}"
pidfile="$(eval echo \${${name}_pidfile})"
required_files="$(eval echo \${${name}_config})"
m2p_user="$(eval echo \${${name}_user})"
m2p_group="$(eval echo \${${name}_group})"
m2p_config="$(eval echo \${${name}_config})"
m2p_listen_address="$(eval echo \${${name}_listen_address})"
m2p_listen_port="$(eval echo \${${name}_listen_port})"
m2p_loglevel="$(eval echo \${${name}_loglevel})"
m2p_logformat="$(eval echo \${${name}_logformat})"
m2p_logfile="$(eval echo \${${name}_logfile})"
procname="/usr/local/bin/mqtt2prometheus"
command="/usr/sbin/daemon"
command_args="-p ${pidfile} -t ${name} -o ${m2p_logfile} \
/usr/bin/env ${mqtt2prometheus_env} ${procname} \
-config ${m2p_config} \
-listen-address ${m2p_listen_address} \
-listen-port ${m2p_listen_port} \
--log-level ${m2p_loglevel} \
--log-format ${m2p_logformat} \
${mqtt2prometheus_args}"
start_precmd="mqtt2prometheus_start_precmd"
mqtt2prometheus_start_precmd()
{
if [ ! -e "${pidfile}" ]; then
install -m 0600 -o ${m2p_user} -g ${m2p_group} /dev/null "${pidfile}"
fi
if [ ! -e "${mqtt2prometheus_logfile}" ]; then
install -m 0600 -o ${m2p_user} -g ${m2p_group} /dev/null "${m2p_logfile}"
fi
}
run_rc_command "$1"