aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net-mgmt/nagios-check_ports/Makefile1
-rw-r--r--net-mgmt/nagios-check_ports/files/patch-check_ports108
2 files changed, 109 insertions, 0 deletions
diff --git a/net-mgmt/nagios-check_ports/Makefile b/net-mgmt/nagios-check_ports/Makefile
index d5304e705134..e43d687f7909 100644
--- a/net-mgmt/nagios-check_ports/Makefile
+++ b/net-mgmt/nagios-check_ports/Makefile
@@ -7,6 +7,7 @@
PORTNAME= check_ports
PORTVERSION= 0.6.1
+PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= http://code.adminlife.net/check_ports/files/
PKGNAMEPREFIX= nagios-
diff --git a/net-mgmt/nagios-check_ports/files/patch-check_ports b/net-mgmt/nagios-check_ports/files/patch-check_ports
new file mode 100644
index 000000000000..5574d07ff03c
--- /dev/null
+++ b/net-mgmt/nagios-check_ports/files/patch-check_ports
@@ -0,0 +1,108 @@
+--- check_ports 2011-08-23 07:01:14.000000000 +0000
++++ check_ports 2011-08-24 02:32:14.000000000 +0000
+@@ -30,20 +30,15 @@
+ #
+
+ # please change locations appropriate
+-PORTAUDIT=/usr/local/sbin/portaudit
+ PKG_VERSION=/usr/sbin/pkg_version
+ JEXEC=/usr/sbin/jexec
+ JLS=/usr/sbin/jls
+-PORTDIR=/usr/ports
+ # TMP_PATH will be created by check_ports, needs to be writable
+ TMP_PATH=/tmp/jailaudit
+
+ ###### global vars - don't touch ######
+
+-RELEASE=$(uname -r | awk -F. '{ print $1 }')
+-PORTINDEX=${PORTDIR}/INDEX-${RELEASE}
+-
+-PROGNAME=$(basename $0)
++PROGNAME="${0##*/}"
+ VERSION=0.6.1
+ DATE="10 Mar 2009"
+ PROJECTURL=http://code.adminlife.net/check_ports
+@@ -68,7 +63,7 @@
+
+ # print help msg and exit
+ print_help() {
+- printf "usage: ${PROGNAME} [options] [-j jailname ]\n\n"
++ printf "usage: ${PROGNAME} [options] [-j jailname] [-I <path>] [-P <path>]\n\n"
+ 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 @@
+ 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 <path>\tPath to INDEX file.\n\n"
++ printf " -P <path>\tPath to portaudit.\n"
+ exit 0
+ }
+
+@@ -254,13 +251,13 @@
+ # 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")
+ fi
+
+ # count lines from find
+ if [ ${CHECK_PORTS_AGE} -eq 1 ]
+ then
+- PORTSAGE=$(find ${PORTINDEX} -name INDEX-${RELEASE} -mtime +1 | grep -c INDEX-${RELEASE} -)
++ PORTSAGE=$(find ${PORTINDEX} -name ${PORTINDEX##*/} -mtime +1 | grep -c ${PORTINDEX##*/})
+ fi
+
+ # count lines from portaudit
+@@ -291,13 +288,13 @@
+ # 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")
+ fi
+
+ # count lines from find
+ if [ ${CHECK_PORTS_AGE} -eq 1 ]
+ then
+- PORTSAGE=$(find ${JAIL_PATH}${PORTINDEX} -name INDEX-${RELEASE} -mtime +1 | grep -c INDEX-${RELEASE} -)
++ PORTSAGE=$(find ${JAIL_PATH}${PORTINDEX} -name ${PORTINDEX##*/} -mtime +1 | grep -c ${PORTINDEX##*/})
+ fi
+
+ run_gen_state
+@@ -305,12 +302,14 @@
+
+ ###### main ######
+
+-while getopts hvcrawpuj: opt 2>/dev/null
++while getopts I:P:hvcrawpuj: opt 2>/dev/null
+ do
+ case $opt in
++ I) PORTINDEX="$OPTARG" ;;
++ P) PORTAUDIT="$OPTARG" ;;
+ h) print_help;;
+ v) print_version;;
+- c) check_env;;
++ c) run_check_env=run_check_env;;
+ 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 @@
+ esac
+ done
+
++PORTDIR=/usr/ports
++RELEASE=$(uname -r)
++RELEASE="${RELEASE%%.*}"
++: ${PORTINDEX:="${PORTDIR}/INDEX-${RELEASE}"}
++: ${PORTAUDIT:=/usr/local/sbin/portaudit}
++
++[ -n "$run_check_env" ] && check_env
++
+ # check for improper usage
+ if [ ${WARN_ON_ANY_UPDATE} -eq 1 -a ${ANY_UPDATE} -eq 1 ]
+ then