diff --git a/rpm.changes b/rpm.changes index c688697..debbaf5 100644 --- a/rpm.changes +++ b/rpm.changes @@ -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 diff --git a/rpm.spec b/rpm.spec index 6a354fc..9c7e1bd 100644 --- a/rpm.spec +++ b/rpm.spec @@ -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.* diff --git a/rpmconfigcheck b/rpmconfigcheck index a4152f9..b6b4471 100644 --- a/rpmconfigcheck +++ b/rpmconfigcheck @@ -3,78 +3,43 @@ # # Author: Michael Schroeder # -# /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 diff --git a/rpmconfigcheck.service b/rpmconfigcheck.service new file mode 100644 index 0000000..9bb9890 --- /dev/null +++ b/rpmconfigcheck.service @@ -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