Index: net-mgmt/prometheus1/Makefile =================================================================== --- net-mgmt/prometheus1/Makefile +++ net-mgmt/prometheus1/Makefile @@ -19,7 +19,7 @@ GO_PKGNAME= github.com/${PORTNAME}/${PORTNAME} -USE_RC_SUBR= prometheus +USE_RC_SUBR= prometheus1 USERS= prometheus GROUPS= prometheus @@ -32,18 +32,22 @@ ${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \ ${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER} +PROMETHEUS_BINARIES= prometheus promtool + do-build: - ( cd ${GO_WRKSRC}/cmd/prometheus ; \ +.for bin in ${PROMETHEUS_BINARIES} + ( cd ${GO_WRKSRC}/cmd/${bin} ; \ ${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" ) +.endfor - ( cd ${GO_WRKSRC}/cmd/promtool ; \ - ${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" ) - do-install: - ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/prometheus ${STAGEDIR}${PREFIX}/bin - ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/promtool ${STAGEDIR}${PREFIX}/bin - ${INSTALL_DATA} ${WRKSRC}/documentation/examples/prometheus.yml ${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample +.for bin in ${PROMETHEUS_BINARIES} + ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin/${bin}1 +.endfor + ${INSTALL_DATA} \ + ${WRKSRC}/documentation/examples/prometheus.yml \ + ${STAGEDIR}${LOCALBASE}/etc/prometheus1.yml.sample - ${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus + ${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus1 .include Index: net-mgmt/prometheus1/files/prometheus.in =================================================================== --- net-mgmt/prometheus1/files/prometheus.in +++ net-mgmt/prometheus1/files/prometheus.in @@ -1,65 +0,0 @@ -#!/bin/sh - -# PROVIDE: prometheus -# REQUIRE: LOGIN -# KEYWORD: shutdown -# -# Add the following lines to /etc/rc.conf.local or /etc/rc.conf -# to enable this service: -# -# prometheus_enable (bool): Set to NO by default -# Set it to YES to enable prometheus -# prometheus_user (string): Set user to run prometheus -# Default is "prometheus" -# prometheus_group (string): Set group to run prometheus -# Default is "prometheus" -# prometheus_data_dir (string): Set dir to run prometheus in -# Default is "/var/db/prometheus" -# prometheus_log_file (string): Set file that prometheus will log to -# Default is "/var/log/prometheus.log" -# prometheus_args (string): Set additional command line arguments -# Default is "" - -. /etc/rc.subr - -name=prometheus -rcvar=prometheus_enable - -load_rc_config $name - -: ${prometheus_enable:="NO"} -: ${prometheus_user:="prometheus"} -: ${prometheus_group:="prometheus"} -: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"} -: ${prometheus_data_dir:="/var/db/prometheus"} -: ${prometheus_log_file:="/var/log/prometheus.log"} -: ${prometheus_args:=""} - -pidfile=/var/run/prometheus.pid -required_files="${prometheus_config}" -command="/usr/sbin/daemon" -procname="%%PREFIX%%/bin/prometheus" -sig_reload=HUP -extra_commands="reload" -command_args="-p ${pidfile} /usr/bin/env ${procname} \ - -config.file=${prometheus_config} \ - -storage.local.path=${prometheus_data_dir} \ - ${prometheus_args} >> ${prometheus_log_file} 2>&1" - -start_precmd=prometheus_startprecmd - -prometheus_startprecmd() -{ - if [ ! -e ${pidfile} ]; then - install -o ${prometheus_user} -g ${prometheus_group} /dev/null ${pidfile}; - fi - if [ ! -f "${prometheus_log_file}" ]; then - install -o ${prometheus_user} -g ${prometheus_group} -m 640 /dev/null ${prometheus_log_file}; - fi - if [ ! -d ${prometheus_data_dir} ]; then - install -d -o ${prometheus_user} -g ${prometheus_group} -m 750 ${prometheus_data_dir} - fi -} - -load_rc_config $name -run_rc_command "$1" Index: net-mgmt/prometheus1/files/prometheus1.in =================================================================== --- net-mgmt/prometheus1/files/prometheus1.in +++ net-mgmt/prometheus1/files/prometheus1.in @@ -1,63 +1,75 @@ #!/bin/sh -# PROVIDE: prometheus +# PROVIDE: prometheus1 # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # -# prometheus_enable (bool): Set to NO by default -# Set it to YES to enable prometheus -# prometheus_user (string): Set user to run prometheus -# Default is "prometheus" -# prometheus_group (string): Set group to run prometheus -# Default is "prometheus" -# prometheus_data_dir (string): Set dir to run prometheus in -# Default is "/var/db/prometheus" -# prometheus_log_file (string): Set file that prometheus will log to -# Default is "/var/log/prometheus.log" -# prometheus_args (string): Set additional command line arguments -# Default is "" +# prometheus1_enable (bool): Set to NO by default +# Set it to YES to enable prometheus1 +# prometheus1_user (string): Set user to run prometheus +# Default is "prometheus" +# prometheus1_group (string): Set group to run prometheus +# Default is "prometheus" +# prometheus1_data_dir (string): Set dir to run prometheus in +# Default is "/var/db/prometheus1" +# prometheus1_log_file (string): Set file that prometheus will log to +# Default is "/var/log/prometheus1.log" +# prometheus1_args (string): Set additional command line arguments +# Default is "" . /etc/rc.subr -name=prometheus -rcvar=prometheus_enable +name=prometheus1 +rcvar=prometheus1_enable load_rc_config $name -: ${prometheus_enable:="NO"} -: ${prometheus_user:="prometheus"} -: ${prometheus_group:="prometheus"} -: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"} -: ${prometheus_data_dir:="/var/db/prometheus"} -: ${prometheus_log_file:="/var/log/prometheus.log"} -: ${prometheus_args:=""} +: ${prometheus1_enable:="NO"} +: ${prometheus1_user:="prometheus"} +: ${prometheus1_group:="prometheus"} +: ${prometheus1_config:="%%PREFIX%%/etc/prometheus1.yml"} +: ${prometheus1_data_dir:="/var/db/prometheus1"} +: ${prometheus1_log_file:="/var/log/prometheus1.log"} +: ${prometheus1_args:=""} -pidfile=/var/run/prometheus.pid -required_files="${prometheus_config}" +pidfile=/var/run/${name}.pid +required_files="${prometheus1_config}" command="/usr/sbin/daemon" -procname="%%PREFIX%%/bin/prometheus" +procname="%%PREFIX%%/bin/prometheus1" sig_reload=HUP extra_commands="reload" command_args="-p ${pidfile} /usr/bin/env ${procname} \ - -config.file=${prometheus_config} \ - -storage.local.path=${prometheus_data_dir} \ - ${prometheus_args} >> ${prometheus_log_file} 2>&1" + -config.file=${prometheus1_config} \ + -storage.local.path=${prometheus1_data_dir} \ + ${prometheus1_args} >> ${prometheus1_log_file} 2>&1" -start_precmd=prometheus_startprecmd +start_precmd=prometheus1_startprecmd -prometheus_startprecmd() +prometheus1_startprecmd() { if [ ! -e ${pidfile} ]; then - install -o ${prometheus_user} -g ${prometheus_group} /dev/null ${pidfile}; + install \ + -o ${prometheus1_user} \ + -g ${prometheus1_group} \ + /dev/null ${pidfile}; fi - if [ ! -f "${prometheus_log_file}" ]; then - install -o ${prometheus_user} -g ${prometheus_group} -m 640 /dev/null ${prometheus_log_file}; + if [ ! -f "${prometheus1_log_file}" ]; then + install \ + -o ${prometheus1_user} \ + -g ${prometheus1_group} \ + -m 640 \ + /dev/null ${prometheus1_log_file}; fi - if [ ! -d ${prometheus_data_dir} ]; then - install -d -o ${prometheus_user} -g ${prometheus_group} -m 750 ${prometheus_data_dir} + if [ ! -d ${prometheus1_data_dir} ]; then + install \ + -d \ + -o ${prometheus1_user} \ + -g ${prometheus1_group} \ + -m 750 \ + ${prometheus1_data_dir} fi } Index: net-mgmt/prometheus1/pkg-message =================================================================== --- net-mgmt/prometheus1/pkg-message +++ net-mgmt/prometheus1/pkg-message @@ -0,0 +1,7 @@ +If you are installing net-mgmt/prometheus1 as part of migration to Prometheus 2, +please see the pkg-message of net-mgmt/prometheus2 for a brief description of +the migration process. + +If you are installing Prometheus for the first time, you may wish to consider +switching to the net-mgmt/prometheus2 port for the latest Prometheus release +series. Index: net-mgmt/prometheus1/pkg-plist =================================================================== --- net-mgmt/prometheus1/pkg-plist +++ net-mgmt/prometheus1/pkg-plist @@ -1,4 +1,4 @@ -bin/prometheus -bin/promtool -@sample etc/prometheus.yml.sample -@dir(prometheus,prometheus) /var/db/prometheus +bin/prometheus1 +bin/promtool1 +@sample etc/prometheus1.yml.sample +@dir(prometheus,prometheus) /var/db/prometheus1