Accepting request 482469 from home:kukuk:branches:Base:System

- Convert rpmconfigcheck init script to systemd unit

OBS-URL: https://build.opensuse.org/request/show/482469
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=390
This commit is contained in:
Marcus Meissner 2017-03-29 12:08:58 +00:00 committed by Git OBS Bridge
parent f5955f21b5
commit 7e7de860a3
4 changed files with 54 additions and 73 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Mar 17 18:14:37 UTC 2017 - kukuk@suse.com
- Convert rpmconfigcheck init script to systemd unit
-------------------------------------------------------------------
Mon Mar 6 12:37:48 UTC 2017 - rguenther@suse.com

View File

@ -59,6 +59,7 @@ Source9: sysconfig.services-rpm
Source10: beecrypt-4.1.2.tar.bz2
Source11: db-4.8.30.tar.bz2
Source12: baselibs.conf
Source13: rpmconfigcheck.service
Patch1: beecrypt-4.1.2.diff
Patch2: db.diff
Patch3: rpm-4.12.0.1-fix-bashisms.patch
@ -309,10 +310,10 @@ install -m 644 db3/db.h %{buildroot}/usr/include/rpm
for f in %{buildroot}/%{_libdir}/*.la; do
sed -i -e "s,/%_lib/libpopt.la,-lpopt,g" $f
done
mkdir -p %{buildroot}/etc/init.d
install -m 755 %{SOURCE8} %{buildroot}/etc/init.d
mkdir -p %{buildroot}/usr/sbin
ln -sf ../../etc/init.d/rpmconfigcheck %{buildroot}/usr/sbin/rcrpmconfigcheck
install -m 755 %{SOURCE8} %{buildroot}/usr/sbin
mkdir -p %{buildroot}/usr/lib/systemd/system
install -m 644 %{SOURCE13} %{buildroot}/usr/lib/systemd/system/
cp -a suse_macros %{buildroot}/usr/lib/rpm
mkdir -p %{buildroot}/usr/lib/rpm/macros.d
mkdir -p %{buildroot}/usr/lib/rpm/suse
@ -401,8 +402,8 @@ rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion va
/bin/rpm
/usr/bin/*
%exclude /usr/bin/rpmbuild
/etc/init.d/rpmconfigcheck
/usr/sbin/rcrpmconfigcheck
/usr/sbin/rpmconfigcheck
/usr/lib/systemd/system/rpmconfigcheck.service
/usr/lib/rpm
%{_libdir}/rpm-plugins
%{_libdir}/librpm.so.*

View File

@ -3,78 +3,43 @@
#
# 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
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 | 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
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
;;
stop)
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac
rc_exit
fi
rm -f $configcheckfile.old $configcheckfile.dup $configcheckfile.new
fi

10
rpmconfigcheck.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rpmconfigcheck
[Install]
WantedBy=default.target