diff --git a/logrotate.spec b/logrotate.spec index 8e18866669d654133e7ea4b5f997c1f731f90a86..fc0fc9201885b4e87d6d5eada29b758fc52ccd4e 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -2,7 +2,7 @@ Name: logrotate Version: 3.16.0 -Release: 1 +Release: 2 Summary: simplify the administration of log files License: GPLv2+ Url: https://github.com/logrotate/logrotate @@ -42,6 +42,21 @@ install -p -m 755 examples/logrotate.cron %{buildroot}%{_sysconfdir}/cron.daily/ %make_build -C build check %pre +# Delete file and package upgrades concurrently, Cause the upgrade to fail. +# so, empty file instead of deleting file +if [ -f /etc/cron.hourly/logrotate ];then + sed -i s/'^if[[:blank:]]*\[[[:blank:]]*-f[[:blank:]]*\/etc\/logrotate.d\/wtmp[[:blank:]]*\];then$'/'if \[ -s \/etc\/logrotate.d\/wtmp \];then'/g /etc/cron.hourly/logrotate + sed -i s/'^[[:blank:]]*rm[[:blank:]]*-f[[:blank:]]*\/etc\/logrotate.d\/wtmp$'/' > \/etc\/logrotate.d\/wtmp'/g /etc/cron.hourly/logrotate + sed -i s/'^if[[:blank:]]*\[[[:blank:]]*-f[[:blank:]]*\/etc\/logrotate.d\/btmp[[:blank:]]*\];then$'/'if \[ -s \/etc\/logrotate.d\/btmp \];then'/g /etc/cron.hourly/logrotate + sed -i s/'^[[:blank:]]*rm[[:blank:]]*-f[[:blank:]]*\/etc\/logrotate.d\/btmp$'/' > \/etc\/logrotate.d\/btmp'/g /etc/cron.hourly/logrotate + # Delay 2s, wait for /etc/cron.hourly/logrotate delete file execution to complete + sleep 2 + touch /etc/logrotate.d/wtmp + chmod 644 /etc/logrotate.d/wtmp + touch /etc/logrotate.d/btmp + chmod 644 /etc/logrotate.d/btmp +fi + # create it and copy the /var/lib/logrotate.status in it. if [ ! -d %{_localstatedir}/lib/logrotate/ -a -f %{_localstatedir}/lib/logrotate.status ]; then mkdir -p %{_localstatedir}/lib/logrotate @@ -73,6 +88,12 @@ fi %{_mandir}/man5/logrotate.conf.5* %changelog +* Fri Jun 11 2021 shixuantong - 3.16.0-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:Solution to the failure of SUT full upgrade + * Fri Apr 24 2020 BruceGW - 3.16.0-1 - update upstream to 3.16.0