Advertisement
Guest User

Untitled

a guest
Dec 8th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. [WORKING DRAFT] User services on SailfishOS
  2.  
  3. Certain use-cases of some applications require work to be done in the background.
  4. Apps like clients to certain cloud storage solutions (like ownCloud) would like
  5. to provide automatic backups of photos taken with the camera.
  6. UX-wise it is bad to have the user remember to start certain applications after the device has booted.
  7. Application developers could decide to split apps into two separate programs, a GUI and a daemon.
  8. As SailfishOS already makes use of systemd user sessions this could be used to handle
  9. service management of user-installed applications inside ~/.config/systemd/user/.
  10.  
  11. What we don't want:
  12. * Allow arbitrary applications to write to ~/.config/systemd/user/
  13. * Allow arbitrary applications to enable/disable services of other applications
  14. * Get in the way of possible sandboxing methods
  15. * Start services at boot without the user having explicitly enabled them
  16.  
  17. What we want:
  18. * Use systemd user session to keep track of service process
  19. * A trusted userspace daemon dealing with enabling/disabling services
  20.  
  21. Other possible ideas:
  22. * Multiple services per app?
  23. * Guidelines on what the background daemon should be allowed to do?
  24. * Keep services running for a certain amount of time?
  25. * Dependencies? (example: automatic camera photo upload requiring tracker to be running)
  26. * Let services create wayland surfaces for direct interaction?
  27. * Limiting resources (CPU, memory)?
  28.  
  29. Proposal:
  30. A trusted userspace daemon (either a new one or the compositor) could provide
  31. dbus interfaces to allow applications to enable/disable their respective background services.
  32. This daemon would be the only process allowed to write to ~/.config/systemd/user/.
  33. When the user starts an app and explicitly enables the autostart of the apps service
  34. the trusted daemon could show a dialog to allow the user to cancel or proceed enabling the service.
  35. The trusted daemon would then check for the calling process of the dbus method and create
  36. a minmal service file like:
  37.  
  38. [Unit]
  39. Description=harbour-<APPNAME>
  40.  
  41. [Service]
  42. Type=simple
  43. ExecStart=/usr/share/harbour-<APPNAME>/daemon
  44.  
  45.  
  46. ...where /usr/share/harbour-<APPNAME>/daemon is the binary which implements the
  47. applications background functionality. This service file would be written to ~/.config/systemd/user/.
  48. The trusted daemon would know which service to activate since only the application itself is
  49. allowed to enable/disable it's respective service.
  50. Also, since only the trusted daemon is allowed to write to ~/.config/systemd/user/ it can decide on
  51. resource limitation and guarantee a working start of lipstick (by not allowing a reverse-dependency).
  52. TODO: should the service file contain [Install] information?
  53. If yes: should the [Install] contain configurable dependency or be soley dependent on lipstick?
  54. If no: probably needs a separate file to keep track of enabled services and let the trusted daemon
  55. start them when UI is up.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement