From c9dd3e22a57896296349d66dd6ad9f674bb90b93 Mon Sep 17 00:00:00 2001 From: yo Date: Wed, 18 May 2022 13:59:07 +0200 Subject: [PATCH] First commit --- Makefile | 31 +++++++++++++++++++++++++++++ distinfo | 3 +++ files/carp_exporter.in | 44 ++++++++++++++++++++++++++++++++++++++++++ pkg-descr | 3 +++ pkg-plist | 2 ++ 5 files changed, 83 insertions(+) create mode 100644 Makefile create mode 100644 distinfo create mode 100644 files/carp_exporter.in create mode 100644 pkg-descr create mode 100644 pkg-plist diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2e32968 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +PORTNAME= carp_exporter +DISTVERSIONPREFIX= v +DISTVERSION= 1.1 +CATEGORIES= sysutils +MASTER_SITES= https://git.nosd.in/yo/carp_exporter/archive/ +DISTNAME= ${DISTVERSIONPREFIX}${DISTVERSION} + +MAINTAINER= johan@nosd.in +COMMENT= Export CARP status in Prometheus format + +LICENSE= BSD2CLAUSE + +USES= shebangfix python +SHEBANG_FILES= *.py + +# Gitea packaging need some tweaks +WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} +EXTRACT_AFTER_ARGS= && ( [ -d ${PORTNAME} ] && ${MV} ${PORTNAME} ${PORTNAME}-${DISTVERSION} ) + +USERS= nobody +GROUPS= nobody + +NO_BUILD= YES +NO_TEST= YES + +USE_RC_SUBR= carp_exporter + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/carp_exporter.py ${STAGEDIR}${PREFIX}/bin + +.include diff --git a/distinfo b/distinfo new file mode 100644 index 0000000..54c77ba --- /dev/null +++ b/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1652872508 +SHA256 (v1.1.tar.gz) = 206ff06b0d573f648b512de8da191935753a4653ae637d286792d48aa47e5f15 +SIZE (v1.1.tar.gz) = 1321 diff --git a/files/carp_exporter.in b/files/carp_exporter.in new file mode 100644 index 0000000..047fcd9 --- /dev/null +++ b/files/carp_exporter.in @@ -0,0 +1,44 @@ +#!/bin/sh + +# carp_exporter/files/carp_exporter.in 2021-08-20 09:12:03Z yo $ +# +# PROVIDE: carp_exporter +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# carp_exporter_enable (bool): Set to "YES" to enable carp_exporter. +# (default: "NO") +# +# carp_exporter_listen (str): Exporter listening address - NOT IMPLEMENTED +# (default: ":8992") +# +# carp_exporter_logfile (str): carp_exporter logfile +# (default: "/var/log/carp_exporter.log") +# + +. /etc/rc.subr + +name=carp_exporter +rcvar=carp_exporter_enable + +load_rc_config $name + +: ${carp_exporter_enable="NO"} +: ${carp_exporter_listen=":8992"} +: ${carp_exporter_pidfile:="/var/run/carp_exporter.pid"} +: ${carp_exporter_user:="nobody"} +: ${carp_exporter_logfile="/var/log/carp_exporter.log"} + +command="python3" +command_args="/usr/local/bin/carp_exporter.py > ${carp_exporter_logfile} 2>&1" +start_cmd="/usr/sbin/daemon -u ${carp_exporter_user} ${command} ${command_args}" +start_precmd="${name}_prestart" + +carp_exporter_prestart() +{ + touch ${carp_exporter_logfile} + chown ${carp_exporter_user} ${carp_exporter_logfile} +} + + +run_rc_command "$1" diff --git a/pkg-descr b/pkg-descr new file mode 100644 index 0000000..afcb9ba --- /dev/null +++ b/pkg-descr @@ -0,0 +1,3 @@ +Export CARP status in Prometheus format. + +WWW: https://git.nosd.in/yo/carp_exporter diff --git a/pkg-plist b/pkg-plist new file mode 100644 index 0000000..3e6252e --- /dev/null +++ b/pkg-plist @@ -0,0 +1,2 @@ +bin/carp_exporter.py +etc/rc.d/carp_exporter