blob: 97bba74eee52f399b6de142964c941f7501a43cb (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#! /bin/bash
# Copyright (c) 2002 SuSE GmbH Nuernberg, Germany.
#
# Author: Michael Schroeder <feedback@suse.de>
#
# /etc/init.d/rpmconfigcheck
# /usr/sbin/rcrpmconfigcheck
#
# Script to scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
#
### BEGIN INIT INFO
# Provides: rpmconfigcheck
# Required-Start: $remote_fs
# Required-Stop: $null
# Default-Start: 2 3 5
# Default-Stop:
# Description: rpm config file scan
### END INIT INFO
. /etc/rc.status
# First reset status of this service
rc_reset
configcheckfile=/var/adm/rpmconfigcheck
packages=/var/lib/rpm/Packages
test -z "$1" && set start
case "$1" in
start|restart|try-restart|reload|force-reload)
if test -s $packages -a \( ! -e $configcheckfile -o -s $configcheckfile -o ! $packages -ot $configcheckfile \) ; then
echo -n "Searching for unresolved configuration files"
if test ! -e $configcheckfile -o ! $packages -ot $configcheckfile ; then
test -e $configcheckfile && mv -f $configcheckfile $configcheckfile.old
rpm -qalc | sort | perl -lne '-e "$_.rpmnew" and print "$_.rpmnew"; -e "$_.rpmorig" and print "$_.rpmorig"; -e "$_.rpmsave" and print "$_.rpmsave"' > $configcheckfile
else
mv -f $configcheckfile $configcheckfile.old
while read l; do
test -e $l && echo $l
done < $configcheckfile.old > $configcheckfile
true
fi
rc_status -v
if test -s $configcheckfile; then
echo "Please check the following files (see /var/adm/rpmconfigcheck):"
sed -e 's/^/ /' < $configcheckfile
touch $configcheckfile.old
cat $configcheckfile $configcheckfile.old | sort | uniq -d > $configcheckfile.dup
cat $configcheckfile $configcheckfile.dup | sort | uniq -u > $configcheckfile.new
if test -s $configcheckfile.new ; then
(
echo "----------------------------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "rpmconfigcheck"
date
echo "----------------------------------------"
echo "This is a warning message."
echo "rpmconfigcheck has found the following new unresolved config files"
echo "(all files are listed in /var/adm/rpmconfigcheck):"
cat $configcheckfile.new
echo "----------------------------------------"
) >> /var/log/update-messages
fi
fi
rm -f $configcheckfile.old $configcheckfile.dup $configcheckfile.new
fi
;;
stop)
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac
rc_exit
|