]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - etc/periodic/daily/490.status-pkg-changes
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / etc / periodic / daily / 490.status-pkg-changes
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # If there is a global system configuration file, suck it in.
7 #
8 if [ -r /etc/defaults/periodic.conf ]; then
9     . /etc/defaults/periodic.conf
10     source_periodic_confs
11 fi
12
13 case "$daily_status_pkg_changes_enable" in
14     [Yy][Ee][Ss])
15         if [ ! -f /usr/sbin/pkg_info ]; then
16             echo '$daily_status_pkg_changes_enable is enabled but' \
17                  "/usr/sbin/pkg_info doesn't exist"
18             rc=2
19         else
20             bak=/var/backups
21             rc=0
22
23             if [ -f $bak/pkg_info.bak ]; then
24                 mv -f $bak/pkg_info.bak $bak/pkg_info.bak2
25             fi
26             ${pkg_info:-/usr/sbin/pkg_info} > $bak/pkg_info.bak
27
28             cmp -sz $bak/pkg_info.bak $bak/pkg_info.bak2
29             if [ $? -eq 1 ]; then
30                 echo ""
31                 echo "Changes in installed packages:"
32                 diff -U 0 $bak/pkg_info.bak2 $bak/pkg_info.bak \
33                 | grep '^[-+][^-+]' | sort -k 1.2
34             fi
35         fi
36         ;;
37
38     *)
39         rc=0
40         ;;
41 esac
42
43 exit $rc