Apply power-profiles-daemon.service preset on upgrades to F35 and F36

The preset was changed to enabled in F35, but systemd rpm scriptlets
don't have a mechanism for re-applying presets when the defaults were
changed.

This commit does it manually instead and repurposes an older trigger
scriptlet to re-apply the preset on distro upgrades.

I've changed the existing trigger a bit to match what we came up with
for enabling fstrim.timer in util-linux a while back. This should be
a well tested and a known working trigger.
This commit is contained in:
Kalev Lember 2021-11-05 11:03:18 +01:00
parent d719df8358
commit 90c3c2b4ea

View File

@ -1,6 +1,6 @@
Name: power-profiles-daemon
Version: 0.10.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Makes power profiles handling available over D-Bus
License: GPLv3+
@ -54,11 +54,12 @@ mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/power-profiles-daemon
%postun
%systemd_postun_with_restart %{name}.service
%triggerun -- power-profiles-daemon < 0.1-2
# This is for upgrades from previous versions before power-profiles-daemon became part
# of the system daemons.
systemctl --no-reload preset power-profiles-daemon.service &>/dev/null || :
%triggerpostun -- power-profiles-daemon < 0.10.1-2
if [ $1 -gt 1 ] && [ -x /usr/bin/systemctl ] ; then
# Apply power-profiles-daemon.service preset on upgrades to F35 and F36 as
# the preset was changed to enabled in F35.
/usr/bin/systemctl --no-reload preset power-profiles-daemon.service || :
fi
%files
%license COPYING
@ -77,6 +78,9 @@ systemctl --no-reload preset power-profiles-daemon.service &>/dev/null || :
%{_datadir}/gtk-doc/html/%{name}/
%changelog
* Fri Nov 05 2021 Kalev Lember <klember@redhat.com> - 0.10.1-2
- Apply power-profiles-daemon.service preset on upgrades to F35 and F36
* Thu Oct 28 2021 Bastien Nocera <bnocera@redhat.com> - 0.10.1-1
- power-profiles-daemon-0.10.1-1
- Update to 0.10.1