Merge lp:~mterry/unity8/systemd into lp:unity8

Proposed by Michael Terry
Status: Work in progress
Proposed branch: lp:~mterry/unity8/systemd
Merge into: lp:unity8
Diff against target: 432 lines (+98/-150)
17 files modified
data/unity8-dash.conf (+0/-25)
data/unity8-dash.service (+15/-0)
data/unity8-filewatcher.conf (+0/-13)
data/unity8-session (+46/-0)
data/unity8.conf (+0/-82)
data/unity8.service (+15/-0)
debian/control (+4/-1)
debian/rules (+1/-1)
debian/unity8.install (+3/-3)
plugins/Unity/Launcher/dbusinterface.cpp (+2/-0)
plugins/Unity/Session/dbusunitysessionservice.cpp (+5/-11)
tests/plugins/Unity/Session/CMakeLists.txt (+1/-0)
tests/plugins/Unity/Session/LogindServer.cpp (+0/-5)
tests/plugins/Unity/Session/LogindServer.h (+0/-1)
tests/plugins/Unity/Session/interfaces.xml (+0/-4)
tests/plugins/Unity/Session/server.cpp (+1/-1)
tests/plugins/Unity/Session/sessionbackendtest.cpp (+5/-3)
To merge this branch: bzr merge lp:~mterry/unity8/systemd
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+321557@code.launchpad.net

Commit message

WIP

To post a comment you must log in.
lp:~mterry/unity8/systemd updated
2894. By Michael Terry

Fix up some packaging bits

2895. By Michael Terry

Add missing service file

Unmerged revisions

2895. By Michael Terry

Add missing service file

2894. By Michael Terry

Fix up some packaging bits

2893. By Michael Terry

Fix trapping of STOP

2892. By Michael Terry

