-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macros.systemd: presets might be applied during package updates too #7638
Comments
Indeed. Various hacks can be used to solve this, but nothing simple or pretty. Fortunately this doesn't come up that often, because new units that could be preset usually are new functionality and the default preset of 'disabled' is good for them. One solution is to split out such new service into a subpackage, and add Requires both ways (to and from the main package). Then it is possible to use normal macros. |
Yeah... I was hoping that you knew a fancy rpm feature that could solve this simply.
Not sure packagers would like to create subpackages just for that purpose though |
BTW, SUSE is checking for the present of the units in %pre and create a marker (tag file) if it's not there. %post checks for the present of the tag file and apply the preset if it's there. Not pretty but at least the corner case is covered. |
If I understand it correctly, I think it is enough to write |
Sorry I don't understand what you meant here. Care to explain ? Thanks. |
OK, so what about adding a new macro that takes the package version as an argument, and does the preset when upgrading from a version that was older than this version:
The first argument would be a version of the package that added the new service, and the second would be the name of the service itself. It would expand into a trigger that would run when a version of the package older than the specified argument would be uninstalled:
Details to be figured out ;) |
By the way, http://ftp.rpm.org/api/4.4.2.2/triggers.html is the "best" documentation I could find. It seems that newer rpm versions lost the scant documentation they had for this. |
@fbuihuu Sorry, I missed your request.
If packages always enable services, then users need to disable unwanted services after every update. E.g., fedora ships preset which enables NetworkManager.service. If a user want to use systemd-networkd instead of NetworkManager, but because of rpm dependency it may not possible to uninstall NetworkManager. In such a case, NetworkManager is always enabled when the package is updated. So, I think %trigger scripts are favorable instead of %post script, and I like the proposed method by @keszybz. |
@yuwata thanks but I don't think the initial plan was to apply preset unconditionally during package updates. |
Yeah, my original comment is for the initial proposal by @keszybz:
|
Thanks @keszybz for your idea and pointer. I'm not sure if relying on a package version is a good idea and is easily maintainable even if it has the advantage to not use a state file (to record if a package has been already "preset'ed") like it's done with the SUSE approach. Actually I just remember issue #4830 which should solve this issue properly: the actions performed by sysadmins (enable, disable) should be recorded in /etc whereas the presets applied by packages should operate in /usr only. That way we could apply presets unconditionally during package installations/updates without interfering with sysadmin preferences. |
Hmm. I have not followed the discussion in #4830. But is it possible to migrate the system from which does not have such admin-action records? |
The problem is that currently there're no ways to figure out if a service has been explicitly enabled/disabled by the sysadmin or if it's been enabled during package installation (according to the presets). During such migration we could run a tool which would remove all symlinks in /etc that matches the preset states assuming that they were created during package installations and that the sysadmin is fine to follow the distro defaults (even if they might be changed in the future). But regarding this specific issue which is about the introduction of new services during package updates, they won't be any problem I think. |
Currently we only apply presets during package installations which makes sense in most cases.
However an installed package with no units might be starting shipping units through an update and in this case we also need to apply the presets.
The text was updated successfully, but these errors were encountered: