#5 Provide downstream systemd units
Merged 5 years ago by amigadave. Opened 5 years ago by dvdhrm.
https://github.com/dvdhrm/rpm-dbus.git broker3  into  master

dbus: move generic units into 'dbus-common'
David Herrmann • 5 years ago  
dbus: make use of [Install] unit sections
David Herrmann • 5 years ago  
dbus: provide custom units
David Herrmann • 5 years ago  
dbus-daemon.service
file added
+13
@@ -0,0 +1,13 @@

+ [Unit]

+ Description=D-Bus System Message Bus

+ Documentation=man:dbus-daemon(1)

+ Requires=dbus.socket

+ 

+ [Service]

+ ExecStart=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

+ ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig

+ OOMScoreAdjust=-900

+ 

+ [Install]

+ Alias=dbus.service

+ WantedBy=multi-user.target

dbus-daemon.user.service
file added
+11
@@ -0,0 +1,11 @@

+ [Unit]

+ Description=D-Bus User Message Bus

+ Documentation=man:dbus-daemon(1)

+ Requires=dbus.socket

+ 

+ [Service]

+ ExecStart=/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

+ ExecReload=/usr/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig

+ 

+ [Install]

+ Alias=dbus.service

dbus.socket
file added
+8
@@ -0,0 +1,8 @@

+ [Unit]

+ Description=D-Bus System Message Bus Socket

+ 

+ [Socket]

+ ListenStream=/run/dbus/system_bus_socket

+ 

+ [Install]

+ WantedBy=sockets.target

dbus.spec
file modified
+50 -20
@@ -5,6 +5,9 @@

  

  %global libselinux_version      2.0.86

  

+ # fedora-release-30-0.2 added required presets to enable systemd-unit symlinks

+ %global system_release_version  30-0.2

+ 

  %global dbus_user_uid           81

  

  %global dbus_common_config_opts --enable-libaudit --enable-selinux=yes --with-system-socket=/run/dbus/system_bus_socket --with-dbus-user=dbus --libexecdir=/%{_libexecdir}/dbus-1 --enable-user-session --docdir=%{_pkgdocdir} --enable-installed-tests
@@ -19,7 +22,7 @@

  Name:    dbus

  Epoch:   1

  Version: 1.12.10

- Release: 1%{?dist}

+ Release: 2%{?dist}

  Summary: D-BUS message bus

  

  Group:   System Environment/Libraries
@@ -30,6 +33,10 @@

  #VCS:    git:git://git.freedesktop.org/git/dbus/dbus

  Source0: https://dbus.freedesktop.org/releases/%{name}/%{name}-%{version}.tar.gz

  Source1: 00-start-message-bus.sh

+ Source2: dbus.socket

+ Source3: dbus-daemon.service

+ Source4: dbus.user.socket

+ Source5: dbus-daemon.user.service

  Patch0: 0001-tools-Use-Python3-for-GetAllMatchRules.patch

  

  BuildRequires: autoconf-archive
@@ -80,6 +87,7 @@

  Group:          System Environment/Libraries

  BuildArch:      noarch

  Requires(pre):  /usr/sbin/useradd

+ Requires:       system-release >= %{system_release_version}

  

  %description common

  The %{name}-common package provides the configuration and setup files for D-Bus
@@ -202,7 +210,24 @@

  rm -rf %{buildroot}%{_libdir}/cmake

  %endif

  

+ # Delete upstream units

+ rm -f %{buildroot}%{_unitdir}/dbus.{socket,service}

+ rm -f %{buildroot}%{_unitdir}/sockets.target.wants/dbus.socket

+ rm -f %{buildroot}%{_unitdir}/multi-user.target.wants/dbus.service

+ rm -f %{buildroot}%{_userunitdir}/dbus.{socket,service}

+ rm -f %{buildroot}%{_userunitdir}/sockets.target.wants/dbus.socket

+ 

+ # Install downstream units

  install -Dp -m755 %{SOURCE1} %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/00-start-message-bus.sh

+ install -Dp -m644 %{SOURCE2} %{buildroot}%{_unitdir}/dbus.socket

+ install -Dp -m644 %{SOURCE3} %{buildroot}%{_unitdir}/dbus-daemon.service

+ install -Dp -m644 %{SOURCE4} %{buildroot}%{_userunitdir}/dbus.socket

+ install -Dp -m644 %{SOURCE5} %{buildroot}%{_userunitdir}/dbus-daemon.service

+ 

+ # Make sure that when somebody asks for D-Bus under the name of the

+ # old SysV script, that he ends up with the standard dbus.service name

+ # now.

+ ln -s dbus.service %{buildroot}%{_unitdir}/messagebus.service

  

  # Obsolete, but still widely used, for drop-in configuration snippets.

  install --directory %{buildroot}%{_sysconfdir}/dbus-1/session.d
@@ -210,11 +235,6 @@

  

  install --directory %{buildroot}%{_datadir}/dbus-1/interfaces

  

- # Make sure that when somebody asks for D-Bus under the name of the

- # old SysV script, that he ends up with the standard dbus.service name

- # now.

- ln -s dbus.service %{buildroot}%{_unitdir}/messagebus.service

- 

  ## %find_lang %{gettext_package}

  

  install --directory %{buildroot}/var/lib/dbus
