~ubuntu-core-dev/upstart/ubuntu

« back to all changes in this revision

Viewing changes to debian/systemd-graphical-session.conf

  • Committer: Martin Pitt
  • Date: 2016-07-26 06:25:42 UTC
  • Revision ID: martin.pitt@canonical.com-20160726062542-47j471w4sr30zrkt
Add debian/systemd-graphical-session.conf and install it into the above
override upstart session job dir. This runs the systemd graphical user
session in an upstart job. This is normally done by the
/usr/share/xsessions/*.desktop's Exec= line, but as Xsession.d/99upstart
completely replaces/ignores $STARTUP, we need to replicate the logic here.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
description "Run systemd user units for graphical session"
 
2
author "Martin Pitt <martin.pitt@ubuntu.com>"
 
3
 
 
4
# this is normally done by the /usr/share/xsessions/*.desktop's Exec= line, but
 
5
# as Xsession.d/99upstart completely nullifies $STARTUP, we need to replicate it
 
6
# through this upstart job.
 
7
 
 
8
start on startup
 
9
 
 
10
pre-start script
 
11
    # some services talk to upstart in code, and for the transition period we
 
12
    # also want this to be in shells
 
13
    if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
 
14
        dbus-update-activation-environment --verbose --systemd UPSTART_SESSION
 
15
    fi
 
16
 
 
17
    # robustness: if the previous graphical session left some failed units,
 
18
    # reset them so that they don't break this startup
 
19
    for unit in $(systemctl --user --no-legend --state=failed list-units | cut -f1 -d' '); do
 
20
        if [ "$(systemctl --user show -p PartOf --value)" = "graphical-session.target" ]; then
 
21
            systemctl --user reset-failed $unit
 
22
        fi
 
23
    done
 
24
 
 
25
    systemctl --user restart graphical-session-pre.target
 
26
    systemctl --user restart ${DESKTOP_SESSION}-session.target
 
27
end script
 
28
 
 
29
# delay killing the X server until all graphical units stopped
 
30
# FIXME: we currently cannot make targets wait on its dependencies going to
 
31
# "inactive", only to "deactivating"
 
32
post-stop script
 
33
    while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do sleep 0.2; done
 
34
 
 
35
    # dirt-cheap workaround for https://bugzilla.gnome.org/show_bug.cgi?id=768943
 
36
    pkill -ef gnome-keyring-daemon
 
37
end script