Skip to content

Commit

Permalink
Add systemd system and user service units for the D-Bus services
Browse files Browse the repository at this point in the history
The D-Bus system service (the mechanism) becomes a systemd system
service, and the D-Bus session service (the applet) becomes a systemd
user service.

In both cases, when systemd is used for service activation, this allows
placing the blueman-related process in its own cgroup (and applying
systemd resource control and life-cycle tracking), whereas without
these units the blueman processes would be part of the
dbus.service cgroup.

dbus running under systemd has provided system service activation via
systemd for some time. User service activation via systemd is a
recent addition (D-Bus 1.10) and not always enabled, but installing
the necessary metadata is harmless in any case.
  • Loading branch information
smcv authored and cschramm committed Oct 14, 2015
1 parent 076e632 commit b69e82b
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Makefile
/stamp-h1
/blueman/Constants.py
/blueman/plugins/mechanism/Rfcomm.py
/data/configs/blueman-applet.service
/data/configs/blueman-mechanism.service
/data/configs/org.blueman.Applet.service
/data/configs/org.blueman.Mechanism.service
/module/.deps
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Drop support for BlueZ 4
* Drop browse feature
* Add title to status icon
* Add systemd service units (@smcv / Simon McVittie)

### Bugs fixed

Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ data/icons/main_icon/Makefile
data/icons/pixmaps/Makefile
data/ui/Makefile
data/man/Makefile
data/configs/blueman-applet.service
data/configs/blueman-mechanism.service
data/configs/org.blueman.Applet.service
data/configs/org.blueman.Mechanism.service
module/Makefile
Expand Down
13 changes: 12 additions & 1 deletion data/configs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@ dbus_services_DATA = org.blueman.Mechanism.service
dbus_sessdir = $(datadir)/dbus-1/services
dbus_sess_DATA = org.blueman.Applet.service

systemd_systemdir = $(prefix)/lib/systemd/system
systemd_system_DATA = blueman-mechanism.service

systemd_userdir = $(prefix)/lib/systemd/user
systemd_user_DATA = blueman-applet.service

if HAVE_POLKIT
@INTLTOOL_POLICY_RULE@
policykitdir = $(datadir)/polkit-1/actions
policykit_in_files = org.blueman.policy.in
policykit_DATA = $(policykit_in_files:.policy.in=.policy)
endif

EXTRA_DIST = org.blueman.Mechanism.conf \
EXTRA_DIST = \
blueman-applet.service.in \
blueman-mechanism.service.in \
org.blueman.Mechanism.conf \
org.blueman.Applet.service.in \
org.blueman.Mechanism.service.in \
org.blueman.policy.in

CLEANFILES = \
blueman-applet.service \
blueman-mechanism.service \
org.blueman.Mechanism.service \
org.blueman.policy \
org.blueman.Applet.service \
Expand Down
7 changes: 7 additions & 0 deletions data/configs/blueman-applet.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Bluetooth management applet

[Service]
Type=dbus
BusName=org.blueman.Applet
ExecStart=@BINDIR@/blueman-applet
7 changes: 7 additions & 0 deletions data/configs/blueman-mechanism.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Bluetooth management mechanism

[Service]
Type=dbus
BusName=org.blueman.Mechanism
ExecStart=@LIBEXECDIR@/blueman-mechanism
1 change: 1 addition & 0 deletions data/configs/org.blueman.Applet.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=org.blueman.Applet
Exec=@BINDIR@/blueman-applet
SystemdService=blueman-applet.service
1 change: 1 addition & 0 deletions data/configs/org.blueman.Mechanism.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Name=org.blueman.Mechanism
Exec=@LIBEXECDIR@/blueman-mechanism
User=root
SystemdService=blueman-mechanism.service

0 comments on commit b69e82b

Please sign in to comment.