main/dbus: add an OpenRC user service for the login session bus

This commit is contained in:
Sören Tempel 2025-03-01 12:03:26 +01:00 committed by Sören Tempel
parent 5a876bc9d8
commit a4670f2536
4 changed files with 46 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dbus
pkgver=1.16.2
pkgrel=0
pkgrel=1
pkgdesc="Freedesktop.org message bus system"
url="https://www.freedesktop.org/Software/dbus"
arch="all"
@ -28,6 +28,9 @@ subpackages="
source="https://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.xz
$pkgname.initd
$pkgname.confd
$pkgname-user.initd
$pkgname-user.confd
README.alpine
"
# secfixes:
@ -53,9 +56,12 @@ check() {
package() {
DESTDIR="$pkgdir" meson install --no-rebuild -C output
install -Dm644 "$srcdir"/README.alpine -t "$pkgdir"/usr/share/doc/$pkgname
install -Dm755 "$srcdir"/dbus.initd "$pkgdir"/etc/init.d/dbus
install -Dm644 "$srcdir"/dbus.confd "$pkgdir"/etc/conf.d/dbus
install -Dm755 "$srcdir"/dbus-user.initd "$pkgdir"/etc/user/init.d/dbus
install -Dm644 "$srcdir"/dbus-user.confd "$pkgdir"/etc/user/conf.d/dbus
# can't install tmpfs
rm -r "$pkgdir"/run
@ -89,4 +95,7 @@ sha512sums="
5c26f52d85984bb9ae1dde8d7e73921eacbdf020a61ff15f00a4c240cb38a121553ee04bd66e62b28425ff9bc50f4f5e15135166573ac0888332a01a0db1faa2 dbus-1.16.2.tar.xz
ba871572fbac54ea4599a1f81653797c020302fc97876509a763693979787e16ad42252d18e02941296f7853712b003e0f7565977c1cfce581de2b16efc82897 dbus.initd
ea5df31eab4635da8af241c29878ca59927479f7bef71252416806d1504023da3c951a61bd6150fab0e1dbdde5ccfd91616db6043875b7babdf2bada873450dc dbus.confd
5d0ed444fd6f76f76d3e2be14a5c08c7db7af9c3349264776346cfaacfe8504624f53b192f3a5e9779b0988f9453203d6886698bd8adf87c930c14d686ddd35b dbus-user.initd
24099d0aed96681d90e6b2e9cc48f3b4bb2af10ce23af9bf1810e28a51fd7ad513b50bf378835ecb18889d5b22e43e613bf7689cf894c1bae97e27a4aff2130d dbus-user.confd
b2f271c18cbed0798d8a6f2570c6fe257ac0c718196d6ab092e812b92ec513e486fbfcaee16a95b4d896003e1d16388610459ad070c596c65aed9442c59cc01c README.alpine
"

20
main/dbus/README.alpine Normal file
View File

@ -0,0 +1,20 @@
## D-Bus Login Session Message Bus
If OpenRC user services are activated for the current user,
then it is possible to start (and supervise!) the D-Bus Login
Session Message Bus via OpenRC.
To do so run the following commands as the user:
$ rc-update add --user dbus
$ rc-service --user dbus start
Further, we need to inform application using dbus where they
can find the session bus. For this purpose, we need to set the
DBUS_SESSION_BUS_ADDRESS environment variable from your shell
configuration file:
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
This value must be aligned with `/etc/user/conf.d/dbus` to ensure
that this is the case, you can source that file from your shell.

View File

@ -0,0 +1,8 @@
# This file should _only_ export DBUS_SESSION_BUS_ADDRESS and
# shouldn't declare any other variables for now. This allows
# us to source this file from (a) other services which need
# this env and (b) the user's shell configuration files.
#
# See: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/80734#note_486342
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"

View File

@ -0,0 +1,8 @@
#!/sbin/openrc-run
name="Login Message Bus"
description="D-Bus Login Session Message Bus"
supervisor=supervise-daemon
command="/usr/bin/dbus-daemon"
command_args="--session --nofork --nopidfile --address=$DBUS_SESSION_BUS_ADDRESS"