~ci-train-bot/unity8/unity8-ubuntu-zesty-2204

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
description "Unity Shell v8"
author "Ricardo Mendoza <ricmm@ubuntu.com>"

emits indicator-services-start

start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=unity8-mir) or (xsession SESSION=unity8)) and started dbus
stop on desktop-end

kill timeout 120

respawn
expect stop

pre-start script
    # Tell unity-mir to raise SIGSTOP after we start
    initctl set-env UNITY_MIR_EMITS_SIGSTOP=1

    if [ -n "$MIR_SOCKET" ]; then
        # FIXME Create an autopilot test that makes sure start+stop and restart
        #       work fine at least 2 times
        # Save original value of MIR_SOCKET in case we are stopped,
        # as we modify the variable for future jobs, including ourself.
        UNITY_MIR_SOCKET=$(initctl get-env --global MIR_SOCKET)
        initctl set-env --global UNITY_MIR_SOCKET=$UNITY_MIR_SOCKET

        # Point unity8 at unity-system-compositor
        MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket
        initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
        initctl set-env MIR_SERVER_HOST_SOCKET=$UNITY_MIR_SOCKET

        # Point all future jobs in this session to our Mir socket instead of
        # unity-system-compositor's socket.
        initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
        gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
    fi

    # Remove the normal and trusted sockets if still there
    if [ -S "$MIR_SERVER_FILE" ]; then
        rm "$MIR_SERVER_FILE"
    fi

    if [ -S "${MIR_SERVER_FILE}_trusted" ]; then
        rm "${MIR_SERVER_FILE}_trusted"
    fi

    initctl set-env --global MIR_SERVER_PROMPT_FILE=1

    # Disable Qt's stuttering 'touch compression' to fix scrolling smoothness
    # issues (LP: #1486341, LP: #1556763). As a bonus, this eliminates most of
    # the lag seen in the indicator panel pull-down (LP: #1488327) and also
    # reduces lag seen in apps:
    initctl set-env --global QML_NO_TOUCH_COMPRESSION=1

    if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
        # On Ubuntu Touch, we currently use a trick where we auto-login the
        # user without a LightDM greeter at all.  In this case, we want to
        # start with the lockscreen visible.  Once we switch to using a
        # proper greeter for the first login, we can remove this code path.
        initctl set-env MODE=full-greeter
    else
        initctl set-env MODE=full-shell
    fi
end script

exec ${BINARY:-unity8} --mode=$MODE $ARGS

post-start script
    # If no MIR_SOCKET was defined on launch, we try to set one here
    if [ -z "$(initctl get-env --global UNITY_MIR_SOCKET)" ]; then
        if [ -S "$XDG_RUNTIME_DIR/mir_socket" ]; then
            mir_socket=$XDG_RUNTIME_DIR/mir_socket
        elif [ -S "/tmp/mir_socket" ]; then
            mir_socket=/tmp/mir_socket
        fi

        if [ -n "$mir_socket" ]; then
            initctl set-env --global MIR_SOCKET="$mir_socket"
        fi
    fi

    initctl emit --no-wait indicator-services-start
end script

post-stop script
    initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
    initctl unset-env --global UNITY_MIR_SOCKET
    initctl unset-env --global MIR_SERVER_PROMPT_FILE
    initctl emit application-end
end script