#!/bin/sh - # # $FreeBSD$ # if [ -r /etc/defaults/periodic.conf ]; then . /etc/defaults/periodic.conf source_periodic_confs fi pkgcmd=/usr/local/sbin/pkg # On 9.x or lower, 400.status-pkg exists in the base system, but using # the old pkg_tools commands. Unfortunately it uses the same # configuration variables, so allow the setting of # $weekly_status_pkgng_enable to turn on this script without enabling # the pkg_tools equivalent case "$weekly_status_pkgng_enable" in [Yy][Ee][Ss]) weekly_status_pkg_enable="$weekly_status_pkgng_enable" ;; esac case "$weekly_status_pkg_enable" in [Yy][Ee][Ss]) echo echo 'Checking for out of date packages:' if ! ${pkgcmd} -N >/dev/null 2>&1 ; then echo 'status-pkg is enabled but pkg is not used' rc=2 else rc=$(${pkgcmd} version -v ${pkg_version_index} | sed -n -e '/up-to-date/d' \ -e 's/^\([^[:space:]]*\)[[:space:]]*[<>=!?][[:space:]]*\(.*\)$/\1 \2/p' | tee /dev/stderr | wc -l) [ $rc -gt 1 ] && rc=1 fi ;; *) rc=0 ;; esac exit $rc