Skip to content

Commit

Permalink
feat(24.04): add dbus slices (#293)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Rafid Bin Mostofa <[email protected]>
Co-authored-by: Cristovao Cordeiro <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2024
1 parent c8b6fde commit c18a0fe
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 0 deletions.
20 changes: 20 additions & 0 deletions slices/dbus-bin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package: dbus-bin

essential:
- dbus-bin_copyright

slices:
bins:
essential:
- libc6_libs
- libdbus-1-3_libs
contents:
/usr/bin/dbus-cleanup-sockets:
/usr/bin/dbus-monitor:
/usr/bin/dbus-send:
/usr/bin/dbus-update-activation-environment:
/usr/bin/dbus-uuidgen:

copyright:
contents:
/usr/share/doc/dbus-bin/copyright:
31 changes: 31 additions & 0 deletions slices/dbus-daemon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package: dbus-daemon

essential:
- dbus-daemon_copyright

slices:
bins:
essential:
- dbus-bin_bins
- dbus-daemon_config
- dbus-session-bus-common_config
- libapparmor1_libs
- libaudit1_libs
- libc6_libs
- libcap-ng0_libs
- libdbus-1-3_libs
- libexpat1_libs
- libselinux1_libs
- libsystemd0_libs
contents:
/usr/bin/dbus-daemon:
/usr/bin/dbus-run-session:
/var/lib/dbus/: { make: true, mode: 0755 }

config:
contents:
/usr/lib/tmpfiles.d/dbus.conf:

copyright:
contents:
/usr/share/doc/dbus-daemon/copyright:
14 changes: 14 additions & 0 deletions slices/dbus-session-bus-common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package: dbus-session-bus-common

essential:
- dbus-session-bus-common_copyright

slices:
config:
contents:
/etc/dbus-1/session.d/:
/usr/share/dbus-1/session.conf:

copyright:
contents:
/usr/share/doc/dbus-session-bus-common/copyright:
23 changes: 23 additions & 0 deletions slices/dbus-system-bus-common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package: dbus-system-bus-common

essential:
- dbus-system-bus-common_copyright

slices:
# Depends on adduser, however it's used by the dbus postinst
# to create the following user:
# 'messagebus' without a home directory and disabled password
config:
contents:
/etc/dbus-1/system.d/:
/usr/lib/sysusers.d/dbus.conf:
/usr/share/dbus-1/system.conf:

services:
contents:
/usr/lib/systemd/system/dbus.socket:
/usr/lib/systemd/system/sockets.target.wants/dbus.socket:

copyright:
contents:
/usr/share/doc/dbus-system-bus-common/copyright:
35 changes: 35 additions & 0 deletions slices/dbus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package: dbus

essential:
- dbus_copyright

slices:
bins:
essential:
- dbus-bin_bins
- dbus-daemon_bins
- dbus-system-bus-common_config
- dbus_config
- libc6_libs
- libdbus-1-3_libs
- libexpat1_libs
- libsystemd0_libs
contents:
/etc/init.d/dbus:
/usr/lib/dbus-*/dbus-daemon-launch-helper:

config:
contents:
/etc/default/dbus:

services:
essential:
- dbus-system-bus-common_services
- dbus_bins
contents:
/usr/lib/systemd/system/dbus.service:
/usr/lib/systemd/system/multi-user.target.wants/dbus.service:

copyright:
contents:
/usr/share/doc/dbus/copyright:
16 changes: 16 additions & 0 deletions slices/libdbus-1-3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package: libdbus-1-3

essential:
- libdbus-1-3_copyright

slices:
libs:
essential:
- libc6_libs
- libsystemd0_libs
contents:
/usr/lib/*-linux-*/libdbus-1.so.3*:

copyright:
contents:
/usr/share/doc/libdbus-1-3/copyright:
20 changes: 20 additions & 0 deletions tests/spread/integration/dbus/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
summary: Integration tests for dbus

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices base-files_base bash_bins coreutils_bins passwd_config dbus_bins)"
# we need /dev/null for testing
mkdir "${rootfs}"/dev
mount --bind /dev "${rootfs}"/dev
# we also need a messagebus user
useradd -R "${rootfs}" -c "dbus messagebus test user" -u 1234 -g 1 -M messagebus
cp test.sh "${rootfs}/"
chroot "${rootfs}/" /test.sh
# cleanup the daemon and mount
pkill -9 -f dbus-daemon
umount "${rootfs}"/dev
13 changes: 13 additions & 0 deletions tests/spread/integration/dbus/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# First thing is to create a system uuid
mkdir -p /var/lib/dbus/
dbus-uuidgen > /var/lib/dbus/machine-id

# Start the daemon
mkdir -p /run/dbus
dbus-daemon --system

# Test by sending, but allow a moment for the service to get up
sleep 1
dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames

0 comments on commit c18a0fe

Please sign in to comment.