Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2013 22:26:43 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r337303 - in head/ports-mgmt/portaudit: . files
Message-ID:  <201312232226.rBNMQhn4074007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Dec 23 22:26:43 2013
New Revision: 337303
URL: http://svnweb.freebsd.org/changeset/ports/337303

Log:
  Detect pkgNG.  When pkgNG is present and there is packages managed by pkgNG,
  give user a warning and run pkg audit -F instead.
  
  PR:		ports/185147
  Submitted by:	ohauer

Modified:
  head/ports-mgmt/portaudit/Makefile
  head/ports-mgmt/portaudit/files/portaudit-cmd.sh

Modified: head/ports-mgmt/portaudit/Makefile
==============================================================================
--- head/ports-mgmt/portaudit/Makefile	Mon Dec 23 22:04:06 2013	(r337302)
+++ head/ports-mgmt/portaudit/Makefile	Mon Dec 23 22:26:43 2013	(r337303)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	portaudit
-PORTVERSION=	0.6.1
+PORTVERSION=	0.6.2
 CATEGORIES=	ports-mgmt security
 DISTFILES=
 

Modified: head/ports-mgmt/portaudit/files/portaudit-cmd.sh
==============================================================================
--- head/ports-mgmt/portaudit/files/portaudit-cmd.sh	Mon Dec 23 22:04:06 2013	(r337302)
+++ head/ports-mgmt/portaudit/files/portaudit-cmd.sh	Mon Dec 23 22:26:43 2013	(r337303)
@@ -53,6 +53,10 @@ portaudit_confs()
 
 	: ${portaudit_fixed=""}
 	: ${portaudit_openssl:="/usr/bin/openssl"}
+
+	# check if new pkg tools are in use
+	: ${pkgng_db:="/var/db/pkg/local.sqlite"}
+	: ${PKGSTATIC:="%%PREFIX%%/sbin/pkg-static"}
 }
 
 extract_auditfile_raw()
@@ -438,6 +442,20 @@ if $opt_version; then
 	echo "portaudit version %%PORTVERSION%%"
 fi
 
+if [ -e ${pkgng_db} -a -x ${PKGSTATIC} ]; then
+	IPKGNG=`echo 'SELECT COUNT() FROM packages;' | $PKGSTATIC shell`
+	if [ ${IPKGNG} -ge 1 ]; then
+		echo "New pkg tools detected: found ${IPKGNG} installed packages."
+		echo
+		echo "The portaudit tool is now obsolete, please remove portaudit and use the"
+		echo "command 'pkg audit' instead.  See man pkg-audit(8) for more information."
+		echo
+		echo "Running ${PKGSTATIC} audit -F:"
+		${PKGSTATIC} audit -F
+		exit 1
+	fi
+fi
+
 if $opt_fetch; then
 	if $opt_quiet ; then
 		portaudit_fetch_cmd="${portaudit_fetch_cmd} -q"



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