First (unfinished) pass at systemd unit for unity8

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'data/unity8-dash.conf'
--- data/unity8-dash.conf 2016-10-07 17:22:21 +0000
+++ data/unity8-dash.conf 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1description "Unity Shell v8 Dash"
2author "Michael Zanetti <michael.zanetti@canonical.com>"
3
4emits scope-ui-starting
5
6start on started unity8
7stop on stopping unity8
8
9kill timeout 120
10
11# Focused app is 100 so we want to be less likely to get
12# killed than the focused app but more than Unity8
13
14oom score 50
15
16respawn
17respawn limit unlimited
18
19env APP_ID=unity8-dash
20
21pre-start script
22 initctl emit scope-ui-starting
23end script
24
25exec ${BINARY:-unity8-dash} $ARGS --desktop_file_hint=unity8-dash.desktop
260
=== added file 'data/unity8-dash.service'
--- data/unity8-dash.service 1970-01-01 00:00:00 +0000
+++ data/unity8-dash.service 2017-04-03 17:54:55 +0000
@@ -0,0 +1,15 @@
1[Unit]
2Description=Unity Shell v8 Dash
3PartOf=graphical-session.target
4BindsTo=unity8.service
5After=unity8.service
6
7[Service]
8ExecStart=/usr/bin/unity8-dash --desktop_file_hint=unity8-dash
9Restart=always
10TimeoutStartSec=120
11Environment=APP_ID=unity8-dash
12
13# Focused app is 100 so we want to be less likely to get
14# killed than the focused app but more than Unity8
15OOMScoreAdjust=50
016
=== removed file 'data/unity8-filewatcher.conf'
--- data/unity8-filewatcher.conf 2016-10-07 17:22:21 +0000
+++ data/unity8-filewatcher.conf 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1description "File system watcher for unity8"
2author "Michael Zanetti <michael.zanetti@canonical.com>"
3
4# This method of updating the launcher will not work in our new snappy world,
5# neither for snaps installed in the system nor if we are running inside a snap.
6# Plus it hardcodes the phablet user... To be replaced once bug 1630997 is
7# fixed in ubuntu-app-launch.
8
9# Workaround for bug 1360208. ~ and * in one expression doesn't work currently
10start on (file FILE=/home/phablet/.local/share/applications/*.desktop) or (file FILE=/usr/share/applications/*.desktop)
11
12exec dbus-send --type=method_call --dest=com.canonical.Unity.Launcher /com/canonical/Unity/Launcher com.canonical.Unity.Launcher.Refresh
13
140
=== added file 'data/unity8-session'
--- data/unity8-session 1970-01-01 00:00:00 +0000
+++ data/unity8-session 2017-04-03 17:54:55 +0000
@@ -0,0 +1,46 @@
1#!/bin/sh
2# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 2 -*-
3
4# Ensure the shell always gets unthrottled touch events, so that applications
5# who want full speed low-latency input can get it (LP: #1497105) and so that
6# apps can use QML touch compression safely (the QML touch compression
7# algorithm does not support nesting well - LP: #1486341, LP: #1556763 - so
8# must be fed by the raw input event stream from Unity8).
9export QML_NO_TOUCH_COMPRESSION=1
10
11export MIR_SERVER_PROMPT_FILE=1
12
13# Hard code socket path because our snappy apparmor profile
14# only lets us put the socket in one place. And consumers expect it there.
15# (XDG_RUNTIME_DIR isn't typical under snappy)
16export MIR_SERVER_FILE=/run/user/$(id -u)/mir_socket
17
18rm -f "$MIR_SERVER_FILE"
19rm -f "${MIR_SERVER_FILE}_trusted"
20
21if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
22 # On Ubuntu Touch, we currently use a trick where we auto-login the
23 # user without a LightDM greeter at all. In this case, we want to
24 # start with the lockscreen visible. Once we switch to using a
25 # proper greeter for the first login, we can remove this code path.
26 MODE=full-greeter
27else
28 MODE=full-shell
29fi
30
31dbus-update-activation-environment --systemd MIR_SOCKET=$MIR_SERVER_FILE
32
33# Tell unity-mir to raise SIGSTOP after we start, which we use to tell
34# systemd when we are done starting up.
35export UNITY_MIR_EMITS_SIGSTOP=1
36
37${BINARY:-unity8} --mode=$MODE "$@" &
38child=$!
39
40# Wait for SIGSTOP in child
41while [ $(ps --no-headers -o state $child) != "T" ]; do
42 sleep 0.1
43done
44
45kill -CONT $child
46exit 0
047
=== removed file 'data/unity8.conf'
--- data/unity8.conf 2017-02-08 15:46:18 +0000
+++ data/unity8.conf 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1description "Unity Shell v8"
2author "Ricardo Mendoza <ricmm@ubuntu.com>"
3
4emits indicator-services-start
5
6start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=unity8-mir) or (xsession SESSION=unity8)) and started dbus
7stop on desktop-end
8
9kill timeout 120
10
11#
12# Ensure the shell always gets unthrottled touch events, so that applications
13# who want full speed low-latency input can get it (LP: #1497105) and so that
14# apps can use QML touch compression safely (the QML touch compression
15# algorithm does not support nesting well - LP: #1486341, LP: #1556763 - so
16# must be fed by the raw input event stream from Unity8).
17#
18env QML_NO_TOUCH_COMPRESSION=1
19
20respawn
21expect stop
22
23# FIXME Create an autopilot test that makes sure start+stop and restart
24# work fine at least 2 times
25
26pre-start script
27 # Tell unity-mir to raise SIGSTOP after we start
28 initctl set-env UNITY_MIR_EMITS_SIGSTOP=1
29
30 # Save original value of MIR_SOCKET so that we can restore it when stopped,
31 # as we modify the variable for future jobs, including ourself.
32 initctl set-env UNITY_MIR_SOCKET=$MIR_SOCKET
33
34 # Decide where we are going to put our own socket file
35 if [ -n "$SNAP" ]; then
36 # In snappy, we want to hard code our path because our apparmor profile
37 # only lets us put the socket in one place. And consumers expect it
38 # there.
39 MIR_SERVER_FILE=/run/user/$(id -u)/mir_socket
40 else
41 MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket
42 fi
43 initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
44
45 # Point all future jobs in this session to our Mir socket instead of
46 # unity-system-compositor's socket.
47 initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
48 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
49
50 # Remove the normal and trusted sockets if still there
51 if [ -S "$MIR_SERVER_FILE" ]; then
52 rm "$MIR_SERVER_FILE"
53 fi
54
55 if [ -S "${MIR_SERVER_FILE}_trusted" ]; then
56 rm "${MIR_SERVER_FILE}_trusted"
57 fi
58
59 initctl set-env --global MIR_SERVER_PROMPT_FILE=1
60
61 if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
62 # On Ubuntu Touch, we currently use a trick where we auto-login the
63 # user without a LightDM greeter at all. In this case, we want to
64 # start with the lockscreen visible. Once we switch to using a
65 # proper greeter for the first login, we can remove this code path.
66 initctl set-env MODE=full-greeter
67 else
68 initctl set-env MODE=full-shell
69 fi
70end script
71
72exec ${BINARY:-unity8} --mode=$MODE $ARGS
73
74post-start script
75 initctl emit --no-wait indicator-services-start
76end script
77
78post-stop script
79 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
80 initctl unset-env --global MIR_SERVER_PROMPT_FILE
81 initctl emit application-end
82end script
830
=== added file 'data/unity8.service'
--- data/unity8.service 1970-01-01 00:00:00 +0000
+++ data/unity8.service 2017-04-03 17:54:55 +0000
@@ -0,0 +1,15 @@
1[Unit]
2Description=Unity Shell v8
3PartOf=graphical-session.target
4Requires=dbus.socket
5After=dbus.socket
6Before=indicators.target
7Wants=unity8-dash.service
8Wants=indicators.target
9
10[Service]
11Type=forking
12ExecStart=/usr/bin/unity8-session
13ExecStopPost=/usr/bin/dbus-update-activation-environment --systemd MIR_SOCKET=
14Restart=on-failure
15TimeoutStartSec=120
016
=== modified file 'debian/control'
--- debian/control 2017-03-20 10:19:11 +0000
+++ debian/control 2017-04-03 17:54:55 +0000
@@ -6,6 +6,7 @@
6 dbus-test-runner,6 dbus-test-runner,
7 debhelper (>= 9),7 debhelper (>= 9),
8 dh-apparmor,8 dh-apparmor,
9 dh-systemd,
9 doxyqml,10 doxyqml,
10# To allow cross-compiling to work, we also must append :native11# To allow cross-compiling to work, we also must append :native
11# to g++ so we don't try to run arm g++12# to g++ so we don't try to run arm g++
@@ -71,6 +72,7 @@
71 qtdeclarative5-private-dev (>= 5.6),72 qtdeclarative5-private-dev (>= 5.6),
72 qtdeclarative5-ubuntu-content1,73 qtdeclarative5-ubuntu-content1,
73 qtdeclarative5-ubuntu-settings-components (>= 0.11),74 qtdeclarative5-ubuntu-settings-components (>= 0.11),
75 systemd,
74 ttf-ubuntu-font-family,76 ttf-ubuntu-font-family,
75 xvfb,77 xvfb,
76Standards-Version: 3.9.478Standards-Version: 3.9.4
@@ -120,7 +122,8 @@
120Package: unity8122Package: unity8
121Architecture: any123Architecture: any
122Provides: indicator-renderer,124Provides: indicator-renderer,
123Depends: dmz-cursor-theme,125Depends: dbus,
126 dmz-cursor-theme,
124 gsettings-desktop-schemas,127 gsettings-desktop-schemas,
125 libcap2-bin,128 libcap2-bin,
126 libglib2.0-bin,129 libglib2.0-bin,
127130
=== modified file 'debian/rules'
--- debian/rules 2017-01-18 00:25:13 +0000
+++ debian/rules 2017-04-03 17:54:55 +0000
@@ -9,7 +9,7 @@
9export NO_PNG_PKG_MANGLE=19export NO_PNG_PKG_MANGLE=1
1010
11%:11%:
12 dh $@ --parallel --fail-missing --with python312 dh $@ --parallel --fail-missing --with python3,systemd
1313
14override_dh_auto_configure:14override_dh_auto_configure:
15 # Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong.15 # Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong.
1616
=== modified file 'debian/unity8.install'
--- debian/unity8.install 2016-10-04 16:21:38 +0000
+++ debian/unity8.install 2017-04-03 17:54:55 +0000
@@ -1,8 +1,8 @@
1debian/usr.bin.unity8-dash etc/apparmor.d1debian/usr.bin.unity8-dash etc/apparmor.d
2var/lib/unity8/version2var/lib/unity8/version
3data/unity8-dash.conf usr/share/upstart/sessions/3data/unity8.service usr/lib/systemd/user
4data/unity8-filewatcher.conf usr/share/upstart/sessions/4data/unity8-dash.service usr/lib/systemd/user
5data/unity8.conf usr/share/upstart/sessions/5data/unity8-session usr/bin
6data/devices.conf etc/ubuntu/6data/devices.conf etc/ubuntu/
7usr/bin/unity87usr/bin/unity8
8usr/bin/unity8-dash8usr/bin/unity8-dash
99
=== modified file 'plugins/Unity/Launcher/dbusinterface.cpp'
--- plugins/Unity/Launcher/dbusinterface.cpp 2015-11-20 15:01:39 +0000
+++ plugins/Unity/Launcher/dbusinterface.cpp 2017-04-03 17:54:55 +0000
@@ -39,6 +39,8 @@
39 QString nodes;39 QString nodes;
4040
41 // Add Refresh to introspect41 // Add Refresh to introspect
42 // TODO: Confirm this is still used anywhere and remove if not.
43 // It used to be used in an upstart job when desktop fles changed.
42 nodes = QStringLiteral("<interface name=\"com.canonical.Unity.Launcher\">"44 nodes = QStringLiteral("<interface name=\"com.canonical.Unity.Launcher\">"
43 "<method name=\"Refresh\"/>"45 "<method name=\"Refresh\"/>"
44 "</interface>");46 "</interface>");
4547
=== modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp'
--- plugins/Unity/Session/dbusunitysessionservice.cpp 2017-03-21 10:51:38 +0000
+++ plugins/Unity/Session/dbusunitysessionservice.cpp 2017-04-03 17:54:55 +0000
@@ -36,6 +36,7 @@
3636
37#define LOGIN1_SERVICE QStringLiteral("org.freedesktop.login1")37#define LOGIN1_SERVICE QStringLiteral("org.freedesktop.login1")
38#define LOGIN1_PATH QStringLiteral("/org/freedesktop/login1")38#define LOGIN1_PATH QStringLiteral("/org/freedesktop/login1")
39#define LOGIN1_SESSION_ROOT QStringLiteral("/org/freedesktop/login1/session/")
39#define LOGIN1_IFACE QStringLiteral("org.freedesktop.login1.Manager")40#define LOGIN1_IFACE QStringLiteral("org.freedesktop.login1.Manager")
40#define LOGIN1_SESSION_IFACE QStringLiteral("org.freedesktop.login1.Session")41#define LOGIN1_SESSION_IFACE QStringLiteral("org.freedesktop.login1.Session")
4142
@@ -58,16 +59,9 @@
5859
59 void init()60 void init()
60 {61 {
61 // get our logind session path62 QString sessionID = QString::fromLocal8Bit(qgetenv("XDG_SESSION_ID"));
62 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,63 if (!sessionID.isEmpty()) {
63 LOGIN1_PATH,64 logindSessionPath = LOGIN1_SESSION_ROOT + sessionID;
64 LOGIN1_IFACE,
65 QStringLiteral("GetSessionByPID"));
66 msg << (quint32) getpid();
67
68 QDBusReply<QDBusObjectPath> reply = QDBusConnection::SM_BUSNAME().call(msg);
69 if (reply.isValid()) {
70 logindSessionPath = reply.value().path();
7165
72 // start watching the Active property66 // start watching the Active property
73 QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),67 QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
@@ -79,7 +73,7 @@
79 QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),73 QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
80 this, SLOT(onResuming(bool)));74 this, SLOT(onResuming(bool)));
81 } else {75 } else {
82 qWarning() << "Failed to get logind session path" << reply.error().message();76 qWarning() << "Failed to get logind session: XDG_SESSION_ID is not set";
83 }77 }
84 }78 }
8579
8680
=== modified file 'tests/plugins/Unity/Session/CMakeLists.txt'
--- tests/plugins/Unity/Session/CMakeLists.txt 2017-03-14 18:51:23 +0000
+++ tests/plugins/Unity/Session/CMakeLists.txt 2017-04-03 17:54:55 +0000
@@ -60,6 +60,7 @@
6060
61add_unity8_unittest(SessionBackend dbus-test-runner61add_unity8_unittest(SessionBackend dbus-test-runner
62 ENVIRONMENT LD_PRELOAD=$<TARGET_FILE:SessionBackendTestPreload>62 ENVIRONMENT LD_PRELOAD=$<TARGET_FILE:SessionBackendTestPreload>
63 XDG_SESSION_ID=testing
63 XDG_SESSION_PATH=/session64 XDG_SESSION_PATH=/session
64 ARG_PREFIX "--parameter"65 ARG_PREFIX "--parameter"
65 ARGS66 ARGS
6667
=== modified file 'tests/plugins/Unity/Session/LogindServer.cpp'
--- tests/plugins/Unity/Session/LogindServer.cpp 2017-03-15 21:31:32 +0000
+++ tests/plugins/Unity/Session/LogindServer.cpp 2017-04-03 17:54:55 +0000
@@ -22,11 +22,6 @@
22{22{
23}23}
2424
25QDBusObjectPath LogindServer::GetSessionByPID(quint32)
26{
27 return QDBusObjectPath("/logindsession");
28}
29
30void LogindServer::Reboot(bool interactive)25void LogindServer::Reboot(bool interactive)
31{26{
32 Q_EMIT RebootCalled(interactive);27 Q_EMIT RebootCalled(interactive);
3328
=== modified file 'tests/plugins/Unity/Session/LogindServer.h'
--- tests/plugins/Unity/Session/LogindServer.h 2017-03-15 21:31:32 +0000
+++ tests/plugins/Unity/Session/LogindServer.h 2017-04-03 17:54:55 +0000
@@ -30,7 +30,6 @@
30 explicit LogindServer(QObject *parent = nullptr);30 explicit LogindServer(QObject *parent = nullptr);
3131
32public Q_SLOTS:32public Q_SLOTS:
33 QDBusObjectPath GetSessionByPID(quint32 pid);
34 void Reboot(bool interactive);33 void Reboot(bool interactive);
35 void PowerOff(bool interactive);34 void PowerOff(bool interactive);
3635
3736
=== modified file 'tests/plugins/Unity/Session/interfaces.xml'
--- tests/plugins/Unity/Session/interfaces.xml 2017-03-15 21:31:32 +0000
+++ tests/plugins/Unity/Session/interfaces.xml 2017-04-03 17:54:55 +0000
@@ -3,10 +3,6 @@
3 <method name="Lock" />3 <method name="Lock" />
4 </interface>4 </interface>
5 <interface name="org.freedesktop.login1.Manager">5 <interface name="org.freedesktop.login1.Manager">
6 <method name="GetSessionByPID">
7 <arg name="pid" type="u" direction="in" />
8 <arg name="session" type="o" direction="out" />
9 </method>
10 <method name="Reboot">6 <method name="Reboot">
11 <arg name="interactive" type="b" direction="in" />7 <arg name="interactive" type="b" direction="in" />
12 </method>8 </method>
139
=== modified file 'tests/plugins/Unity/Session/server.cpp'
--- tests/plugins/Unity/Session/server.cpp 2016-06-21 14:23:49 +0000
+++ tests/plugins/Unity/Session/server.cpp 2017-04-03 17:54:55 +0000
@@ -37,7 +37,7 @@
37 auto connection = QDBusConnection::sessionBus();37 auto connection = QDBusConnection::sessionBus();
38 if (!connection.registerObject("/org/freedesktop/login1", logind))38 if (!connection.registerObject("/org/freedesktop/login1", logind))
39 return 1;39 return 1;
40 if (!connection.registerObject("/logindsession", logind))40 if (!connection.registerObject("/org/freedesktop/login1/session/testing", logind))
41 return 1;41 return 1;
42 if (!connection.registerService("org.freedesktop.login1"))42 if (!connection.registerService("org.freedesktop.login1"))
43 return 1;43 return 1;
4444
=== modified file 'tests/plugins/Unity/Session/sessionbackendtest.cpp'
--- tests/plugins/Unity/Session/sessionbackendtest.cpp 2017-03-21 10:51:38 +0000
+++ tests/plugins/Unity/Session/sessionbackendtest.cpp 2017-04-03 17:54:55 +0000
@@ -103,8 +103,8 @@
103 QCoreApplication::processEvents(); // to let the services register on DBus103 QCoreApplication::processEvents(); // to let the services register on DBus
104104
105 QDBusInterface login1Interface("org.freedesktop.login1",105 QDBusInterface login1Interface("org.freedesktop.login1",
106 "/logindsession",106 "/org/freedesktop/login1/session/testing",
107 "org.freedesktop.login1.Manager");107 "org.freedesktop.login1.Manager");
108 QSignalSpy spy(&login1Interface, signal.toUtf8().data());108 QSignalSpy spy(&login1Interface, signal.toUtf8().data());
109109
110 QDBusInterface dbusGnomeSessionWrapper("org.gnome.SessionManager",110 QDBusInterface dbusGnomeSessionWrapper("org.gnome.SessionManager",
@@ -225,7 +225,9 @@
225 DBusUnitySessionService dbusUnitySessionService;225 DBusUnitySessionService dbusUnitySessionService;
226 QCoreApplication::processEvents(); // to let the service register on DBus226 QCoreApplication::processEvents(); // to let the service register on DBus
227227
228 QDBusInterface iface("org.freedesktop.login1", "/logindsession", "org.freedesktop.login1.Session");228 QDBusInterface iface("org.freedesktop.login1",
229 "/org/freedesktop/login1/session/testing",
230 "org.freedesktop.login1.Session");
229 QVERIFY(iface.isValid());231 QVERIFY(iface.isValid());
230232
231 QSignalSpy spy(&dbusUnitySessionService, SIGNAL(Unlocked()));233 QSignalSpy spy(&dbusUnitySessionService, SIGNAL(Unlocked()));

Subscribers

People subscribed via source and target branches