Patch based off of revision 434135

Fix configuration paths in CGIs and reports to include /usr/local/etc/rtg.
Affects common.php, reports.pl, and 95.pl.  This will fix the CGIs to almost work out of the box.

Improve rtgtargmkr.pl to skip unresponsive routers rather than dying.

Add USES=ssl

PR:		217108
Submitted by:	andrew.fengler@scaleengine.com
Approved by:	maintainer timeout (15 days)
This commit is contained in:
Matthew Seaman 2017-04-11 07:17:49 +00:00
parent 68a934e72b
commit c55efc3c51
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=438250
5 changed files with 62 additions and 3 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= rtg
PORTVERSION= 0.7.4
PORTREVISION= 13
PORTREVISION= 14
CATEGORIES= net
MASTER_SITES= SF \
ftp://ftpmirror.uk/freebsd-ports/rtg/
@ -19,7 +19,7 @@ RUN_DEPENDS= p5-DBI>=0:databases/p5-DBI \
USE_RC_SUBR= rtgpoll
WANT_PERL= yes
USES= shebangfix mysql:client
USES= shebangfix mysql:client ssl
SHEBANG_FILES= etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
SUB_FILES= pkg-message
GNU_CONFIGURE= yes
@ -46,5 +46,8 @@ LDFLAGS+= -fstack-protector
post-patch:
@${MV} ${WRKSRC}/etc/rtg.conf ${WRKSRC}/etc/rtg.conf.sample
@${MV} ${WRKSRC}/etc/routers ${WRKSRC}/etc/routers.sample
@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/etc/95.pl
@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/etc/report.pl
@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/etc/common.php.in
.include <bsd.port.mk>

View file

@ -1,4 +1,4 @@
--- etc/rtgtargmkr.pl.in.orig 2016-10-25 16:28:59 UTC
--- etc/rtgtargmkr.pl.in.orig 2016-11-04 16:36:53 UTC
+++ etc/rtgtargmkr.pl.in
@@ -126,7 +126,7 @@ sub find_router_id {
&sql_insert($sql);
@ -9,3 +9,21 @@
&sql_insert($sql);
}
}
@@ -289,7 +289,7 @@ sub main {
$year + 1900, $hour, $min;
print CFG "# Host\tOID\tBits\tCommunity\tTable\tID\tDescription\n";
- foreach $router (@routers) {
+ POKE: foreach $router (@routers) {
$bits = $counterBits{$router};
# Sanity check bits
$bits = $defbits if ( ( $bits != 32 ) && ( $bits != 64 ) );
@@ -304,7 +304,7 @@ sub main {
$system = join ( ' ', @result );
print "System: $system\n" if $DEBUG;
$session = SNMP_Session->open( $router, $communities{$router}, 161 )
- || die "Error opening SNMP session to $router";
+ || ( print "Error opening SNMP session to $router" and next POKE );
if ( $system =~ /.*Cisco.*WS-.*/ ) {
$system = "Catalyst";
$session->map_table( $catalyst, \&process );

View file

@ -0,0 +1,11 @@
--- etc/95.pl.orig 2016-11-04 16:36:01 UTC
+++ etc/95.pl
@@ -31,7 +31,7 @@ $pass="rtgdefault";
$onedaysec=60*60*24;
# Default locations to find RTG configuration file
-@configs = ("rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
+@configs = ("rtg.conf", "%%PREFIX%%/etc/rtg/rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
foreach $conf (@configs) {
if (open CONF, "<$conf") {
print "Reading [$conf].\n" if $DEBUG;

View file

@ -0,0 +1,16 @@
--- etc/common.php.in.orig 2003-09-26 15:52:29 UTC
+++ etc/common.php.in
@@ -6,10 +6,13 @@
$pass="rtgdefault";
$db="rtg";
$refresh=300;
+
+ date_default_timezone_set ( 'UTC' );
/* Default locations to find RTG configuration file */
$configs[] = 'rtg.conf';
$configs[] = '@RTG_HOME@/etc/rtg.conf';
+ $configs[] = '%%PREFIX%%/etc/rtg/rtg.conf';
$configs[] = '/usr/local/rtg/etc/rtg.conf';
$configs[] = '/etc/rtg.conf';

View file

@ -0,0 +1,11 @@
--- etc/report.pl.orig 2016-11-04 16:36:08 UTC
+++ etc/report.pl
@@ -30,7 +30,7 @@ $pass="rtgdefault";
$onedaysec=60*60*24;
# Default locations to find RTG configuration file
-@configs = ("rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
+@configs = ("rtg.conf", "%%PREFIX%%/etc/rtg/rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
foreach $conf (@configs) {
if (open CONF, "<$conf") {
print "Reading [$conf].\n" if $DEBUG;