diff options
author | olli <olli@FreeBSD.org> | 2010-08-05 15:53:33 +0000 |
---|---|---|
committer | olli <olli@FreeBSD.org> | 2010-08-05 15:53:33 +0000 |
commit | d1b61616fa6d6851624ea2056a25e8aea473e388 (patch) | |
tree | f0c8414e8ff201e14d6847b547e44c6442d37ecb | |
parent | 455a0fe881ceba35ce4b0cea14e44db5735801f6 (diff) | |
download | FreeBSD-src-d1b61616fa6d6851624ea2056a25e8aea473e388.zip FreeBSD-src-d1b61616fa6d6851624ea2056a25e8aea473e388.tar.gz |
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
-rw-r--r-- | etc/defaults/periodic.conf | 3 | ||||
-rwxr-xr-x | etc/periodic/daily/490.status-pkg-changes | 43 |
2 files changed, 46 insertions, 0 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index b4c777b..8267ac7 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -136,6 +136,9 @@ daily_status_named_usedns="YES" # DNS lookups are ok # 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 diff --git a/etc/periodic/daily/490.status-pkg-changes b/etc/periodic/daily/490.status-pkg-changes new file mode 100755 index 0000000..60e3e8c --- /dev/null +++ b/etc/periodic/daily/490.status-pkg-changes @@ -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 |