svn commit: r424678 - in head: . net/rtg net/rtg/files

Matthew Seaman matthew at FreeBSD.org
Wed Oct 26 07:01:18 UTC 2016


Author: matthew
Date: Wed Oct 26 07:01:15 2016
New Revision: 424678
URL: https://svnweb.freebsd.org/changeset/ports/424678

Log:
  Improve RTG port
  
  Summary:
  Add 'rtg' user and group in UIDs/GIDs.
  Use daemon(8) to daemonize rtgpoll.
  Add prestart commands to set correct permissions for RTG's files.
  
  Reviewers: swills, allanjude, xmj, andrew.fengler_scaleengine.com, #contributor_reviewers_ports, matthew
  
  Reviewed By: #contributor_reviewers_ports, matthew
  
  Subscribers: matthew, mat
  
  Differential Revision: https://reviews.freebsd.org/D7486

Modified:
  head/GIDs
  head/UIDs
  head/net/rtg/Makefile
  head/net/rtg/files/patch-config-config.h.in
  head/net/rtg/files/patch-configure
  head/net/rtg/files/patch-etc-95.php
  head/net/rtg/files/patch-etc-Makefile.in
  head/net/rtg/files/patch-etc-rtg.php
  head/net/rtg/files/patch-etc-rtgtargmkr.pl.in
  head/net/rtg/files/patch-etc-view.php
  head/net/rtg/files/patch-man-rtgplot.1
  head/net/rtg/files/patch-man-rtgpoll.1
  head/net/rtg/files/patch-src-rtg.h
  head/net/rtg/files/patch-src-rtgplot.c
  head/net/rtg/files/patch-src-rtgpoll.c
  head/net/rtg/files/rtgpoll.in

Modified: head/GIDs
==============================================================================
--- head/GIDs	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/GIDs	Wed Oct 26 07:01:15 2016	(r424678)
@@ -219,7 +219,7 @@ meta1:*:264:
 haclient:*:275:
 frontbase:*:276:
 # free: 277
-# free: 278
+rtg:*:278:
 mrtg:*:279:
 xymon:*:280:
 prelude:*:281:

Modified: head/UIDs
==============================================================================
--- head/UIDs	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/UIDs	Wed Oct 26 07:01:15 2016	(r424678)
@@ -224,7 +224,7 @@ meta1:*:264:264::0:0:MeTA1 other:/nonexi
 hacluster:*:275:275::0:0:Heartbeat cluster user:/nonexistent:/usr/sbin/nologin
 frontbase:*:276:276::0:0:FrontBase Daemon:/usr/local/FrontBase/Databases:/bin/sh
 # free: 277
-# free: 278
+rtg:*:278:278::0:0:RTG daemon:/nonexistent:/usr/sbin/nologin
 mrtg:*:279:279::0:0:MRTG daemon:/nonexistent:/usr/sbin/nologin
 xymon:*:280:280::0:0:Xymon Monitor:/nonexistent:/usr/sbin/nologin
 prelude:*:281:281::0:0:Prelude user:/nonexistent:/usr/sbin/nologin

Modified: head/net/rtg/Makefile
==============================================================================
--- head/net/rtg/Makefile	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/Makefile	Wed Oct 26 07:01:15 2016	(r424678)
@@ -3,7 +3,7 @@
 
 PORTNAME=	rtg
 PORTVERSION=	0.7.4
-PORTREVISION=	12
+PORTREVISION=	13
 CATEGORIES=	net
 MASTER_SITES=	SF \
 		ftp://ftpmirror.uk/freebsd-ports/rtg/
@@ -18,30 +18,27 @@ RUN_DEPENDS=	p5-DBI>=0:databases/p5-DBI 
 		p5-DBD-mysql>=0:databases/p5-DBD-mysql
 
 USE_RC_SUBR=	rtgpoll
-USE_MYSQL=	client
 WANT_PERL=	yes
-USES=		shebangfix
+USES=		shebangfix mysql:client
 SHEBANG_FILES=	etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
 SUB_FILES=	pkg-message
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS+=	--sysconfdir=${PREFIX}/etc/${PORTNAME} \
 			--with-mysql=${LOCALBASE} \
 			--with-snmp=${LOCALBASE}
+
+USERS=		rtg
+GROUPS=		rtg
+
 OPTIONS_DEFINE=	WEB MYSQL
 OPTIONS_DEFAULT=WEB
 MYSQL_DESC=	Pull MySQL server in as a dependancy for local setups
 WEB_DESC=	Include PHP-based web client interface pre-requisites
 
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MMYSQL}
-USE_MYSQL=	yes
-.endif
+MYSQL_USES=	mysql:server
 
-.if ${PORT_OPTIONS:MWEB}
-WANT_PHP_WEB=	yes
+WEB_USES=	php
 USE_PHP=	mysqli spl
-.endif
 
 CFLAGS+=	-fstack-protector
 LDFLAGS+=	-fstack-protector

Modified: head/net/rtg/files/patch-config-config.h.in
==============================================================================
--- head/net/rtg/files/patch-config-config.h.in	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-config-config.h.in	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- config/config.h.in.orig	Thu Sep 25 08:21:14 2003
-+++ config/config.h.in	Sat May 14 01:31:47 2005
+--- config/config.h.in.orig	2003-09-25 15:21:14 UTC
++++ config/config.h.in
 @@ -91,19 +91,19 @@
  #undef PACKAGE
  

Modified: head/net/rtg/files/patch-configure
==============================================================================
--- head/net/rtg/files/patch-configure	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-configure	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,6 +1,6 @@
---- configure.ori	Tue Jan  6 22:43:17 2004
-+++ configure	Tue Jan  6 22:47:06 2004
-@@ -328,6 +328,8 @@
+--- configure.orig	2003-10-02 15:59:33 UTC
++++ configure
+@@ -328,6 +328,8 @@ sbindir='${exec_prefix}/sbin'
  libexecdir='${exec_prefix}/libexec'
  datadir='${prefix}/share'
  sysconfdir='${prefix}/etc'
@@ -9,7 +9,7 @@
  sharedstatedir='${prefix}/com'
  localstatedir='${prefix}/var'
  libdir='${exec_prefix}/lib'
-@@ -558,6 +560,12 @@
+@@ -558,6 +560,12 @@ do
    | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
      sysconfdir=$ac_optarg ;;
  
@@ -22,7 +22,7 @@
    -target | --target | --targe | --targ | --tar | --ta | --t)
      ac_prev=target_alias ;;
    -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-@@ -654,7 +662,8 @@
+@@ -654,7 +662,8 @@ done
  
  # Be sure to have absolute paths.
  for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
@@ -32,7 +32,7 @@
  do
    eval ac_val=$`echo $ac_var`
    case $ac_val in
-@@ -5310,6 +5319,8 @@
+@@ -5310,6 +5319,8 @@ s, at sbindir@,$sbindir,;t t
  s, at libexecdir@,$libexecdir,;t t
  s, at datadir@,$datadir,;t t
  s, at sysconfdir@,$sysconfdir,;t t

Modified: head/net/rtg/files/patch-etc-95.php
==============================================================================
--- head/net/rtg/files/patch-etc-95.php	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-etc-95.php	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- etc/95.php.orig	2014-06-22 15:27:55.587467922 +0100
-+++ etc/95.php	2014-06-22 15:28:47.947474934 +0100
+--- etc/95.php.orig	2003-09-24 20:40:57 UTC
++++ etc/95.php
 @@ -4,10 +4,8 @@
    print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
  
