~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/usr/share/upstart/sessions/ubuntu-system-settings-wizard.conf

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
description "Welcome to Ubuntu"
 
2
author "Michael Terry <michael.terry@canonical.com>"
 
3
 
 
4
start on starting unity8
 
5
task
 
6
 
 
7
expect stop
 
8
 
 
9
# If you change this, also change it in the cleanup upstart job
 
10
env RUN_FILE=".config/ubuntu-system-settings/wizard-has-run"
 
11
 
 
12
pre-start script
 
13
    if [ -e "$HOME/$RUN_FILE" ]; then
 
14
        initctl set-env WIZARD_SKIPPED=true
 
15
        stop
 
16
    else
 
17
        # Stop unity8, we'll start it again in post-stop (this avoids a race
 
18
        # between post-stop and unity8 unpausing)
 
19
        stop --no-wait $JOB
 
20
 
 
21
        # Tell unity-mir to raise SIGSTOP after we start
 
22
        initctl set-env UNITY_MIR_EMITS_SIGSTOP=1
 
23
 
 
24
        if [ -n "$MIR_SOCKET" ]; then
 
25
            initctl set-env --global WIZARD_ORIG_MIR_SOCKET=$MIR_SOCKET
 
26
 
 
27
            # Point wizard at unity-system-compositor
 
28
            MIR_SERVER_FILE=$XDG_RUNTIME_DIR/wizard_socket
 
29
            initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
 
30
            initctl set-env MIR_SERVER_HOST_SOCKET=$MIR_SOCKET
 
31
 
 
32
            # Remove the socket if still there
 
33
            if [ -S "$MIR_SERVER_FILE" ]; then
 
34
                rm "$MIR_SERVER_FILE"
 
35
            fi
 
36
 
 
37
            # Point future jobs in this session to our Mir socket instead of
 
38
            # unity-system-compositor's socket.
 
39
            initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
 
40
            gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
 
41
        fi
 
42
    fi
 
43
end script
 
44
 
 
45
exec system-settings-wizard
 
46
 
 
47
post-stop script
 
48
    if [ -n "$WIZARD_SKIPPED" ]; then
 
49
        exit
 
50
    fi
 
51
 
 
52
    setenv() {
 
53
        initctl set-env --global $1=$2
 
54
        gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'$1': '$2'}"
 
55
    }
 
56
 
 
57
    echo "Ending wizard"
 
58
 
 
59
    if [ -S "$MIR_SERVER_FILE" ]; then
 
60
        rm -f "$MIR_SERVER_FILE"
 
61
    fi
 
62
 
 
63
    # Undo changes to global variables
 
64
    if [ -n "$WIZARD_ORIG_MIR_SOCKET" ]; then
 
65
        echo "Resetting MIR_SOCKET to $WIZARD_ORIG_MIR_SOCKET"
 
66
        setenv MIR_SOCKET $WIZARD_ORIG_MIR_SOCKET
 
67
    fi
 
68
 
 
69
    # Stop any indicators and OSK so they will be restarted with new environment
 
70
    initctl emit indicator-services-end
 
71
    stop maliit-server || true
 
72
 
 
73
    # And finally, resume unity8
 
74
    start --no-wait $JOB || true
 
75
end script