From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Feb 17 02:00:01 2014 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CDDDC22 for ; Mon, 17 Feb 2014 02:00:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6C4C61339 for ; Mon, 17 Feb 2014 02:00:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s1H201Xw041326 for ; Mon, 17 Feb 2014 02:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s1H201Rp041325; Mon, 17 Feb 2014 02:00:01 GMT (envelope-from gnats) Date: Mon, 17 Feb 2014 02:00:01 GMT Message-Id: <201402170200.s1H201Rp041325@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org Cc: From: Ryan Frederick Subject: Re: ports/184011: Patch for Preliminary pkgng Support in net-mgmt/nagios-check_ports X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Ryan Frederick List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Feb 2014 02:00:01 -0000 The following reply was made to PR ports/184011; it has been noted by GNATS. From: Ryan Frederick To: bug-followup@FreeBSD.org, ryanrfrederick@gmail.com Cc: Subject: Re: ports/184011: Patch for Preliminary pkgng Support in net-mgmt/nagios-check_ports Date: Sun, 16 Feb 2014 19:56:06 -0600 This is a multi-part message in MIME format. --------------020205030700040805070109 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I found a bug in the original patch. Attached is an updated patch. --------------020205030700040805070109 Content-Type: text/plain; charset=UTF-8; name="patch-nagios-check_ports.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-nagios-check_ports.txt" diff -ruN nagios-check_ports.old/Makefile nagios-check_ports/Makefile --- nagios-check_ports.old/Makefile 2013-09-20 17:24:43.000000000 -0500 +++ nagios-check_ports/Makefile 2013-11-15 13:39:10.552788000 -0600 @@ -11,13 +11,15 @@ MAINTAINER= freebsd@troback.com COMMENT= Nagios Plugin to monitor your FreeBSD Ports -RUN_DEPENDS= portaudit:${PORTSDIR}/ports-mgmt/portaudit - NO_BUILD= yes - NO_STAGE= yes + .include +.if ${OSVERSION} < 1000000 +RUN_DEPENDS= portaudit:${PORTSDIR}/ports-mgmt/portaudit +.endif + do-install: @${MKDIR} ${PREFIX}/libexec/nagios ${INSTALL_SCRIPT} ${WRKSRC}/check_ports ${PREFIX}/libexec/nagios/ diff -ruN nagios-check_ports.old/files/patch-check_ports nagios-check_ports/files/patch-check_ports --- nagios-check_ports.old/files/patch-check_ports 2012-07-14 09:29:18.000000000 -0500 +++ nagios-check_ports/files/patch-check_ports 2013-11-15 15:26:14.322618000 -0600 @@ -1,11 +1,12 @@ ---- check_ports 2011-08-23 07:01:14.000000000 +0000 -+++ check_ports 2011-08-24 02:32:14.000000000 +0000 -@@ -30,20 +30,15 @@ +--- check_ports 2009-03-10 03:46:27.000000000 -0500 ++++ check_ports 2013-11-15 15:12:09.554760492 -0600 +@@ -30,20 +30,16 @@ # # please change locations appropriate -PORTAUDIT=/usr/local/sbin/portaudit PKG_VERSION=/usr/sbin/pkg_version ++PKG=/usr/sbin/pkg JEXEC=/usr/sbin/jexec JLS=/usr/sbin/jls -PORTDIR=/usr/ports @@ -22,7 +23,15 @@ VERSION=0.6.1 DATE="10 Mar 2009" PROJECTURL=http://code.adminlife.net/check_ports -@@ -68,7 +63,7 @@ +@@ -56,6 +52,7 @@ + PORTSAGE=0 + UPDATES=0 + PKGVERSION_OPTS="-Ivl "\<"" ++PKG_OPTS="version -Ivl "\<"" + + ###### functions ###### + +@@ -68,7 +65,7 @@ # print help msg and exit print_help() { @@ -31,23 +40,119 @@ printf "options:\n" printf " -h\t\tshow this help message and exit.\n\n" printf " -a\t\tshows if any updates are available.\n" -@@ -82,7 +77,9 @@ +@@ -82,7 +79,12 @@ printf " \t\tHighly recommended before first run.\n\n" printf " -u \t\trun check_ports in unprivileged mode.\n" printf " \t\tMuch slower but more secure.\n\n" - printf " -v\t\tshow version number.\n" + printf " -v\t\tshow version number.\n\n" + printf " -I \tPath to INDEX file.\n\n" -+ printf " -P \tPath to portaudit.\n" ++ if [ ${RELEASE} -lt 10] ++ then ++ printf " -P \tPath to portaudit.\n" ++ fi exit 0 } -@@ -254,13 +251,13 @@ +@@ -128,6 +130,16 @@ + fi + } + ++# pkg accessible? ++check_pkg() { ++ if [ -x ${PKG} ] ++ then ++ return 0 ++ else ++ return 1 ++ fi ++} ++ + # jexec accessible? + check_jexec() { + if [ -x ${JEXEC} ] +@@ -172,21 +184,42 @@ + printf " OK: Your operating system is FreeBSD, main release ${RELEASE}.\n" + fi + +- check_portaudit +- if [ $? -eq 1 ] ++ if [ ${RELEASE} -lt 10 ] + then +- printf " ERROR: portaudit not found!\n" +- else +- printf " OK: portaudit found at ${PORTAUDIT}\n" +- fi ++ check_portaudit ++ if [ $? -eq 1 ] ++ then ++ printf " ERROR: portaudit not found!\n" ++ else ++ printf " OK: portaudit found at ${PORTAUDIT}\n" ++ fi + +- check_pkg_version +- if [ $? -eq 1 ] +- then +- printf " ERROR: pkg_version not found at ${PKG_VERSION}.\n" +- printf " Update information will not be available!\n" ++ check_pkg_version ++ if [ $? -eq 1 ] ++ then ++ printf " ERROR: pkg_version not found at ${PKG_VERSION}.\n" ++ printf " Update information will not be available!\n" ++ else ++ printf " OK: pkg_version found at ${PKG_VERSION}\n" ++ fi ++ ++ check_portaudit_db ++ PORTAUDIT_DB_DATE=$(${PORTAUDIT} -d | awk -F ": " '{print $2}') ++ if [ $? -eq 1 ] ++ then ++ printf " ERROR: portaudit database too old (Last Update: ${PORTAUDIT_DB_DATE}) - update with portaudit -F\n" ++ else ++ printf " OK: portaudit database is up to date (Last Update: ${PORTAUDIT_DB_DATE}).\n" ++ fi + else +- printf " OK: pkg_version found at ${PKG_VERSION}\n" ++ check_pkg ++ if [ $? -eq 1 ] ++ then ++ printf " ERROR: pkg not found at ${PKG}.\n" ++ printf " Update and security information will not be available!\n" ++ else ++ printf " OK: pkg found at ${PKG}\n" ++ fi + fi + + check_jexec +@@ -197,15 +230,6 @@ + printf " OK: jexec found at ${JEXEC}\n" + fi + +- check_portaudit_db +- PORTAUDIT_DB_DATE=$(${PORTAUDIT} -d | awk -F ": " '{print $2}') +- if [ $? -eq 1 ] +- then +- printf " ERROR: portaudit database too old (Last Update: ${PORTAUDIT_DB_DATE}) - update with portaudit -F\n" +- else +- printf " OK: portaudit database is up to date (Last Update: ${PORTAUDIT_DB_DATE}).\n" +- fi +- + check_portindex + if [ $? -eq 1 ] + then +@@ -254,24 +278,34 @@ # count lines from portversion if asked if [ ${ANY_UPDATE} -eq 1 -o ${WARN_ON_ANY_UPDATE} -eq 1 ] then - UPDATES=$(${PKG_VERSION} ${PKGVERSION_OPTS} | grep -c "needs updating" -) -+ UPDATES=$(${PKG_VERSION} ${PKGVERSION_OPTS} ${PORTINDEX} | grep -c "needs updating") ++ if [ ${RELEASE} -lt 10 ] ++ then ++ UPDATES=$(${PKG_VERSION} ${PKGVERSION_OPTS} ${PORTINDEX} | grep -c "needs updating") ++ else ++ UPDATES=$(${PKG} ${PKG_OPTS} ${PORTINDEX} | grep -c "needs updating") ++ fi fi # count lines from find @@ -58,12 +163,47 @@ fi # count lines from portaudit -@@ -291,13 +288,13 @@ +- PROBLEMS=$(${PORTAUDIT} | grep "problem(s) in your installed packages found." | awk '{ print $1 }') ++ if [ ${RELEASE} -lt 10 ] ++ then ++ PROBLEMS=$(${PORTAUDIT} | grep "problem(s) in your installed packages found." | awk '{ print $1 }') ++ else ++ PROBLEMS=$(${PKG} audit | grep "problem(s) in the installed packages found." | awk '{ print $1 }') ++ fi + + run_gen_state + } + + # main function for use in jails + run_main_jail() { +- if [ ${UNPRIV_MODE} -eq 1 ] ++ if [ ${UNPRIV_MODE} -eq 1 -a ${RELEASE} -lt 10 ] + then + mkdir ${TMP_PATH} >/dev/null 2>&1 + ls -1 ${JAIL_PATH}/var/db/pkg/ > ${TMP_PATH}/${JAIL} 2>/dev/null +@@ -285,19 +319,29 @@ + print_state "only root can execute jail checks - users should use -u mode" "3" + else + # count lines from portaudit +- PROBLEMS=$(${JEXEC} ${JID} ${PORTAUDIT} | grep "problem(s) in your installed packages found." | awk '{ print $1 }') ++ if [ ${RELEASE} -lt 10 ] ++ then ++ PROBLEMS=$(${JEXEC} ${JID} ${PORTAUDIT} | grep "problem(s) in your installed packages found." | awk '{ print $1 }') ++ else ++ PROBLEMS=$(${PKG} -j ${JID} audit | grep "problem(s) in the installed packages found." | awk '{ print $1 }') ++ fi + fi + fi # count lines from pkg_version if asked and set PKG_DBDIR if [ ${ANY_UPDATE} -eq 1 -o ${WARN_ON_ANY_UPDATE} -eq 1 ] then - UPDATES=$(PKG_DBDIR=${JAIL_PATH}/var/db/pkg ${PKG_VERSION} ${PKGVERSION_OPTS} | grep -c "needs updating" -) -+ UPDATES=$(PKG_DBDIR=${JAIL_PATH}/var/db/pkg ${PKG_VERSION} ${PKGVERSION_OPTS} ${JAIL_PATH}${PORTINDEX} | grep -c "needs updating") ++ if [ ${RELEASE} -lt 10 ] ++ then ++ UPDATES=$(PKG_DBDIR=${JAIL_PATH}/var/db/pkg ${PKG_VERSION} ${PKGVERSION_OPTS} ${JAIL_PATH}${PORTINDEX} | grep -c "needs updating") ++ else ++ UPDATES=$(${PKG} -j ${JID} ${PKG_OPTS} ${JAIL_PATH}${PORTINDEX} | grep -c "needs updating") ++ fi fi # count lines from find @@ -74,7 +214,7 @@ fi run_gen_state -@@ -305,12 +302,14 @@ +@@ -305,12 +349,14 @@ ###### main ###### @@ -91,7 +231,7 @@ r) ;; # parameter -r is now obsolete, we don't use portversion anymore a) ANY_UPDATE=1;; w) WARN_ON_ANY_UPDATE=1;; -@@ -321,6 +320,14 @@ +@@ -321,6 +367,14 @@ esac done --------------020205030700040805070109--