pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/databases/prometheus



Module Name:    pkgsrc
Committed By:   wiz
Date:           Fri Dec 15 15:00:09 UTC 2023

Modified Files:
        pkgsrc/databases/prometheus: Makefile
Added Files:
        pkgsrc/databases/prometheus/files: prometheus.sh

Log Message:
prometheus: create necessary data and log dirs; add user; add rc.d script

XXX: adapt smf script for log path?

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 pkgsrc/databases/prometheus/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/databases/prometheus/files/prometheus.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/databases/prometheus/Makefile
diff -u pkgsrc/databases/prometheus/Makefile:1.89 pkgsrc/databases/prometheus/Makefile:1.90
--- pkgsrc/databases/prometheus/Makefile:1.89   Tue Dec  5 19:46:03 2023
+++ pkgsrc/databases/prometheus/Makefile        Fri Dec 15 15:00:09 2023
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.89 2023/12/05 19:46:03 bsiegert Exp $
+# $NetBSD: Makefile,v 1.90 2023/12/15 15:00:09 wiz Exp $
 
 # Important: UI has to be manually built when updating. See instructions below.
 
 DISTNAME=      prometheus-2.40.5
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=prometheus/}
-PKGREVISION=   13
+PKGREVISION=   14
 CATEGORIES=    databases
 GITHUB_TAG=    v${PKGVERSION_NOREV}
 
@@ -76,6 +76,25 @@ EXAMPLE_FILES+=      consoles/index.html.exam
 EXAMPLE_FILES+=        console_libraries/menu.lib console_libraries/prom.lib
 WEBUI_DIR=     ${PREFIX}/share/prometheus
 
+DATADIR=       ${VARBASE}/lib/prometheus
+LOGDIR=                ${VARBASE}/log/prometheus
+
+BUILD_DEFS+=           PROMETHEUS_USER PROMETHEUS_GROUP VARBASE
+FILES_SUBST+=          PROMETHEUS_USER=${PROMETHEUS_USER:Q}
+FILES_SUBST+=          PROMETHEUS_GROUP=${PROMETHEUS_GROUP:Q}
+FILES_SUBST+=          DATADIR=${DATADIR:Q}
+FILES_SUBST+=          LOGDIR=${LOGDIR:Q}
+
+PROMETHEUS_USER?=      prometheus
+PROMETHEUS_GROUP?=     prometheus
+OWN_DIRS_PERMS+=       ${DATADIR} ${PROMETHEUS_USER} ${PROMETHEUS_GROUP} 0700
+OWN_DIRS_PERMS+=       ${LOGDIR} ${PROMETHEUS_USER} ${PROMETHEUS_GROUP} 0700
+PKG_USERS_VARS+=       PROMETHEUS_USER
+PKG_GROUPS_VARS+=      PROMETHEUS_GROUP
+PKG_GROUPS=            ${PROMETHEUS_GROUP}
+PKG_USERS=             ${PROMETHEUS_USER}:${PROMETHEUS_GROUP}
+RCD_SCRIPTS=           prometheus
+
 INSTALLATION_DIRS+=    ${EXAMPLE_DIR} ${WEBUI_DIR}
 
 .for f in ${EXAMPLE_FILES}

Added files:

Index: pkgsrc/databases/prometheus/files/prometheus.sh
diff -u /dev/null pkgsrc/databases/prometheus/files/prometheus.sh:1.1
--- /dev/null   Fri Dec 15 15:00:09 2023
+++ pkgsrc/databases/prometheus/files/prometheus.sh     Fri Dec 15 15:00:09 2023
@@ -0,0 +1,54 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: prometheus.sh,v 1.1 2023/12/15 15:00:09 wiz Exp $
+#
+# PROVIDE: prometheus
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Consider installing pkgtools/rc.subr in unprivileged.
+#
+# You will need to set some variables in @SYSCONFBASE@/rc.conf to start prometheus:
+#
+# prometheus=YES
+
+if [ -f @SYSCONFBASE@/rc.subr ]; then
+       $_rc_subr_loaded . @SYSCONFBASE@/rc.subr
+fi
+
+name="prometheus"
+rcvar=$name
+prometheus_user="@PROMETHEUS_USER@"
+prometheus_group="@PROMETHEUS_GROUP@"
+command="@PREFIX@/bin/prometheus"
+command_args="> @LOGDIR@/prometheus.log 2>&1 &"
+
+
+if [ -f @SYSCONFBASE@/rc.subr -a -d @SYSCONFBASE@/rc.d -a -f @SYSCONFBASE@/rc.d/DAEMON ]; then
+       load_rc_config $name
+       run_rc_command "$1"
+else
+       if [ -f @SYSCONFBASE@/rc.conf ]; then
+               . @SYSCONFBASE@/rc.conf
+       fi
+       case "$1" in
+       start)
+               if [ -r "${pidfile}" ]; then
+                       @ECHO@ "Already running ${name}."
+               else
+                       @ECHO@ "Starting ${name}."
+                       eval ${command} ${command_args}
+               fi
+               ;;
+       stop)
+               if [ -r "${pidfile}" ]; then
+                       @ECHO@ "Stopping ${name}."
+                       kill `@CAT@ "${pidfile}"` && @RM@ "${pidfile}"
+               fi
+               ;;
+       *)
+               @ECHO@ "Usage: $0 {start|stop}" 1>&2
+               exit 10
+               ;;
+       esac
+fi



Home | Main Index | Thread Index | Old Index