diff -urN kapacitor.orig/Makefile kapacitor/Makefile --- kapacitor.orig/Makefile 2017-12-03 02:19:06.339551000 +0200 +++ kapacitor/Makefile 2017-12-09 17:57:11.599722000 +0200 @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= kapacitor -PORTVERSION= 1.3.2 +PORTVERSION= 1.4.0 DISTVERSIONPREFIX= v CATEGORIES= net-mgmt @@ -25,40 +25,69 @@ #GH_SUBDIR= src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME} SUB_FILES= kapacitord -SUB_LIST+= KAPACITORD_PIDDIR=${KAPACITORD_PIDDIR} -PLIST_SUB= KAPACITORD_PIDDIR=${KAPACITORD_PIDDIR} +SUB_LIST+= KAPACITORD_USER=${KAPACITORD_USER} \ + KAPACITORD_GROUP=${KAPACITORD_GROUP} \ + KAPACITORD_DBDIR=${KAPACITORD_DBDIR} \ + KAPACITORD_LOGDIR=${KAPACITORD_LOGDIR} + +PLIST_SUB= KAPACITORD_USER=${KAPACITORD_USER} \ + KAPACITORD_GROUP=${KAPACITORD_GROUP} \ + KAPACITORD_DBDIR=${KAPACITORD_DBDIR} \ + KAPACITORD_LOGDIR=${KAPACITORD_LOGDIR} + +#Use influxd user as it's aleary present in ports system +KAPACITORD_USER= influxd +KAPACITORD_GROUP= influxd + +USERS= ${KAPACITORD_USER} +GROUPS= ${KAPACITORD_GROUP} + +KAPACITORD_DBDIR= /var/db/${PORTNAME}/ +KAPACITORD_LOGDIR= /var/log/${PORTNAME}/ + +.include + +.if ${OPSYS} == "FreeBSD" && ((${OSVERSION} >= 1100513 && ${OSVERSION} < 1200000) || \ + ${OSVERSION} >= 1200015) +SUB_LIST+= KAPACITORD_LOGCMD="daemon" +.else +SUB_LIST+= KAPACITORD_LOGCMD="logger" +.endif post-patch: @${MKDIR} ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME} @cd ${WRKSRC} && ${MV} \ - BLOB_STORE_DESIGN.md CHANGELOG.md CONTRIBUTING.md DESIGN.md \ - Gopkg.lock Gopkg.toml LICENSE_OF_DEPENDENCIES.md README.md \ - alert alert.go auth batch.go bufpool build.py build.sh \ - circle-test.sh circle.yml client clock cmd combine.go combine_test.go \ - command default.go delete.go derivative.go doc.go edge.go \ - edge_test.go etc eval.go examples expr.go expvar flatten.go \ - gobuild.sh group_by.go http_out.go http_post.go influxdb \ - influxdb_out.go influxql.gen.go influxql.gen.go.tmpl influxql.go \ - integrations join.go k8s_autoscale.go kapacitor_loopback.go \ - list-deps listmap log.go metaclient.go models node.go noop.go \ - output.go pipeline query.go query_test.go replay.go result.go \ - sample.go scripts server services shift.go state_tracking.go \ - stats.go stream.go task.go task_master.go template.go test.sh \ - tick tickdoc.conf timer tmpldata.json udf udf.go udf_test.go \ - union.go update_tick_docs.sh usr uuid vars vendor where.go \ + BLOB_STORE_DESIGN.md CHANGELOG.md CONTRIBUTING.md DESIGN.md Gopkg.lock \ + Gopkg.toml LICENSE_OF_DEPENDENCIES.md README.md alert alert.go auth \ + autoscale.go barrier.go batch.go bufpool build.py build.sh circle-test.sh \ + circle.yml client clock cmd combine.go combine_test.go command default.go \ + delete.go derivative.go doc.go edge edge.go etc eval.go examples expr.go \ + expvar flatten.go gobuild.sh group_by.go http_out.go http_post.go influxdb \ + influxdb_out.go influxql.gen.go influxql.gen.go.tmpl influxql.go integrations \ + join.go kapacitor_loopback.go keyvalue list-deps listmap log.go metaclient.go \ + models node.go noop.go output.go pipeline query.go query_test.go replay.go \ + result.go sample.go scripts server services shift.go sideload.go \ + state_tracking.go stats.go stream.go task.go task_master.go template.go \ + test.sh tick tickdoc.conf timer tlsconfig tmpldata.json udf udf.go \ + udf_test.go union.go update_tick_docs.sh usr uuid vendor waiter where.go \ window.go window_test.go \ ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME} do-build: @cd ${WRKSRC}/src/github.com/influxdata/${PORTNAME} \ - && ${SETENV} GOPATH=${WRKSRC} go install -ldflags "-X main.version=${DISTVERSION}" ./cmd/${PORTNAME} \ - && ${SETENV} GOPATH=${WRKSRC} go install -ldflags "-X main.version=${DISTVERSION}" ./cmd/${PORTNAME}d + && ${SETENV} GOPATH=${WRKSRC} go install -ldflags "-X main.version=${PORTVERSION}" ./cmd/${PORTNAME} \ + && ${SETENV} GOPATH=${WRKSRC} go install -ldflags "-X main.version=${PORTVERSION}" ./cmd/${PORTNAME}d do-install: + ${MKDIR} ${STAGEDIR}${KAPACITORD_DBDIR} \ + ${STAGEDIR}${KAPACITORD_LOGDIR} ${INSTALL_PROGRAM} ${WRKSRC}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME} ${INSTALL_PROGRAM} ${WRKSRC}/bin/${PORTNAME}d ${STAGEDIR}${PREFIX}/bin/${PORTNAME}d + @${SED} -i .bak -e \ + "s|/var/lib/kapacitor|/var/db/kapacitor|g" \ + ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT}/etc/${PORTNAME}/${PORTNAME}.conf ${INSTALL_DATA} \ ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT}/etc/${PORTNAME}/${PORTNAME}.conf \ ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample -.include +.include diff -urN kapacitor.orig/distinfo kapacitor/distinfo --- kapacitor.orig/distinfo 2017-12-03 02:19:06.339700000 +0200 +++ kapacitor/distinfo 2017-12-09 16:22:17.077950000 +0200 @@ -1,3 +1,3 @@ -TIMESTAMP = 1511467900 -SHA256 (influxdata-kapacitor-v1.3.2_GH0.tar.gz) = bdd53ab115c36905edbe1026ca8a14595c2ee2703380cd06366d1599c0db8806 -SIZE (influxdata-kapacitor-v1.3.2_GH0.tar.gz) = 7039627 +TIMESTAMP = 1512829337 +SHA256 (influxdata-kapacitor-v1.4.0_GH0.tar.gz) = 3c448eec9fb26581d9074a9fca4593d7aa7a19e4934cc392b5a345fad90edbeb +SIZE (influxdata-kapacitor-v1.4.0_GH0.tar.gz) = 7542927 diff -urN kapacitor.orig/files/kapacitord.in kapacitor/files/kapacitord.in --- kapacitor.orig/files/kapacitord.in 2016-12-09 15:05:06.520798000 +0200 +++ kapacitor/files/kapacitord.in 2017-12-09 17:11:30.707588000 +0200 @@ -6,14 +6,14 @@ # BEFORE: LOGIN # KEYWORD: shutdown -# Add the following lines to /etc/rc.conf to enable telegrafb: +# Add the following lines to /etc/rc.conf to enable kapacitord: # kapacitord_enable="YES" # -# kapacitord_enable (bool): Set to YES to enable telegraf +# kapacitord_enable (bool): Set to YES to enable kapacitord # Default: NO -# kapacitord_conf (str): telegraf configuration file -# Default: ${PREFIX}/etc/telegraf.conf -# kapacitord_flags (str): Extra flags passed to telegraf +# kapacitord_conf (str): kapacitord configuration file +# Default: ${PREFIX}/etc/kapacitord.conf +# kapacitord_flags (str): Extra flags passed to kapacitord . /etc/rc.subr @@ -22,14 +22,35 @@ load_rc_config $name : ${kapacitord_enable:="NO"} +: ${kapacitord_user:="%%KAPACITORD_USER%%"} +: ${kapacitord_group:="%%KAPACITORD_GROUP%%"} +: ${kapacitord_facility:="daemon"} +: ${kapacitord_priority:="info"} : ${kapacitord_flags:=""} : ${kapacitord_conf:="%%PREFIX%%/etc/kapacitor.conf"} +: ${kapacitord_options:="${kapacitord_flags} -config=${kapacitord_conf}"} + # daemon start_precmd=kapacitord_prestart -pidfile="/var/run/${name}.pid" +kapacitord_pidfile="/var/run/${name}.pid" +procname="%%PREFIX%%/bin/${name}" command=/usr/sbin/daemon -command_args="-f -crP ${pidfile} %%PREFIX%%/bin/${name} ${kapacitord_flags} -config=${kapacitord_conf} >> /var/log/kapacitord.log 2>&1" +start_cmd="kapacitord_startcmd_%%KAPACITORD_LOGCMD%%" + +kapacitord_startcmd_daemon() +{ + echo "Starting ${name}." + /usr/sbin/daemon -c -p ${kapacitord_pidfile} -S -s ${kapacitord_priority} -l ${kapacitord_facility} \ + -u ${kapacitord_user} ${procname} ${kapacitord_options} +} + +kapacitord_startcmd_logger() +{ + echo "Starting ${name}." + /usr/sbin/daemon -c -p ${kapacitord_pidfile} -u ${kapacitord_user} /bin/sh -c "${procname} ${kapacitord_options} 2>&1 \ + | /usr/bin/logger -t ${name} -p ${kapacitord_facility}.${kapacitord_priority}" +} kapacitord_prestart() { # Have to empty rc_flags so they don't get passed to daemon(8) diff -urN kapacitor.orig/pkg-plist kapacitor/pkg-plist --- kapacitor.orig/pkg-plist 2016-06-15 14:50:29.002687237 +0300 +++ kapacitor/pkg-plist 2017-12-09 17:31:08.759652000 +0200 @@ -1,3 +1,5 @@ bin/kapacitor bin/kapacitord +@dir(%%KAPACITORD_USER%%,%%KAPACITORD_GROUP%%,0750) %%KAPACITORD_DBDIR%% +@dir(%%KAPACITORD_USER%%,%%KAPACITORD_GROUP%%,0750) %%KAPACITORD_LOGDIR%% @sample etc/kapacitor.conf.sample