@@ -12,7 +12,7 @@
  
    if ($PHP_SELF == "") {
      $PHP_SELF = "95.php";
-@@ -50,8 +48,8 @@
+@@ -50,8 +48,8 @@ function int_stats($statement, $dbc) {
    $max = $avg = $nintyfifth = 0;
    $rate = array();
  
@@ -23,7 +23,7 @@
      $counter = $selectRow->counter;
      $sample_secs = $selectRow->unixtime;
      $total += $counter;
-@@ -89,9 +87,8 @@
+@@ -89,9 +87,8 @@ Report: 95th percentile<BR>
  <?php
    echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
    if (($bt || $smonth)) { 
@@ -35,7 +35,7 @@
      /* Format into GNU date syntax */
      if ($bt == "") {
        $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
-@@ -104,11 +101,11 @@
+@@ -104,11 +101,11 @@ Report: 95th percentile<BR>
      $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
  
      $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
@@ -50,7 +50,7 @@
          $ids[$selectRow->id] = $selectRow->name; 
          $rids[$selectRow->id] = $selectRow->rid; 
  	$desc[$selectRow->id] = $selectRow->description;
-@@ -127,8 +124,8 @@
+@@ -127,8 +124,8 @@ Report: 95th percentile<BR>
        foreach($ids as $iid=>$name) {
  
          $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
@@ -61,7 +61,7 @@
  	$router = $selectRow->name;
  
          if ($yellow) $yellow = 0;
-@@ -201,7 +198,7 @@
+@@ -201,7 +198,7 @@ Report: 95th percentile<BR>
      echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
    }
  

Modified: head/net/rtg/files/patch-etc-Makefile.in
==============================================================================
--- head/net/rtg/files/patch-etc-Makefile.in	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-etc-Makefile.in	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,6 +1,6 @@
---- etc/Makefile.in.orig	2003-10-02 16:59:32.000000000 +0100
-+++ etc/Makefile.in	2014-05-10 17:29:11.995407415 +0100
-@@ -84,19 +84,19 @@
+--- etc/Makefile.in.orig	2003-10-02 15:59:32 UTC
++++ etc/Makefile.in
+@@ -84,19 +84,19 @@ am__quote = @am__quote@
  install_sh = @install_sh@
  
  top_builddir = ..
@@ -26,7 +26,7 @@
  
  subdir = etc
  mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-@@ -220,14 +220,14 @@
+@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am
  all:
  
  install: installdirs

Modified: head/net/rtg/files/patch-etc-rtg.php
==============================================================================
--- head/net/rtg/files/patch-etc-rtg.php	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-etc-rtg.php	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- etc/rtg.php.orig	2003-09-24 21:42:03.000000000 +0100
-+++ etc/rtg.php	2014-06-22 15:25:22.471477252 +0100
+--- etc/rtg.php.orig	2003-09-24 20:42:03 UTC
++++ etc/rtg.php
 @@ -4,10 +4,8 @@
    print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
  
@@ -35,7 +35,7 @@
      $router = $selectRow->router;
    }
  
-@@ -71,8 +69,8 @@
+@@ -71,8 +69,8 @@ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=
  if (!$rid && !$iid) {
   echo "<SELECT NAME=\"rid\" SIZE=10>\n";
   $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
@@ -46,7 +46,7 @@
      echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
   }
   echo "</SELECT>\n";
-@@ -91,8 +89,8 @@
+@@ -91,8 +89,8 @@ if ($rid && !$iid) {
  
    echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; 
    $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
@@ -57,7 +57,7 @@
       echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
    }
    echo "</SELECT>\n";
-@@ -152,8 +150,8 @@
+@@ -152,8 +150,8 @@ if (($bt || $smonth) && $iid) { 
    $range="$range AND id=$iid[0]";
  
    $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
@@ -68,7 +68,7 @@
    echo "<TABLE BORDER=0>\n";
    echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
    echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
-@@ -165,12 +163,15 @@
+@@ -165,12 +163,15 @@ if (($bt || $smonth) && $iid) { 
    echo "<P>\n";
   
    #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
@@ -86,7 +86,7 @@
      foreach ($iid as $value) {
        $args="$args&iid=$value";
      }
-@@ -181,8 +182,11 @@
+@@ -181,8 +182,11 @@ if (($bt || $smonth) && $iid) { 
      if ($borderb) $args = "$args&borderb=$borderb";
      if ($aggr) $args = "$args&aggr=yes";
      if ($percentile) $args = "$args&percentile=$nth";
@@ -99,7 +99,7 @@
      foreach ($iid as $value) {
        $args="$args&iid=$value";
      }
-@@ -192,13 +196,17 @@
+@@ -192,13 +196,17 @@ if (($bt || $smonth) && $iid) { 
      if ($borderb) $args = "$args&borderb=$borderb";
      if ($aggr) $args = "$args&aggr=yes";
      if ($percentile) $args = "$args&percentile=$nth";

Modified: head/net/rtg/files/patch-etc-rtgtargmkr.pl.in
==============================================================================
--- head/net/rtg/files/patch-etc-rtgtargmkr.pl.in	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-etc-rtgtargmkr.pl.in	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,6 +1,6 @@
---- etc/rtgtargmkr.pl.in.orig	2010-04-21 20:55:58.903081619 +0100
-+++ etc/rtgtargmkr.pl.in	2010-04-21 20:56:15.567832088 +0100
-@@ -126,7 +126,7 @@
+--- etc/rtgtargmkr.pl.in.orig	2016-10-25 16:28:59 UTC
++++ etc/rtgtargmkr.pl.in
+@@ -126,7 +126,7 @@ sub find_router_id {
          &sql_insert($sql);
          $rid = &find_router_id($router);
          foreach $mib ( keys %mibs_of_interest ) {

Modified: head/net/rtg/files/patch-etc-view.php
==============================================================================
--- head/net/rtg/files/patch-etc-view.php	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-etc-view.php	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- etc/view.php.orig	2003-09-26 16:58:34.000000000 +0100
-+++ etc/view.php	2014-06-22 15:24:14.720483023 +0100
+--- etc/view.php.orig	2003-09-26 15:58:34 UTC
++++ etc/view.php
 @@ -11,10 +11,8 @@
    print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
  

Modified: head/net/rtg/files/patch-man-rtgplot.1
==============================================================================
--- head/net/rtg/files/patch-man-rtgplot.1	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-man-rtgplot.1	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- man/rtgplot.1.orig	2010-04-21 09:04:22.473988200 +0100
-+++ man/rtgplot.1	2010-04-21 09:08:22.862400825 +0100
+--- man/rtgplot.1.orig	2003-09-25 04:10:36 UTC
++++ man/rtgplot.1
 @@ -10,7 +10,8 @@
  -t tablename(s) -i interface(s) [options] begin end
  .br
@@ -10,7 +10,7 @@
  .SH DESCRIPTION
  .I rtgplot
  generates traffic plots of RTG data in PNG format.  It operates in
-@@ -82,14 +83,19 @@
+@@ -82,14 +83,19 @@ pixels.
  Set plot bottom border to 
  .RI <size> 
  pixels.
@@ -32,7 +32,7 @@
  .PP
  will plot two lines from the MySQL tables ifInOctets_2 and ifOutOctets_2
  corresponding to interface 4 on router 2 for the time span 1046754000 to
-@@ -97,6 +103,8 @@
+@@ -97,6 +103,8 @@ corresponding to interface 4 on router 2
  second; the units argument is displayed as the Y-axis label on the plot.
  The scalex argument auto-adjusts the X time axis according to the available 
  data samples rather than according to the actual time span given.  

Modified: head/net/rtg/files/patch-man-rtgpoll.1
==============================================================================
--- head/net/rtg/files/patch-man-rtgpoll.1	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-man-rtgpoll.1	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,6 +1,6 @@
---- man/rtgpoll.1.orig	2010-07-04 03:46:36.586762545 +0100
-+++ man/rtgpoll.1	2010-07-04 03:48:19.872644629 +0100
-@@ -31,6 +31,9 @@
+--- man/rtgpoll.1.orig	2003-09-24 17:26:57 UTC
++++ man/rtgpoll.1
+@@ -31,6 +31,9 @@ Disable database inserts.
  .IR "\-m"
  Skip checking for multiple instances.
  .TP

Modified: head/net/rtg/files/patch-src-rtg.h
==============================================================================
--- head/net/rtg/files/patch-src-rtg.h	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-src-rtg.h	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- src/rtg.h.orig	2010-04-21 21:26:38.587554904 +0100
-+++ src/rtg.h	2010-04-21 21:31:40.436052227 +0100
+--- src/rtg.h.orig	2003-09-25 15:56:04 UTC
++++ src/rtg.h
 @@ -42,9 +42,7 @@
  #define DEFAULT_DB_PASS "rtgdefault"
  #define DEFAULT_SNMP_VER 1

Modified: head/net/rtg/files/patch-src-rtgplot.c
==============================================================================
--- head/net/rtg/files/patch-src-rtgplot.c	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-src-rtgplot.c	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,6 +1,6 @@
---- src/rtgplot.c.orig	2003-10-02 16:27:52.000000000 +0100
-+++ src/rtgplot.c	2010-07-04 03:45:21.927295776 +0100
-@@ -221,7 +221,10 @@
+--- src/rtgplot.c.orig	2003-10-02 15:27:52 UTC
++++ src/rtgplot.c
+@@ -221,7 +221,10 @@ int main(int argc, char **argv) {
  						plot_line(data[i][j], &img, &graph, colors->shade, TRUE);
  					else
  						plot_line(data[i][j], &img, &graph, colors->shade, FALSE);
@@ -12,7 +12,7 @@
  					plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset);
  					offset++;
  				}
-@@ -629,15 +632,15 @@
+@@ -629,15 +632,15 @@ void plot_legend(gdImagePtr * img, rate_
  	if (set.verbose >= HIGH)
  		fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__);
  
@@ -34,7 +34,7 @@
  	}
  	snprintf(string, sizeof(string), "%s", interface);
  	for (i = 0; i < (17 - strlen(interface)); i++) {
-@@ -662,7 +665,7 @@
+@@ -662,7 +665,7 @@ void plot_legend(gdImagePtr * img, rate_
  			units(rate.cur, cur), graph->units,
  			units((float)rate.total, total));
  	}
@@ -43,7 +43,7 @@
  		      BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]);
  }
  
-@@ -866,6 +869,13 @@
+@@ -866,6 +869,13 @@ void plot_labels(gdImagePtr * img, graph
  	title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2));
  	snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION);
  	gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]);
