Add unit scriptlets for fstrim.service and .timer

https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_scriptlets

We want to "restart" the timer so that the it's rescheduled if there
are any changes to frequency or other settings. This will not cause the timer
to fire immediately. We don't restart the service itself, because, if it happens
to be running, we want it to just finish as it was.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=2262393 for new
installations. A preset call was missing for fstrim.timer, so if util-linux
was installed after systemd, the unit would not be enabled.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-02-06 10:57:28 +01:00
parent a4d9e81291
commit e5d9a1e3ef

View File

@ -438,6 +438,15 @@ find $RPM_BUILD_ROOT%{_mandir}/man8 -regextype posix-egrep \
-regex ".*(linux32|linux64|s390|s390x|i386|ppc|ppc64|ppc32|sparc|sparc64|sparc32|sparc32bash|mips|mips64|mips32|ia64|x86_64|uname26)\.8.*" \ -regex ".*(linux32|linux64|s390|s390x|i386|ppc|ppc64|ppc32|sparc|sparc64|sparc32|sparc32bash|mips|mips64|mips32|ia64|x86_64|uname26)\.8.*" \
-printf "%{_mandir}/man8/%f*\n" >> %{name}.files -printf "%{_mandir}/man8/%f*\n" >> %{name}.files
%post
%systemd_post fstrim.{service,timer}
%preun
%systemd_preun fstrim.{service,timer}
%postun
%systemd_postun_with_restart fstrim.timer
%systemd_postun fstrim.service
%pre -n uuidd %pre -n uuidd
getent group uuidd >/dev/null || groupadd -r uuidd getent group uuidd >/dev/null || groupadd -r uuidd