@@ -291,18 +311,18 @@

      -s /sbin/nologin -r -d '/' dbus 2> /dev/null || :

  

  %post daemon

- %systemd_post dbus.service dbus.socket

- %systemd_user_post dbus.service dbus.socket

+ %systemd_post dbus-daemon.service dbus.socket

+ %systemd_user_post dbus-daemon.service dbus.socket

  

  %post libs -p /sbin/ldconfig

  

  %preun daemon

- %systemd_preun dbus.service dbus.socket

- %systemd_user_preun dbus.service dbus.socket

+ %systemd_preun dbus-daemon.service dbus.socket

+ %systemd_user_preun dbus-daemon.service dbus.socket

  

  %postun daemon

- %systemd_postun dbus.service dbus.socket

- %systemd_user_postun dbus.service dbus.socket

+ %systemd_postun dbus-daemon.service dbus.socket

+ %systemd_user_postun dbus-daemon.service dbus.socket

  

  %postun libs -p /sbin/ldconfig

  
@@ -328,6 +348,9 @@

  %{_datadir}/dbus-1/system-services

  %{_datadir}/dbus-1/interfaces

  %{_sysusersdir}/dbus.conf

+ %{_unitdir}/dbus.socket

+ %{_unitdir}/messagebus.service

+ %{_userunitdir}/dbus.socket

  

  %files daemon

  # Strictly speaking, we could remove the COPYING from this subpackage and 
@@ -357,14 +380,8 @@

  %attr(4750,root,dbus) %{_libexecdir}/dbus-1/dbus-daemon-launch-helper

  %exclude %{_libexecdir}/dbus-1/dbus-run-installed-tests

  %{_tmpfilesdir}/dbus.conf

- %{_unitdir}/dbus.service

- %{_unitdir}/dbus.socket

- %{_unitdir}/messagebus.service

- %{_unitdir}/multi-user.target.wants/dbus.service

- %{_unitdir}/sockets.target.wants/dbus.socket

- %{_userunitdir}/dbus.service

- %{_userunitdir}/dbus.socket

- %{_userunitdir}/sockets.target.wants/dbus.socket

+ %{_unitdir}/dbus-daemon.service

+ %{_userunitdir}/dbus-daemon.service

  

  %files tools

  %{!?_licensedir:%global license %%doc}
@@ -415,6 +432,19 @@

  

  

  %changelog

+ * Fri Aug 10 2018 David Herrmann <dh.herrmann@gmail.com> - 1:1.12.10-2

+ - Move generic units into 'dbus-common', so other dbus implementations can use

+   them as well.

+ 

+ * Fri Aug 10 2018 David Herrmann <dh.herrmann@gmail.com> - 1:1.12.10-1

+ - Add [Install] sections to unit files, rather than creating the symlinks

+   manually during the installation. This will pick up the systemd-presets

+   global to Fedora from the 'fedora-release' package.

+ 

+ * Fri Aug 10 2018 David Herrmann <dh.herrmann@gmail.com> - 1:1.12.10-1

+ - Provide custom systemd unit files to replace the upstream units. Also rename

+   the service to 'dbus-daemon.service', but provide an alias to 'dbus.service'.

+ 

  * Fri Aug 03 2018 David King <amigadave@amigadave.com> - 1:1.12.10-1

  - Update to 1.12.10

  

dbus.user.socket
file added
+9
@@ -0,0 +1,9 @@

+ [Unit]

+ Description=D-Bus User Message Bus Socket

+ 

+ [Socket]

+ ListenStream=%t/bus

+ ExecStartPost=-/usr/bin/systemctl --user set-environment DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus

+ 

+ [Install]

+ WantedBy=sockets.target

no initial comment

Hey

This PR copies the systemd units provided by upstream into the downstream package and performs minor edits. In particular, we no longer install the '.wants' symlinks manually but make use of systemd-presets now present in the 'fedora-release' package.

Secondly, this renames 'dbus.service' to 'dbus-daemon.service', and again relies on 'fedora-release' to automatically enable the package. We add an Alias to the service file so it will still be available as 'dbus.service'.

This PR is a preparation for making 'dbus-broker' the default implementation in Fedora. All that is needed is to change 'fedora-release' to enable 'dbus-broker.service' rather than 'dbus-daemon.service' by default, as well as pointing the 'dbus' meta-package to 'dbus-broker' rather than 'dbus-daemon'. A follow-up PR will implement these changes.

IMPORTANT: This PR adds an explicit dependency on 'system-release>=29-0.11', which is not yet available but pending here: https://src.fedoraproject.org/rpms/fedora-release/pull-request/4

Thanks
David

These all look fine to me. I had a look at the fedora-release changes and those seem fine also. As soon as the fedora-release changes are merged, please feel free to merge and build these changes. Thanks!

3 new commits added

  • dbus: move generic units into 'dbus-common'
  • dbus: make use of [Install] unit sections
  • dbus: provide custom units
5 years ago

rebased onto 2fe9ed5

5 years ago

The fedora-release changes are merged in rawhide. I now adjusted this PR to have the correct system-release dependency, so this is now ready to be merged.

CI/koji is happy, and boots on a local machine \o/

Pull-Request has been merged by amigadave

5 years ago