2 # Copyright (c) 2002 SuSE GmbH Nuernberg, Germany.
4 # Author: Michael Schroeder <feedback@suse.de>
6 # /etc/init.d/rpmconfigcheck
7 # /usr/sbin/rcrpmconfigcheck
9 # Script to scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
12 # Provides: rpmconfigcheck
13 # Required-Start: $remote_fs
14 # Required-Stop: $null
15 # Default-Start: 2 3 5
17 # Description: rpm config file scan
22 # First reset status of this service
25 configcheckfile=/var/adm/rpmconfigcheck
26 packages=/var/lib/rpm/Packages
28 test -z "$1" && set start
31 start|restart|try-restart|reload|force-reload)
32 if test -s $packages -a \( ! -e $configcheckfile -o -s $configcheckfile -o ! $packages -ot $configcheckfile \) ; then
33 echo -n "Searching for unresolved configuration files"
34 if test ! -e $configcheckfile -o ! $packages -ot $configcheckfile ; then
35 test -e $configcheckfile && mv -f $configcheckfile $configcheckfile.old
36 rpm -qalc | sort | perl -lne '-e "$_.rpmnew" and print "$_.rpmnew"; -e "$_.rpmorig" and print "$_.rpmorig"; -e "$_.rpmsave" and print "$_.rpmsave"' > $configcheckfile
38 mv -f $configcheckfile $configcheckfile.old
41 done < $configcheckfile.old > $configcheckfile
45 if test -s $configcheckfile; then
46 echo "Please check the following files (see /var/adm/rpmconfigcheck):"
47 sed -e 's/^/ /' < $configcheckfile
48 touch $configcheckfile.old
49 cat $configcheckfile $configcheckfile.old | sort | uniq -d > $configcheckfile.dup
50 cat $configcheckfile $configcheckfile.dup | sort | uniq -u > $configcheckfile.new
51 if test -s $configcheckfile.new ; then
53 echo "----------------------------------------------------------------------"
54 echo "----------------------------------------------------------------------"
57 echo "----------------------------------------"
58 echo "This is a warning message."
59 echo "rpmconfigcheck has found the following new unresolved config files"
60 echo "(all files are listed in /var/adm/rpmconfigcheck):"
61 cat $configcheckfile.new
62 echo "----------------------------------------"
63 ) >> /var/log/update-messages
66 rm -f $configcheckfile.old $configcheckfile.dup $configcheckfile.new
76 echo "Usage: $0 {start}"