#!/bin/sh - # # Copyright (C) 2006-2008 Oliver Fromme # All rights reserved. Standard 2-clause BSD license and disclaimer apply. # # This is a periodic script for FreeBSD. # # It produces a diff-like listing of changes made to locally # installed packages (i.e. updated, removed and added packages) # which is included in the "daily run output". # # Put this script in the /usr/local/etc/periodic/daily directory, # (create that directory if it doesn't exist yet), and add this line # to the /etc/periodic.conf file (create that file if it doesn't # exist yet): daily_status_pkg_changes_enable="YES" # if [ -r /etc/defaults/periodic.conf ]; then . /etc/defaults/periodic.conf source_periodic_confs fi case "$daily_status_pkg_changes_enable" in [Yy][Ee][Ss]) if [ ! -f /usr/sbin/pkg_info ]; then echo '$daily_status_pkg_changes_enable is enabled but' \ "/usr/sbin/pkg_info doesn't exist" rc=2 else bak=/var/backups rc=0 if [ -f $bak/pkg_info.bak ]; then mv -f $bak/pkg_info.bak $bak/pkg_info.bak2 fi /usr/sbin/pkg_info > $bak/pkg_info.bak if ! cmp -sz $bak/pkg_info.bak $bak/pkg_info.bak2; then echo "" echo "Changes in installed packages:" diff -U 0 $bak/pkg_info.bak2 $bak/pkg_info.bak \ | grep '^[-+][^-+]' | sort -k 1.2 fi fi ;; *) rc=0 ;; esac exit $rc