From owner-svn-src-head@FreeBSD.ORG Thu Aug 5 15:53:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C3DF1065675; Thu, 5 Aug 2010 15:53:34 +0000 (UTC) (envelope-from olli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2017A8FC13; Thu, 5 Aug 2010 15:53:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o75FrYCe034728; Thu, 5 Aug 2010 15:53:34 GMT (envelope-from olli@svn.freebsd.org) Received: (from olli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o75FrXQt034726; Thu, 5 Aug 2010 15:53:34 GMT (envelope-from olli@svn.freebsd.org) Message-Id: <201008051553.o75FrXQt034726@svn.freebsd.org> From: Oliver Fromme Date: Thu, 5 Aug 2010 15:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210863 - in head/etc: defaults periodic/daily X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2010 15:53:34 -0000 Author: olli Date: Thu Aug 5 15:53:33 2010 New Revision: 210863 URL: http://svn.freebsd.org/changeset/base/210863 Log: Add a daily script to the periodic framework that reports changes to the package database, i.e. any packages that have been added, updated or deleted in the past 24 hours. The format is intentionally simple and concise. That information is particularly useful on servers that are maintained by multiple administrators. When someone adds, updates or deletes a package, the others will see it in the daily periodic output. This script is disabled by default. PR: conf/113913 Submitted by: olli Approved by: des (mentor) MFC after: 3 weeks Added: head/etc/periodic/daily/490.status-pkg-changes (contents, props changed) Modified: head/etc/defaults/periodic.conf Modified: head/etc/defaults/periodic.conf ============================================================================== --- head/etc/defaults/periodic.conf Thu Aug 5 15:11:03 2010 (r210862) +++ head/etc/defaults/periodic.conf Thu Aug 5 15:53:33 2010 (r210863) @@ -136,6 +136,9 @@ daily_status_named_usedns="YES" # DNS # 480.status-ntpd daily_status_ntpd_enable="NO" # Check NTP status +# 490.status-pkg-changes +daily_status_pkg_changes_enable="NO" # Show package changes + # 500.queuerun daily_queuerun_enable="YES" # Run mail queue daily_submit_queuerun="YES" # Also submit queue Added: head/etc/periodic/daily/490.status-pkg-changes ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/periodic/daily/490.status-pkg-changes Thu Aug 5 15:53:33 2010 (r210863) @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# If there is a global system configuration file, suck it in. +# +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 + + cmp -sz $bak/pkg_info.bak $bak/pkg_info.bak2 + if [ $? -eq 1 ]; 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