Date: Sun, 18 May 2014 01:03:52 GMT From: Tassilo Philipp <tphilipp@potion-studios.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/189904: new port: net-mgmt/guifi-snpservices Message-ID: <201405180103.s4I13qgG021377@cgiserv.freebsd.org> Resent-Message-ID: <201405180110.s4I1A0wb001236@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 189904 >Category: misc >Synopsis: new port: net-mgmt/guifi-snpservices >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 18 01:10:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Tassilo Philipp >Release: >Organization: >Environment: >Description: >How-To-Repeat: >Fix: Patch attached with submission follows: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # guifi-snpservices # guifi-snpservices/distinfo # guifi-snpservices/Makefile # guifi-snpservices/files # guifi-snpservices/files/patch-common-config.php.template # guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php # guifi-snpservices/files/patch-index.php # guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php # guifi-snpservices/files/patch-common-refresh_cnml.php # guifi-snpservices/files/patch-common-refresh_mrtg.php # guifi-snpservices/files/patch-common-qnodes.php # guifi-snpservices/files/patch-common-misc.php # guifi-snpservices/files/patch-common-ping.sh # guifi-snpservices/files/pkg-message.in # guifi-snpservices/files/pkg-install.in # guifi-snpservices/files/pkg-deinstall.in # guifi-snpservices/pkg-descr # guifi-snpservices/pkg-plist # echo c - guifi-snpservices mkdir -p guifi-snpservices > /dev/null 2>&1 echo x - guifi-snpservices/distinfo sed 's/^X//' >guifi-snpservices/distinfo << 'ed10da94de12b7219a0df453fc339c15' XSHA256 (snpservices_0.2.2-5.tar.gz) = b08d003221d9d5ad688602a973838a0f83b1c99022a11c1ed08a520de8debb51 XSIZE (snpservices_0.2.2-5.tar.gz) = 185825 ed10da94de12b7219a0df453fc339c15 echo x - guifi-snpservices/Makefile sed 's/^X//' >guifi-snpservices/Makefile << '369990556fded9a2da53542d82a6e191' X# Created by: Tassilo Philipp <tphilipp@potion-studios.com> X# $FreeBSD$ X XPORTNAME= snpservices XDISTVERSION= 0.2.2-5 XCATEGORIES= www XMASTER_SITES= http://serveis.guifi.net/debian/guifi/ \ X http://www.potion-studios.com/ XPKGNAMEPREFIX= guifi- XDISTNAME= ${PORTNAME}_${DISTVERSION} X XMAINTAINER= tphilipp@potion-studios.com XCOMMENT= Graphics server for the guifi.net meshnet X XRUN_DEPENDS= mrtg:${PORTSDIR}/net-mgmt/mrtg \ X rrdtool:${PORTSDIR}/databases/rrdtool X XUSE_PHP= gd simplexml dom X XSNPSERVICES_RUNDIR?= /var/run/${PORTNAME} XSUB_FILES= pkg-install pkg-deinstall pkg-message XSUB_LIST= SNPSERVICES_RUNDIR=${SNPSERVICES_RUNDIR} X XWRKSRC= ${WRKDIR}/${PORTNAME}-0.2.2 XNO_BUILD= yes X Xdo-install: X ${MKDIR} ${STAGEDIR}${WWWDIR} X (cd ${WRKSRC} \ X && ${COPYTREE_SHARE} \* ${STAGEDIR}${WWWDIR}) X ${FIND} ${STAGEDIR}${WWWDIR} -type f -exec ${CHMOD} 644 '{}' + X X.include <bsd.port.mk> 369990556fded9a2da53542d82a6e191 echo c - guifi-snpservices/files mkdir -p guifi-snpservices/files > /dev/null 2>&1 echo x - guifi-snpservices/files/patch-common-config.php.template sed 's/^X//' >guifi-snpservices/files/patch-common-config.php.template << '795b5a47b8dc2db36ec4440a3c349b91' X--- common/config.php.template.orig 2014-02-21 15:53:13.000000000 +0000 X+++ common/config.php.template 2014-04-10 13:41:47.000000000 +0000 X@@ -1,10 +1,10 @@ X <?php X X // snp_pat: full directory where snp services are located X-$snp_path='/var/www/html/snpservices'; X+$snp_path='/usr/local/www/snpservices'; X X // SNPGraphServerID: Default Graph Server ID X-$SNPGraphServerId = 6579; X+$SNPGraphServerId = 67063; X X // rootZone: which is the ROOT zone X $rootZone = 3671; X@@ -15,21 +15,21 @@ X // MRTGConfigSource: mrtg csv data X // As a input, could be either a local (to be created from X // cached CNML file, or remote X-$MRTGConfigSource='http://proves.elserrat.guifi.net/snpservices/graphs/cnml2mrtgcsv.php'; X-//$MRTGConfigSource='../data/guifi_mrtg.csv'; X+$MRTGConfigSource='http://guifi.net/snpservices/graphs/cnml2mrtgcsv.php?server='.$SNPGraphServerId; X+//$MRTGConfigSource='/var/run/snpservices/data/guifi_mrtg.csv'; X X // CNMLSource: url for CNML node query, use sprintf syntax X // MySQL-drupal source X-//$CNMLSource='http://proves.elserrat.guifi.net/guifi/cnml/%s/node'; X+//$CNMLSource='http://guifi.net/guifi/cnml/%s/node'; X // Cached CNML source (prefered) X-$CNMLSource='http://proves.elserrat.guifi.net/snpservices/common/qnodes.php?nodes=%s'; X+$CNMLSource='http://guifi.net/snpservices/common/qnodes.php?nodes=%s'; X X-$CNMLData='../data/guifi.cnml'; X+$CNMLData='/var/run/snpservices/data/guifi.cnml'; X X // rrdtool parameters X-$rrdtool_path='/usr/bin/rrdtool'; X-$rrddb_path='/home1/comesfa/mrtg/logs/'; X-$rrdimg_path='/home1/comesfa/mrtg/images/'; X+$rrdtool_path='/usr/local/bin/rrdtool'; X+$rrddb_path='/var/run/snpservices/logs/'; X+$rrdimg_path='/var/run/snpservices/images/'; X X // which version does have this server? X // currently supported versions are: X@@ -38,8 +38,7 @@ X $rrdtool_version = "1.3"; X X // mrtg local header X-$rrdtool_header='# PathAdd: /usr/local/rrdtool-1.2.12/bin X-# LibAdd: /usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux-thread-multi X+$rrdtool_header='PathAdd: /usr/local/bin/ X HtmlDir: %s X ImageDir: %s X LogDir: %s X@@ -57,7 +56,7 @@ X <TR><TD>Description:</TD><TD>ping</TD></TR> X <TR><TD>IP:</TD> <TD>%s</TD></TR> X </TABLE> X-Target[%s_ping]: `/etc/mrtg/ping.sh %s` X+Target[%s_ping]: `sh '.$snp_path.'/common/ping.sh %s` X MaxBytes[%s_ping]: 2000 X Options[%s_ping]: growright,unknaszero,nopercent,gauge X LegendI[%s_ping]: Perduts % 795b5a47b8dc2db36ec4440a3c349b91 echo x - guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php sed 's/^X//' >guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php << '2edf2cf50fb15ad3cd5b856e271085c1' X--- graphs/mrtgcsv2mrtgcfg.php.orig 2014-02-21 15:53:13.000000000 +0000 X+++ graphs/mrtgcsv2mrtgcfg.php 2014-04-10 12:35:33.000000000 +0000 X@@ -1,9 +1,9 @@ X <?php X X-if (file_exists("../common/config.php")) { X- include_once("../common/config.php"); X+if (file_exists(dirname(__FILE__)."../common/config.php")) { X+ include_once(dirname(__FILE__)."../common/config.php"); X } else { X- include_once("../common/config.php.template"); X+ include_once(dirname(__FILE__)."/../common/config.php.template"); X } X X $now = time(); X@@ -57,7 +57,7 @@ X print date('Y/m/d H:i:s')."\n"; X X $hf = @fopen($MRTGConfigSource,"r") or die('Error reading MRTG csv input\n"'); X-$cf = @fopen('../data/mrtg.cfg','w+'); X+$cf = @fopen('/var/run/snpservices/data/mrtg.cfg','w+'); X X fputs($cf,sprintf($rrdtool_header,$rrdimg_path,$rrdimg_path,$rrddb_path,$rrddb_path)); X 2edf2cf50fb15ad3cd5b856e271085c1 echo x - guifi-snpservices/files/patch-index.php sed 's/^X//' >guifi-snpservices/files/patch-index.php << 'ad8874a45f303e7df6954797483824be' X--- ./index.php.orig 2012-05-11 16:46:51.000000000 -0500 X+++ ./index.php 2014-01-27 23:43:35.000000000 -0600 X@@ -5,6 +5,6 @@ X * Main call to CNML services X */ X X // Common Bootstrap X if (file_exists('common/config.php')) X include_once("common/config.php"); X@@ -91,6 +93,7 @@ X echo "Available services:\n"; X $fservices = glob('services/*.php'); X X+ $services = array(); X foreach ($fservices as $fservice) X $services[] .= basename($fservice,'.php'); X echo implode('|',$services); ad8874a45f303e7df6954797483824be echo x - guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php sed 's/^X//' >guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php << 'd1319018f1152e8caa9d8231835c9427' X--- graphs/cnml2mrtgcsv.php.orig 2014-04-10 12:35:09.000000000 +0000 X+++ graphs/cnml2mrtgcsv.php 2014-04-10 12:35:19.000000000 +0000 X@@ -267,7 +267,7 @@ X // Opening CNML source X $cnml = new DOMDocument; X $cnml->preserveWhiteSpace = false; X-$cnml->Load('../data/guifi.cnml'); X+$cnml->Load('/var/run/snpservices/data/guifi.cnml'); X $time_s = microtime(true); X //print "# file guifi.cnml loaded".($time_s - $time_start)."\n"; X d1319018f1152e8caa9d8231835c9427 echo x - guifi-snpservices/files/patch-common-refresh_cnml.php sed 's/^X//' >guifi-snpservices/files/patch-common-refresh_cnml.php << '503e1bc387e897472823ea2c4a4d977a' X--- common/refresh_cnml.php.orig 2014-04-10 12:41:40.000000000 +0000 X+++ common/refresh_cnml.php 2014-04-10 12:43:16.000000000 +0000 X@@ -27,14 +27,14 @@ X echo "Getting CNML file\n"; X $hcnml = @fopen($SNPDataServer_url."/guifi/cnml/".$rootZone."/detail", "r") X or die ('Error redaing CNML source\n'); X- $wcnml = @fopen("../data/guifi.cnml.tmp", "w"); X+ $wcnml = @fopen("/var/run/snpservices/data/guifi.cnml.tmp", "w"); X while (!feof($hcnml)) { X $buffer = fgets($hcnml, 4096); X fwrite($wcnml,$buffer); X } X fclose($hcnml); X fclose($wcnml); X- exec ("/bin/cp ../data/guifi.cnml.tmp ../data/guifi.cnml"); X+ exec ("/bin/cp /var/run/snpservices/data/guifi.cnml.tmp /var/run/snpservices/data/guifi.cnml"); X X $hlast= @fopen("/tmp/last_update.cnml", "w") or die('Error!'); X fwrite($hlast,$last_now); 503e1bc387e897472823ea2c4a4d977a echo x - guifi-snpservices/files/patch-common-refresh_mrtg.php sed 's/^X//' >guifi-snpservices/files/patch-common-refresh_mrtg.php << 'bc74c20e1732e73bd782f81d7d5c2080' X--- common/refresh_mrtg.php.orig 2014-04-10 12:44:08.000000000 +0000 X+++ common/refresh_mrtg.php 2014-04-10 12:44:27.000000000 +0000 X@@ -29,7 +29,7 @@ X X echo "Getting MRTG CSV file\n"; X $hcnml = @fopen($MRTGConfigSource, "r"); X- $wcnml = @fopen("../data/guifi_mrtg.csv", "w"); X+ $wcnml = @fopen("/var/run/snpservices/data/guifi_mrtg.csv", "w"); X while (!feof($hcnml)) { X $buffer = fgets($hcnml, 4096); X fwrite($wcnml,$buffer); bc74c20e1732e73bd782f81d7d5c2080 echo x - guifi-snpservices/files/patch-common-qnodes.php sed 's/^X//' >guifi-snpservices/files/patch-common-qnodes.php << '8fbc12eb20a6c552d3a7f04cbac830e9' X--- common/qnodes.php.orig 2014-04-10 12:44:55.000000000 +0000 X+++ common/qnodes.php 2014-04-10 12:45:28.000000000 +0000 X@@ -19,7 +19,7 @@ X // Opening CNML source X $doc = new DOMDocument; X $doc->preserveWhiteSpace = false; X-$doc->Load('../data/guifi.cnml'); X+$doc->Load('/var/run/snpservices/data/guifi.cnml'); X X // building the xpath query for requested nodes X $xpath = new DOMXPath($doc); 8fbc12eb20a6c552d3a7f04cbac830e9 echo x - guifi-snpservices/files/patch-common-misc.php sed 's/^X//' >guifi-snpservices/files/patch-common-misc.php << 'a93a525b8293a442999eeea64970e703' X--- common/misc.php.orig 2014-04-10 14:05:20.000000000 +0000 X+++ common/misc.php 2014-04-10 14:05:45.000000000 +0000 X@@ -177,7 +177,7 @@ X foreach ($an as $nc) { X $try = 0; X $xml = false; X- $fn = $prefix.'tmp/'.$nc.'.cnml'; X+ $fn = $prefix.'/var/run/snpservices/tmp/'.$nc.'.cnml'; X do { X // print " Processing $nc try $try cache: $waitcache\n<br>"; X if (file_exists($fn)) { X@@ -232,7 +232,7 @@ X if ($xml) { X $xpnxml = $xml->xpath('//node'); X foreach ($xpnxml as $nxml) { X- $fn = $prefix.'tmp/'.$nxml->attributes()->id.'.cnml'; X+ $fn = $prefix.'/var/run/snpservices/tmp/'.$nxml->attributes()->id.'.cnml'; X $wcnml = @fopen($fn, "w+") or die("\n<br>Error caching XML, can't write $fn\n"); X fwrite($wcnml,'<cnml>'.$nxml->asXML().'</cnml>'); X fclose($wcnml); a93a525b8293a442999eeea64970e703 echo x - guifi-snpservices/files/patch-common-ping.sh sed 's/^X//' >guifi-snpservices/files/patch-common-ping.sh << '958748ef81ec95b49d64295f723cfdb2' X--- ./common/ping.sh.orig 2014-02-21 15:53:13.000000000 +0000 X+++ ./common/ping.sh 2014-04-10 14:19:56.000000000 +0000 X@@ -1,15 +1,15 @@ X #!/bin/sh X- PING="/bin/ping" X+ PING="/sbin/ping" X ADDR=$1 X- DATA=`$PING -c5 -i 0.2 $ADDR -q -W 4` X+ DATA=`$PING -c 5 -i 0.2 -q -W 4 $ADDR` X LOSS=`echo $DATA | awk '{print $18 }' | tr -d %` X ERRORS=`echo $DATA | awk '{print $19 }' | tr -d %` X- if [ $ERRORS = "errors," ] X+ if [ "$ERRORS" = "errors," ] X then X LOSS=`echo $DATA | awk '{print $20 }' | tr -d %` X fi X echo $LOSS X- if [ $LOSS = 100 ]; X+ if [ "$LOSS" = 100 ]; X then X echo 0 X else 958748ef81ec95b49d64295f723cfdb2 echo x - guifi-snpservices/files/pkg-message.in sed 's/^X//' >guifi-snpservices/files/pkg-message.in << 'db54c67ab8492ca7a48693a4785d95db' X XPOST-INSTALL CONFIGURATION FOR GUIFI SNPSERVICES X------------------------------------------------ X X1) Install and/or configure a webserver of your choice to serve X php files from %%WWWDIR%%/ (you also might have to X increase your webserver's upstream timeout for certain requests X X2) Edit %%WWWDIR%%/common/config.php.template and set X $SNPGraphServerId to your service's ID (note, it's the *service*, X NOT the "server" ID) X X3) setup a cronjob to keep your graphs and stats up to date; for X example: X X*/30 * * * * root if [ -x %%WWWDIR%%/graphs ]; then cd %%WWWDIR%%/graphs; fi; if [ -x %%PREFIX%%/bin/php ] && [ -r %%WWWDIR%%/graphs/mrtgcsv2mrtgcfg.php ]; then env LANG=C %%PREFIX%%/bin/php mrtgcsv2mrtgcfg.php >> /var/log/snpservices_mrtgcfg.log 2>&1; fi X*/5 * * * * root if [ -x %%PREFIX%%/bin/mrtg ] && [ -r /var/run/snpservices/data/mrtg.cfg ]; then env LANG=C %%PREFIX%%/bin/mrtg /var/run/snpservices/data/mrtg.cfg --lock-file /var/run/mrtg/lockfile_guifi >> /var/log/snpservices_mrtg.log 2>&1; fi X X4) consider logrotating /var/log/snpservices_*.log X XFor more information, see various guifi.net doc pages, and related: X X http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas X http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas_1 X http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas_2 X http://www3.uji.es/~vrubert/guifi_linux/graph.html#slide1 X http://es.wiki.guifi.net/wiki/Monitor X http://guifi.net/ca/node/9071 X X------------------------------------------------ X db54c67ab8492ca7a48693a4785d95db echo x - guifi-snpservices/files/pkg-install.in sed 's/^X//' >guifi-snpservices/files/pkg-install.in << '0153a2dbd16526d63594ffaa2736c51b' X#!/bin/sh XCHMOD="/bin/chmod" XMKDIR="/bin/mkdir -p" X XSNPSERVICES_RUNDIR=%%SNPSERVICES_RUNDIR%% X Xcase "$2" in X XPOST-INSTALL) X if [ ! -d "${SNPSERVICES_RUNDIR}/images" ]; then X ${MKDIR} "${SNPSERVICES_RUNDIR}/images" X fi X if [ ! -d "${SNPSERVICES_RUNDIR}/logs" ]; then X ${MKDIR} "${SNPSERVICES_RUNDIR}/logs" X fi X if [ ! -d "${SNPSERVICES_RUNDIR}/data" ]; then X ${MKDIR} "${SNPSERVICES_RUNDIR}/data" X fi X if [ ! -d "${SNPSERVICES_RUNDIR}/tmp" ]; then X ${MKDIR} "$SNPSERVICES_RUNDIR" X ${MKDIR} "${SNPSERVICES_RUNDIR}/tmp" X ${CHMOD} -R a+rw ${SNPSERVICES_RUNDIR}/tmp X fi X ;; Xesac Xexit 0 0153a2dbd16526d63594ffaa2736c51b echo x - guifi-snpservices/files/pkg-deinstall.in sed 's/^X//' >guifi-snpservices/files/pkg-deinstall.in << '6f94cf7de5211c8bfca8b5a54913b9fa' X#!/bin/sh Xrm -rf %%SNPSERVICES_RUNDIR%% 6f94cf7de5211c8bfca8b5a54913b9fa echo x - guifi-snpservices/pkg-descr sed 's/^X//' >guifi-snpservices/pkg-descr << '78b7910512ea46dd2f3f42e486d0e559' XThis is the guifi.net snpservices package. X XThis software provides graph services in the context of the XSpontaneous Networklink Platform. X XUses nodexchange/cnml as a input format, and provides traffic and Xlatency/availability graphs in image format by using mrtg/rrdtool Xcollected history by simple HTTP URLs, therefore is easily Xplugable to any web application. X XWWW: http://es.wiki.guifi.net/wiki/SNPservices 78b7910512ea46dd2f3f42e486d0e559 echo x - guifi-snpservices/pkg-plist sed 's/^X//' >guifi-snpservices/pkg-plist << '3899d4a662bcbb996243347f2cd13d5b' X%%WWWDIR%%/README X%%WWWDIR%%/common/cnml2ov2.php X%%WWWDIR%%/common/config.php.template X%%WWWDIR%%/common/config.php.template.orig X%%WWWDIR%%/common/misc.php X%%WWWDIR%%/common/misc.php.orig X%%WWWDIR%%/common/mrtg.sh X%%WWWDIR%%/common/ping.sh X%%WWWDIR%%/common/ping.sh.orig X%%WWWDIR%%/common/qnodes.php X%%WWWDIR%%/common/qnodes.php.orig X%%WWWDIR%%/common/refresh.sh X%%WWWDIR%%/common/refresh_cnml.php X%%WWWDIR%%/common/refresh_cnml.php.orig X%%WWWDIR%%/common/refresh_mrtg.php X%%WWWDIR%%/common/refresh_mrtg.php.orig X%%WWWDIR%%/common/rrdtool.php X%%WWWDIR%%/debian/README.Debian X%%WWWDIR%%/debian/changelog X%%WWWDIR%%/debian/compat X%%WWWDIR%%/debian/control X%%WWWDIR%%/debian/copyright X%%WWWDIR%%/debian/cron.d X%%WWWDIR%%/debian/dirs X%%WWWDIR%%/debian/docs X%%WWWDIR%%/debian/rules X%%WWWDIR%%/debian/snpservices.1 X%%WWWDIR%%/debian/snpservices.config X%%WWWDIR%%/debian/snpservices.install X%%WWWDIR%%/debian/snpservices.logrotate X%%WWWDIR%%/debian/snpservices.manpages X%%WWWDIR%%/debian/snpservices.postinst X%%WWWDIR%%/debian/snpservices.postrm X%%WWWDIR%%/debian/snpservices.templates X%%WWWDIR%%/debian/watch.ex X%%WWWDIR%%/graphs/LICENSE.txt X%%WWWDIR%%/graphs/cnml2mrtgcsv.php X%%WWWDIR%%/graphs/cnml2mrtgcsv.php.orig X%%WWWDIR%%/graphs/config.php X%%WWWDIR%%/graphs/graphs.php X%%WWWDIR%%/graphs/mrtgcsv2mrtgcfg.php X%%WWWDIR%%/graphs/mrtgcsv2mrtgcfg.php.orig X%%WWWDIR%%/graphs/refresh.php X%%WWWDIR%%/index.php X%%WWWDIR%%/index.php.orig X%%WWWDIR%%/misc/xml2ov2.php X%%WWWDIR%%/services/availability.php X%%WWWDIR%%/services/example.php X%%WWWDIR%%/services/graph.php X%%WWWDIR%%/services/liveping.php X%%WWWDIR%%/services/livetraceroute.php X%%WWWDIR%%/services/stats.php X%%WWWDIR%%/tools/guinux/config.php.guinux X%%WWWDIR%%/tools/guinux/snpconfig.pl X%%WWWDIR%%/tools/guinux/snpservices.conf X@dirrmtry %%WWWDIR%%/tools/guinux X@dirrmtry %%WWWDIR%%/tools X@dirrmtry %%WWWDIR%%/services X@dirrmtry %%WWWDIR%%/misc X@dirrmtry %%WWWDIR%%/graphs X@dirrmtry %%WWWDIR%%/debian X@dirrmtry %%WWWDIR%%/common X@dirrmtry %%WWWDIR%% 3899d4a662bcbb996243347f2cd13d5b exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405180103.s4I13qgG021377>