Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2019 18:16:34 +0000 (UTC)
From:      Guido Falsi <madpilot@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r490396 - in head/net/ntopng: . files
Message-ID:  <201901151816.x0FIGYdH019503@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: madpilot
Date: Tue Jan 15 18:16:34 2019
New Revision: 490396
URL: https://svnweb.freebsd.org/changeset/ports/490396

Log:
  - Update ntopng to latest upstream snapshot
  - Enable again IP geolocation by using the maxminddb. Rename script
    which downloads the data to reflect the change

Added:
  head/net/ntopng/files/ntopng-geoip2update.sh.in
     - copied, changed from r490395, head/net/ntopng/files/ntopng-geoipupdate.sh.in
Deleted:
  head/net/ntopng/files/ntopng-geoipupdate.sh.in
Modified:
  head/net/ntopng/Makefile
  head/net/ntopng/distinfo
  head/net/ntopng/files/pkg-deinstall.in
  head/net/ntopng/pkg-message
  head/net/ntopng/pkg-plist

Modified: head/net/ntopng/Makefile
==============================================================================
--- head/net/ntopng/Makefile	Tue Jan 15 18:06:50 2019	(r490395)
+++ head/net/ntopng/Makefile	Tue Jan 15 18:16:34 2019	(r490396)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	ntopng
-PORTVERSION=	3.8.d20181221
-PORTREVISION=	2
+PORTVERSION=	3.8.d20190111
 PORTEPOCH=	1
 CATEGORIES=	net
 
@@ -25,7 +24,7 @@ BUILD_DEPENDS=  bash:shells/bash
 USES=		autoreconf compiler:c++11-lang cpe gmake libtool localbase \
 		mysql pathfix pkgconfig shebangfix sqlite ssl
 
-SUB_FILES=	pkg-deinstall
+SUB_FILES=	ntopng-geoip2update.sh pkg-deinstall
 SHEBANG_FILES=	httpdocs/misc/ntopng-add-user.sh \
 		httpdocs/misc/ntopng-utils-manage-config.in
 GNU_CONFIGURE=	yes
@@ -37,11 +36,11 @@ PLIST_SUB=	NTOPNGUSER="${USERS}" NTOPNGROUP="${GROUPS}
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	ntop
-GH_TAGNAME=	e7503c7
+GH_TAGNAME=	3c2d3bf
 
 CPE_VENDOR=	ntop
 
-OPTIONS_DEFINE=		NLS
+OPTIONS_DEFINE=	NLS
 
 OPTIONS_SUB=	yes
 
@@ -57,5 +56,6 @@ post-patch:
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/ntopng
 	${MKDIR} ${STAGEDIR}/var/db/ntopng
+	${INSTALL_SCRIPT} ${WRKDIR}/ntopng-geoip2update.sh ${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>

Modified: head/net/ntopng/distinfo
==============================================================================
--- head/net/ntopng/distinfo	Tue Jan 15 18:06:50 2019	(r490395)
+++ head/net/ntopng/distinfo	Tue Jan 15 18:16:34 2019	(r490396)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1545486562
-SHA256 (ntop-ntopng-3.8.d20181221-e7503c7_GH0.tar.gz) = 24513419f03079f6e1dbe2f8971094f8686443e73a0ae752c88fdbac41673c5d
-SIZE (ntop-ntopng-3.8.d20181221-e7503c7_GH0.tar.gz) = 33912235
+TIMESTAMP = 1547564923
+SHA256 (ntop-ntopng-3.8.d20190111-3c2d3bf_GH0.tar.gz) = 1da7581a66fdd405574d0f914ed319c90d15c6e7886e14973c32ebc6ba0b35d1
+SIZE (ntop-ntopng-3.8.d20190111-3c2d3bf_GH0.tar.gz) = 33912860

Copied and modified: head/net/ntopng/files/ntopng-geoip2update.sh.in (from r490395, head/net/ntopng/files/ntopng-geoipupdate.sh.in)
==============================================================================
--- head/net/ntopng/files/ntopng-geoipupdate.sh.in	Tue Jan 15 18:06:50 2019	(r490395, copy source)
+++ head/net/ntopng/files/ntopng-geoip2update.sh.in	Tue Jan 15 18:16:34 2019	(r490396)
@@ -3,37 +3,42 @@
 set -eu
 mkdir -p "%%DATADIR%%/httpdocs/geoip"
 
+TEMPDIR="$(mktemp -d "%%DATADIR%%/httpdocs/geoip/MMDB-XXXXXX")"
+trap 'rc=$? ; set +e ; rm -rf "'"$TEMPDIR"'" ; exit $rc' 0
+
+cd "${TEMPDIR}"
+
 # arguments:
 # $1 URL
-# $2 output file name
-_fetch() {
-    url="$1"
-    out="$2"
-    TEMPFILE="$(mktemp "%%DATADIR%%/httpdocs/geoip/GeoIP.dat-XXXXXX")"
-    trap 'rc=$? ; set +e ; rm -f "'"$TEMPFILE"'" ; exit $rc' 0
-    if fetch -o - "$url" | gunzip >> "$TEMPFILE" ; then
-	chmod 444 "$TEMPFILE"
-	if ! mv -f "$TEMPFILE" "%%DATADIR%%/httpdocs/geoip/$2" ; then
-	    echo "Unable to replace %%DATADIR%%/httpdocs/geoip/$2"
-	    return 2
+# $2 filename
+_fetchextract() {
+	url="$1"
+	file="$(basename "${url}")"
+
+	if fetch "${url}"; then
+		tar xzf "${file}"
+	else
+		echo "${file} download failed"
+		return 1
 	fi
-    else
-	echo "$2 download failed"
-	return 1
-    fi
-    rm -f "$TEMPFILE"
-    trap - 0
-    return 0
+
+	return 0
 }
 
-echo Fetching GeoLiteCity.dat...
-_fetch "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" GeoLiteCity.dat
+echo Fetching GeoLite2-City
+_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz' 
 
-echo Fetching GeoLiteCityv6.dat...
-_fetch "http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz" GeoLiteCityv6.dat
+echo Fetching GeoLite2-ASN
+_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz'
 
-echo Fetching GeoIPASNum.dat...
-_fetch "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz" GeoIPASNum.dat.gz
+mv GeoLite2-*/*.mmdb %%DATADIR%%/httpdocs/geoip
 
-echo Fetching GeoIPASNumv6.dat...
-_fetch "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz" GeoIPASNumv6.dat.gz
+cd %%DATADIR%%/httpdocs/geoip
+rm -rf "${TEMPDIR}"
+
+chown root:wheel *.mmdb
+chmod 444 *.mmdb
+
+trap - 0
+
+return 0

Modified: head/net/ntopng/files/pkg-deinstall.in
==============================================================================
--- head/net/ntopng/files/pkg-deinstall.in	Tue Jan 15 18:06:50 2019	(r490395)
+++ head/net/ntopng/files/pkg-deinstall.in	Tue Jan 15 18:16:34 2019	(r490396)
@@ -4,8 +4,6 @@
 
 [ "$2" != "DEINSTALL" ] && exit 0
 
-[ -f "%%DATADIR%%/httpdocs/geoip/GeoLiteCity.dat" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLiteCity.dat"
-[ -f "%%DATADIR%%/httpdocs/geoip/GeoLiteCityv6.dat" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLiteCityv6.dat"
-[ -f "%%DATADIR%%/httpdocs/geoip/GeoIPASNum.dat.gz" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoIPASNum.dat.gz"
-[ -f "%%DATADIR%%/httpdocs/geoip/GeoIPASNumv6.dat.gz" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoIPASNumv6.dat.gz"
+[ -f "%%DATADIR%%/httpdocs/geoip/GeoLite2-City.mmdb" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLite2-City.mmdb"
+[ -f "%%DATADIR%%/httpdocs/geoip/GeoLite2-ASN.mmdb" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLite2-ASN.mmdb"
 [ -d "%%DATADIR%%/httpdocs/geoip" ] && /usr/bin/find "%%DATADIR%%/httpdocs/geoip" -type d -empty -delete

Modified: head/net/ntopng/pkg-message
==============================================================================
--- head/net/ntopng/pkg-message	Tue Jan 15 18:06:50 2019	(r490395)
+++ head/net/ntopng/pkg-message	Tue Jan 15 18:16:34 2019	(r490396)
@@ -8,8 +8,9 @@ ntopng requires to connect to a redis server to work. 
 server from databases/redis or use -r option via ntopng_flags to specify a
 remote one.
 
-If you enabled GeoIP support(the default), please use ntopng-geoipupdate.sh
-to update GeoIP database to the latest available data.
+ntopng supports IP geolocation, to enable this you should use the
+ntopng-geoip2update.sh script to update the maxminddb geolocation
+data to the latest version.
 
 To pass a configuration file to ntopng, which overrides any command
 line arguments, add something like the following to rc.conf:

Modified: head/net/ntopng/pkg-plist
==============================================================================
--- head/net/ntopng/pkg-plist	Tue Jan 15 18:06:50 2019	(r490395)
+++ head/net/ntopng/pkg-plist	Tue Jan 15 18:16:34 2019	(r490396)
@@ -1,4 +1,5 @@
 bin/ntopng
+bin/ntopng-geoip2update.sh
 man/man8/ntopng.8.gz
 %%DATADIR%%/httpdocs/bootstrap/css/bootstrap-theme.css
 %%DATADIR%%/httpdocs/bootstrap/css/bootstrap-theme.css.map



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901151816.x0FIGYdH019503>