rpm/rpmconfigcheck
Michael Schröder 486d0ef0e2 Accepting request 790868 from home:favogt:rpmsmalle
Rebased:

- Replace rpmsort with rewrite using Lua (boo#1164553)

- Split out perl and python dep generators from rpm-build to avoid
  pulling in perl and python in all RPM builds
- Port rpmconfigcheck to pure shell
- Refactor %files list of main package to not require %excludes
  as those might lead to missing files in the package

OBS-URL: https://build.opensuse.org/request/show/790868
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=537
2020-04-02 13:57:28 +00:00

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
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