#!/bin/sh - # # $FreeBSD$ # if [ -r /etc/defaults/periodic.conf ]; then . /etc/defaults/periodic.conf source_periodic_confs fi # On 9.x or lower, 490.status-pkg-changes exists in the base system, # but using the old pkg_tools commands. Unfortunately it uses the # same configuration variables, so allow the setting of # $daily_status_pkgng_changes_enable to turn on this script without # enabling the pkg_tools equivalent case "$daily_status_pkgng_changes_enable" in [Yy][Ee][Ss]) daily_status_pkg_changes_enable="$daily_status_pkgng_changes_enable" ;; esac case "$daily_status_pkg_changes_enable" in [Yy][Ee][Ss]) pkgcmd=/usr/local/sbin/pkg echo echo 'Changes in installed packages:' if ! ${pkgcmd} -N >/dev/null 2>&1 ; then echo 'status-pkg-changes is enabled but pkg is not used' rc=2 else bak=/var/backups rc=0 [ -r $bak/pkg.bak ] && mv -f $bak/pkg.bak $bak/pkg.bak2 ${pkgcmd} info > $bak/pkg.bak cmp -sz $bak/pkg.bak $bak/pkg.bak2 if [ $? -eq 1 ]; then diff -U 0 $bak/pkg.bak2 $bak/pkg.bak | \ grep '^[-+][^-+]' | sort -k 1.2 fi fi ;; *) rc=0 ;; esac exit $rc