Skip to content

Commit 757b2d5

Browse files
committed
perf: optimize systemd services startup and cleanup dependencies
- Change dde-shell and dde-shell-plugin services to Type=dbus and specify BusName to ensure correct startup order. - Remove obsolete application manager dependencies and comments in dde-shell service. - Use ConditionEnvironment in dde-session@x11 service and consolidate ExecStartPre for better performance. - 将 dde-shell 和 dde-shell-plugin 服务类型改为 Type=dbus 并指定 BusName,确保正确的启动顺序。 - 移除 dde-shell 服务中过时的应用管理器依赖及注释。 - 在 dde-session@x11 服务中改用 ConditionEnvironment 并合并 ExecStartPre 以提升性能。 Log: optimize systemd services startup and cleanup dependencies Pms: TASK-384099 Change-Id: I75754a0dd09172d891237955456d881a86cee34b
1 parent c3fb674 commit 757b2d5

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

systemd/dde-session-core.target.wants/dde-shell-plugin@org.deepin.ds.desktop.service

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Requires=dbus.socket
1515
After=dbus.socket
1616

1717
[Service]
18-
Type=simple
18+
Type=dbus
19+
BusName=com.deepin.dde.desktop
1920
ExecStart=/usr/bin/dde-shell -p %I
2021
TimeoutStartSec=infinity
2122
Slice=session.slice

systemd/dde-session-core.target.wants/dde-shell@DDE.service

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,12 @@ Before=dde-session-core.target
1414
Requires=dbus.socket
1515
After=dbus.socket
1616

17-
#FIXME: maybe AM is invalid
18-
# old AM
19-
Wants=org.deepin.dde.Application1.Manager.service
20-
After=org.deepin.dde.Application1.Manager.service
21-
# new AM
17+
# AM
2218
Wants=org.desktopspec.ApplicationManager1.service
23-
After=org.desktopspec.ApplicationManager1.service
24-
25-
# No longer needed. Just a dependency of some of dde-shell's plugins.
26-
# Wants=org.dde.session.Daemon1.service
27-
# After=org.dde.session.Daemon1.service
2819

2920
[Service]
30-
Type=simple
21+
Type=dbus
22+
BusName=org.deepin.dde.Dock1
3123
ExecStart=/usr/bin/dde-shell -C %I --serviceName=org.deepin.dde.shell -d org.deepin.ds.desktop
3224
TimeoutStartSec=infinity
3325
Slice=session.slice

systemd/dde-session-pre.target.wants/dde-session@x11.service

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[Unit]
22
Description=dde on X11
33
CollectMode=inactive-or-failed
4+
# Only start if the template instance matches the session type (systemd >= 246)
5+
ConditionEnvironment=XDG_SESSION_TYPE=%I
46

57
PartOf=dde-session-pre.target
68
Before=dde-session-pre.target
@@ -12,13 +14,7 @@ StartLimitBurst=3
1214
[Service]
1315
Slice=session.slice
1416
Type=notify
15-
# NOTE: This can be replaced with ConditionEnvironment=XDG_SESSION_TYPE=%I in
16-
# the [Unit] section with systemd >= 246. Also, the current solution is
17-
# kind of painful as systemd had a bug where it retries the condition.
18-
# Only start if the template instance matches the session type.
19-
ExecCondition=/bin/sh -c 'test "$XDG_SESSION_TYPE" = "%I" || exit 2'
20-
ExecStartPre=-/bin/sh -c 'cp -n /etc/xdg/kglobalshortcutsrc $HOME/.config/kglobalshortcutsrc'
21-
ExecStartPre=-/bin/sh -c 'sed -i "s/deepin-kwin/kwin/g" $HOME/.config/kglobalshortcutsrc'
17+
ExecStartPre=-/bin/sh -c 'cp -n /etc/xdg/kglobalshortcutsrc "$HOME/.config/kglobalshortcutsrc"; sed -i "s/deepin-kwin/kwin/g" "$HOME/.config/kglobalshortcutsrc"'
2218
ExecStart=/usr/bin/kwin_x11 --replace
2319
# Exit code 1 means we are probably *not* dealing with an extension failure
2420
SuccessExitStatus=1

0 commit comments

Comments
 (0)