Michael Schröder
a959f87767
- Fix name of Packages DB file in rpmconfigcheck OBS-URL: https://build.opensuse.org/request/show/793761 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=541
50 lines
1.9 KiB
Bash
50 lines
1.9 KiB
Bash
#! /bin/bash
|
|
# Copyright (c) 2002 SUSE GmbH Nuernberg, Germany.
|
|
#
|
|
# Author: Michael Schroeder <feedback@suse.de>
|
|
#
|
|
# Script to scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
|
|
#
|
|
|
|
configcheckfile=/var/adm/rpmconfigcheck
|
|
packages=/var/lib/rpm/Packages.db
|
|
|
|
if test -s $packages -a \( ! -e $configcheckfile -o -s $configcheckfile -o ! $packages -ot $configcheckfile \) ; then
|
|
echo "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 | while read line; do
|
|
for suffix in new orig save; do
|
|
[[ -e "${line}.rpm${suffix}" ]] && echo "${line}.rpm${suffix}"
|
|
done
|
|
done > $configcheckfile
|
|
else
|
|
mv -f $configcheckfile $configcheckfile.old
|
|
while read l; do
|
|
test -e $l && echo $l
|
|
done < $configcheckfile.old > $configcheckfile
|
|
fi
|
|
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
|