@@ -57,7 +57,7 @@
  }
  
  
-@@ -1342,10 +1352,14 @@
+@@ -1342,10 +1352,14 @@ void parseWeb(arguments_t *arguments, gr
  			}
  		}
  /* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */

Modified: head/net/rtg/files/patch-src-rtgpoll.c
==============================================================================
--- head/net/rtg/files/patch-src-rtgpoll.c	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/patch-src-rtgpoll.c	Wed Oct 26 07:01:15 2016	(r424678)
@@ -1,5 +1,5 @@
---- src/rtgpoll.c.orig	2010-04-21 21:24:13.686718318 +0100
-+++ src/rtgpoll.c	2010-04-21 21:33:53.755065067 +0100
+--- src/rtgpoll.c.orig	2003-09-25 15:56:04 UTC
++++ src/rtgpoll.c
 @@ -13,6 +13,7 @@
  stats_t stats =
  {PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
@@ -8,7 +8,7 @@
  target_t *current = NULL;
  MYSQL mysql;
  int entries = 0;
-@@ -41,7 +42,7 @@
+@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
      config_defaults(&set);
  
      /* Parse the command-line. */
@@ -17,7 +17,7 @@
  	switch ((char) ch) {
  	case 'c':
  	    conf_file = optarg;
-@@ -55,6 +56,9 @@
+@@ -55,6 +56,9 @@ int main(int argc, char *argv[]) {
  	case 'm':
  	    set.multiple++;
  	    break;
@@ -27,7 +27,7 @@
  	case 't':
  	    target_file = optarg;
  	    break;
-@@ -66,6 +70,9 @@
+@@ -66,6 +70,9 @@ int main(int argc, char *argv[]) {
  	    break;
  	}
  
@@ -37,7 +37,7 @@
      if (set.verbose >= LOW)
  	printf("RTG version %s starting.\n", VERSION);
  
-@@ -78,7 +85,7 @@
+@@ -78,7 +85,7 @@ int main(int argc, char *argv[]) {
      sigaddset(&signal_set, SIGINT);
      sigaddset(&signal_set, SIGQUIT);
  	if (!set.multiple) 
@@ -46,7 +46,7 @@
  
      if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
  	printf("pthread_sigmask error\n");
-@@ -244,7 +251,7 @@
+@@ -244,7 +251,7 @@ void *sig_handler(void *arg)
                  if (set.verbose >= LOW)
                     printf("Quiting: received signal %d.\n", sig_number);
                  rtg_dbdisconnect(&mysql);
@@ -55,7 +55,7 @@
                  exit(1);
                  break;
          }
-@@ -259,6 +266,7 @@
+@@ -259,6 +266,7 @@ void usage(char *prog)
      printf("\nOptions:\n");
      printf("  -c <file>   Specify configuration file\n");
      printf("  -d          Disable database inserts\n");

Modified: head/net/rtg/files/rtgpoll.in
==============================================================================
--- head/net/rtg/files/rtgpoll.in	Wed Oct 26 05:51:06 2016	(r424677)
+++ head/net/rtg/files/rtgpoll.in	Wed Oct 26 07:01:15 2016	(r424678)
@@ -21,7 +21,8 @@
 name="rtgpoll"
 rcvar=rtgpoll_enable
 
-command=%%PREFIX%%/bin/${name}
+cmd=%%PREFIX%%/bin/${name}
+command="/usr/sbin/daemon"
 
 load_rc_config $name
 
@@ -29,10 +30,25 @@ load_rc_config $name
 : ${rtgpoll_config="%%PREFIX%%/etc/rtg/rtg.conf"}
 : ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"}
 : ${rtgpoll_pidfile="/var/run/${name}.pid"}
+: ${rtgpoll_user="rtg"}
+: ${rtgpoll_group="rtg"}
 
 required_files="$rtgpoll_targets"
 
-command_args="-p $rtgpoll_pidfile -c $rtgpoll_config -t $rtgpoll_targets &"
+command_args="-f -p $rtgpoll_pidfile $cmd -c $rtgpoll_config -t $rtgpoll_targets"
+
+start_precmd="rtgpoll_prestart"
+
+rtgpoll_prestart() {
+  if [ ! -e "${rtgpoll_pidfile}" ]; then
+	touch $rtgpoll_pidfile
+  fi
+
+  chown "${rtgpoll_user}:${rtgpoll_group}" "$rtgpoll_pidfile"
+  chmod 640 "$rtgpoll_pidfile"
+  chown -R "${rtgpoll_user}:${rtgpoll_group}" "%%PREFIX%%/etc/rtg"
+  chmod -R u+rwX,g+rX "%%PREFIX%%/etc/rtg"
+}
 
 run_rc_command "$1"
 


More information about the svn-ports-all mailing list