From 90c3c2b4ea2b1fa0d739286ba01d601c5d655b77 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 5 Nov 2021 11:03:18 +0100 Subject: [PATCH] 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. --- power-profiles-daemon.spec | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/power-profiles-daemon.spec b/power-profiles-daemon.spec index aa2e0c8..fb4dc44 100644 --- a/power-profiles-daemon.spec +++ b/power-profiles-daemon.spec @@ -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 - 0.10.1-2 +- Apply power-profiles-daemon.service preset on upgrades to F35 and F36 + * Thu Oct 28 2021 Bastien Nocera - 0.10.1-1 - power-profiles-daemon-0.10.1-1 - Update to 0.10.1