openrazer / OBS-packaging

Open Build Service packaging for OpenRazer
https://build.opensuse.org/package/show/hardware:razer/openrazer
5 stars 10 forks source link

Replace %post with %posttrans to fix driver installation #7

Closed DarkWav closed 2 years ago

DarkWav commented 2 years ago

Currently, driver installation during updates is handled in the %post section of the spec file. However, according to RPM specification %post is called before %preun, causing the driver to be instantly uninstalled by %preun after it has been installed by %post during updates: https://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets#Scriptlet_Ordering https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#ordering

By converting %post to %posttrans this issue can be avoided since %posttrans is executed after %preun during a package upgrade but not during actual package uninstallation, allowing the dkms install of the new modules to be performed after the removal of the old modules.

If you have any suggestions for improvement, let me know!

z3ntu commented 2 years ago

Sorry that I forgot about this on OBS. Let's merge this and see what happens ;)

DarkWav commented 2 years ago

No problem, let's hope it works :) EDIT: Tested it, it works great!