summaryrefslogtreecommitdiffstats
path: root/etc/periodic/daily/490.status-pkg-changes
blob: 548e10add79589db1b4e422e8b6b0892b01f558f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
	    ${pkg_info:-/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
OpenPOWER on IntegriCloud