Skip to content

Draft: main/postmarketos-ui-*: use systemd presets to autostart services OOTB

clayton craft requested to merge craftyguy/systemd-presets into master

This replaces explicit calls to systemctl for autostarting services OOTB with a neat feature in systemd: service presets.

Thanks @calebccff for "discovering" this systemd feature!

TODO:

  • systemd can apply presets on first boot (see man systemd.preset), we should do this

  • By removing the post-install/post-upgrade scripts, we can no longer cover situations where the "default service preset policy" first set during the first boot changes in an upgrade.

    • For example, if pmos-ui-gnome's preset file has enable foo and an upgrade changes that to disable foo, or if some new service is added on upgrade, then this preset config will not be applied to an existing installation unless the user runs systemctl preset-all. They may not want to run that, since it would then roll back any service enabled changes they might have made (e.g. systemctl disable foo might be undone by re-applying presets
    • Fedora ships a default policy (based on UI, etc) , but how do they handle changes to this policy on existing installs? Do they expect users to run systemctl preset-all manually or do they automate is somehow? If you only run systemctl preset foo when foo is installed to work around this, I think this means a change to the preset policy would still not be applied since foo might be installed but maybe now the policy says is should be disabled or something?

Also see

Fedora has two wiki pages where they explain a little about how they use presets:

  1. https://fedoraproject.org/wiki/Changes/Preset_All_Systemd_Units_on_First_Boot
  2. https://fedoraproject.org/wiki/Features/PackagePresets
Edited by clayton craft

Merge request reports