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
This commit is contained in:
Xin LI 2013-12-23 22:26:43 +00:00
parent 0f731ff867
commit 322e0e3478
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=337303
2 changed files with 19 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= portaudit
PORTVERSION= 0.6.1
PORTVERSION= 0.6.2
CATEGORIES= ports-mgmt security
DISTFILES=

View File

@ -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"