-
Notifications
You must be signed in to change notification settings - Fork 57
Description
The spec currently contains these lines:
systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service
systemctl disable NetworkManager-wait-online.service
systemctl disable NetworkManager.service
Rather than do this, the package should create a systemd preset file at %{_presetdir}/80-amazon-ec2-net-utils.preset
(where %{_presetdir}
is defined to be /usr/lib/systemd/system-preset
on Enterprise Linux) which looks like this:
enable systemd-networkd.service
enable systemd-resolved.service
disable NetworkManager-wait-online.service
disable NetworkManager.service
The script in the spec would then need to systemctl preset
each of those services instead (and probably also systemctl daemon-reload
before) since it expects to also start services.
The reason for using presets instead of having the script directly enable/disable services is that it persists the preference/requirement that systemd-networkd is used instead of NetworkManager. If another preset on the system with a lower priority (which may be provided by the OS vendor, a package, or the sysadmin) expresses the preference to enable NetworkManager either directly or indirectly in a preset, then this package will stop working correctly once the preset is applied (which could happen when packages are installed/upgraded or deliberately via systemctl preset-all
). Presets are how the Fedora packaging guidelines now recommend doing this (and these guidelines would apply to Enterprise Linux as well). With a preset in place, NetworkManager will not be automatically enabled, and only an explicit enable would cause that to happen.
(Edited: I typed the priority as 98 originally because that's what I had been using all day, but this would have to be <90 since the OS defaults are 90-*
and systemd uses whatever comes first and doesn't allow later ones to override it)