Martin Pitt [2016-07-06 13:47 +0200]:
> Simon McVittie [2016-07-05 10:27 +0100]:
> > Could this be done by having the .desktop file in /usr/share/xsessions
> > or /usr/share/wayland-sessions start an appropriate systemd user unit
> > directly, and wait for it to terminate?
> 
> There is currently no command (other than a polling loop) to wait
> until a particular unit gets stopped. I.  e.
> 
>   Exec=gnome-session --session=gnome
> 
> would need to be replaced with something like
> 
>   Exec=/bin/sh -c "systemctl start gnome-session.target; 
> wait-until-service-stopped gnome-session.service; systemctl stop 
> gnome-session.target"

[...]

> I have a gut feeling that this should be expressible with systemd
> dependencies -- i. e. "if gnome-session.service stops, then stop
> gnome-session.target".

The v3 approach now does this, so the above would reduce to something
like

  Exec=/bin/sh -c 'systemctl start gnome-session.target; systemctl wait-unit 
gnome-session.target'

for a hypothetical "wait-unit" verb which blocks until the given unit
stops. Or perhaps even

  Exec=systemctl start --wait-until-stopped gnome-session.target

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to