dbus: add optional D-Bus activation file for gpio-manager
Subsystems (2)
PATCH 1/1 dbus: add optional D-Bus activation file for gpio-manager
Add an io.gpiod1.service D-Bus system-service file whose SystemdService= points at gpio-manager.service, which lets dbus-daemon start the manager through systemd on demand when a client sends a request to io.gpiod1.
On-demand activation is not wanted on every system, so gate it behind a new dbus-activation feature option. It defaults to disabled and requires systemd support. When disabled, the activation file is not installed.
--- dbus/data/io.gpiod1.service.in | 8 ++++++++ dbus/data/meson.build | 13 +++++++++++++ meson.build | 6 ++++++ meson_options.txt | 3 +++ 4 files changed, 30 insertions(+) create mode 100644 dbus/data/io.gpiod1.service.in
dbus/data/io.gpiod1.service.in new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2026 Garmin Ltd. or its subsidiaries + +[D-BUS Service] +Name=io.gpiod1 +Exec=@prefix@/bin/gpio-manager +User=root +SystemdService=gpio-manager.service
dbus/data/meson.build +13 -0
@@ -18,6 +18,19 @@ if opt_systemd.allowed() and systemd_dep.found() install_data(gpio_manager_service, install_dir: systemd_unit_dir, ) + + if opt_dbus_activation.allowed() + dbus_service = configure_file( + input: 'io.gpiod1.service.in', + output: 'io.gpiod1.service', + configuration: service_conf, + ) + + install_data(dbus_service, + install_dir: get_option('datadir') / 'dbus-1' / 'system-services', + ) + endif + install_data('90-gpio.rules', install_dir: get_option('libdir') / 'udev' / 'rules.d', )
meson.build +6 -0
@@ -55,6 +55,7 @@ opt_bindings_glib = get_option('bindings-glib') opt_dbus = get_option('dbus') opt_introspection = get_option('introspection') opt_systemd = get_option('systemd') +opt_dbus_activation = get_option('dbus-activation') if opt_bindings_cxx.allowed() add_languages('cpp', native: false)
@@ -85,6 +86,11 @@ if opt_systemd.enabled() 'systemd support requires -Ddbus=enabled') endif +if opt_dbus_activation.enabled() + assert(opt_systemd.allowed(), + 'D-Bus activation requires -Dsystemd=enabled') +endif + libgpiod_inc = include_directories('include') libedit_dep = dependency('libedit', version: '>= 3.1', required: opt_gpioset_interactive)
meson_options.txt +3 -0
@@ -34,6 +34,9 @@ option('introspection', type: 'feature', option('systemd', type: 'feature', description: 'Install systemd unit and udev rules (requires dbus)') +option('dbus-activation', type: 'feature', value: 'disabled', + description: 'Install D-Bus activation file for gpio-manager (requires systemd)') + option('systemd-unit-dir', type: 'string', value: '', description: 'Directory for systemd system unit files (default: from pkg-config)')
Signature · 4 lines
base-commit: c2e9287333d7be588b3acaed7bbb1c58d7b551be Many Thanks, Payton
Bartosz Golaszewski
maintainerQuoted 25 lines · Payton Fack
Add an io.gpiod1.service D-Bus system-service file whose SystemdService= points at gpio-manager.service, which lets dbus-daemon start the manager through systemd on demand when a client sends a request to io.gpiod1.
On-demand activation is not wanted on every system, so gate it behind a new dbus-activation feature option. It defaults to disabled and requires systemd support. When disabled, the activation file is not installed.
Signed-off-by Payton Fack <[email protected]>--- dbus/data/io.gpiod1.service.in | 8 ++++++++ dbus/data/meson.build | 13 +++++++++++++ meson.build | 6 ++++++ meson_options.txt | 3 +++ 4 files changed, 30 insertions(+) create mode 100644 dbus/data/io.gpiod1.service.indbus/data/io.gpiod1.service.in new file +0
-0
dbus/data/io.gpiod1.service.in line 8
Quoted 8 lines
dbus/data/io.gpiod1.service.in new file +8
-0@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2026 Garmin Ltd. or its subsidiaries + +[D-BUS Service] +Name=io.gpiod1 +Exec=@prefix@/bin/gpio-manager +User=root +SystemdService=gpio-manager.service
This has none of the sandboxing features the original .service file has. :(
It also runs as root, as opposed to the gpio-manager user.
Quoted 37 lines
dbus/data/meson.build +13
-0@@ -18,6 +18,19 @@ if opt_systemd.allowed() and systemd_dep.found() install_data(gpio_manager_service, install_dir: systemd_unit_dir, ) + + if opt_dbus_activation.allowed() + dbus_service = configure_file( + input: 'io.gpiod1.service.in', + output: 'io.gpiod1.service', + configuration: service_conf, + ) + + install_data(dbus_service, + install_dir: get_option('datadir') / 'dbus-1' / 'system-services', + ) + endif + install_data('90-gpio.rules', install_dir: get_option('libdir') / 'udev' / 'rules.d', )meson.build +1
-0@@ -55,6 +55,7 @@ opt_bindings_glib = get_option('bindings-glib') opt_dbus = get_option('dbus') opt_introspection = get_option('introspection') opt_systemd = get_option('systemd') +opt_dbus_activation = get_option('dbus-activation') if opt_bindings_cxx.allowed() add_languages('cpp', native: false)
meson.build if opt_systemd.enabled() · line 90
Quoted 5 lines
meson.build +2
-0@@ -85,6 +86,11 @@ if opt_systemd.enabled() 'systemd support requires -Ddbus=enabled') endif +if opt_dbus_activation.enabled() + assert(opt_systemd.allowed(),
What about systemd_dep.found()? If we allow systemd but it's not found, the config will just ignore this one?
Quoted 23 lines
meson.build +3
-0+ 'D-Bus activation requires -Dsystemd=enabled') +endif + libgpiod_inc = include_directories('include') libedit_dep = dependency('libedit', version: '>= 3.1', required: opt_gpioset_interactive)meson_options.txt +3
-1@@ -34,6 +34,9 @@ option('introspection', type: 'feature', option('systemd', type: 'feature', description: 'Install systemd unit and udev rules (requires dbus)') +option('dbus-activation', type: 'feature', value: 'disabled', + description: 'Install D-Bus activation file for gpio-manager (requires systemd)') + option('systemd-unit-dir', type: 'string', value: '', description: 'Directory for systemd system unit files (default: from pkg-config)') --base-commit:
c2e9287333d7be588b3acaed7bbb1c58d7b551be
Quoted 4 lines
Many Thanks,
Payton
Thanks,
Bart
PATCH v2 1/1 dbus: add optional D-Bus activation file for gpio-manager
Add an io.gpiod1.service D-Bus system-service file whose SystemdService= points at gpio-manager.service, which lets dbus-daemon start the manager through systemd on demand when a client sends a request to io.gpiod1.
On-demand activation is not wanted on every system, so gate it behind a new dbus-activation feature option. It defaults to disabled and requires systemd support. When disabled, the activation file is not installed.
---
Quoted 3 lines · Bartosz Golaszewski
This has none of the sandboxing features the original .service file has. :(
It also runs as root, as opposed to the gpio-manager user.
I updated the file so that the dbus service must always use systemd to start, since dbus service files do not really have the same sandboxing features.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+if opt_dbus_activation.enabled() + assert(opt_systemd.allowed(),What about
systemd_dep.found()? If we allow systemd but it's not found, the config will just ignore this one?
Updated to use systemd_enabled
--- dbus/data/io.gpiod1.service | 8 ++++++++ dbus/data/meson.build | 7 +++++++ meson.build | 6 ++++++ meson_options.txt | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 dbus/data/io.gpiod1.service
dbus/data/io.gpiod1.service new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: 2026 Garmin Ltd. or its subsidiaries + +[D-BUS Service] +Name=io.gpiod1 +Exec=/bin/false +User=gpio-manager +SystemdService=gpio-manager.service
dbus/data/meson.build +7 -0
@@ -18,6 +18,13 @@ if opt_systemd.allowed() and systemd_dep.found() install_data(gpio_manager_service, install_dir: systemd_unit_dir, ) + + if opt_dbus_activation.allowed() + install_data('io.gpiod1.service', + install_dir: get_option('datadir') / 'dbus-1' / 'system-services', + ) + endif + install_data('90-gpio.rules', install_dir: get_option('libdir') / 'udev' / 'rules.d', )
meson.build +6 -0
@@ -55,6 +55,7 @@ opt_bindings_glib = get_option('bindings-glib') opt_dbus = get_option('dbus') opt_introspection = get_option('introspection') opt_systemd = get_option('systemd') +opt_dbus_activation = get_option('dbus-activation') if opt_bindings_cxx.allowed() add_languages('cpp', native: false)
@@ -172,6 +173,11 @@ else systemd_enabled = false endif +if opt_dbus_activation.enabled() + assert(systemd_enabled, + 'D-Bus activation requires systemd support, which is disabled or was not found') +endif + if opt_bindings_rust.allowed() cargo = find_program('cargo', required: opt_bindings_rust)
meson_options.txt +3 -0
@@ -34,6 +34,9 @@ option('introspection', type: 'feature', option('systemd', type: 'feature', description: 'Install systemd unit and udev rules (requires dbus)') +option('dbus-activation', type: 'feature', value: 'disabled', + description: 'Install D-Bus activation file for gpio-manager (requires systemd)') + option('systemd-unit-dir', type: 'string', value: '', description: 'Directory for systemd system unit files (default: from pkg-config)')
Signature · 4 lines
base commit: c2e9287333d7be588b3acaed7bbb1c58d7b551be Many Thanks, Payton
Bartosz Golaszewski
maintainerQuoted 13 lines · Payton Fack
Add an io.gpiod1.service D-Bus system-service file whose SystemdService= points at gpio-manager.service, which lets dbus-daemon start the manager through systemd on demand when a client sends a request to io.gpiod1.
On-demand activation is not wanted on every system, so gate it behind a new dbus-activation feature option. It defaults to disabled and requires systemd support. When disabled, the activation file is not installed.
Signed-off-by Payton Fack <[email protected]>---
On Wed, 28 Oct 2026 at 12:27, Bartosz Golaszewski <[email protected]> wrote:
Quoted 7 lines
Quoted 3 lines
This has none of the sandboxing features the original .service file has. :(
It also runs as root, as opposed to the gpio-manager user.
I updated the file so that the dbus service must always use systemd to start, since dbus service files do not really have the same sandboxing features.
Don't send new iterations in reply to previous threads. Each new iteration should be a new thread. Consider using b4 for managing patch series.
Please resend it as a new thread.
Thanks,
Bartosz