diff --git a/bus/meson.build b/bus/meson.build index 058e3b25..a8918395 100644 --- a/bus/meson.build +++ b/bus/meson.build @@ -84,6 +84,21 @@ if use_systemd endif endif +if use_openrc + configure_file( + input: 'openrc/dbus.init.in', + output: 'dbus', + configuration: data_config, + install_dir: openrc_init_dir, + ) + configure_file( + input: 'openrc/dbus.conf.in', + output: 'dbus.conf', + configuration: data_config, + install_dir: openrc_conf_dir, + ) +endif + subdir('legacy-config') diff --git a/bus/openrc/dbus.conf.in b/bus/openrc/dbus.conf.in new file mode 100644 index 00000000..0b83c7df --- /dev/null +++ b/bus/openrc/dbus.conf.in @@ -0,0 +1,21 @@ +# This file is part of the D-Bus library. +# +# The D-Bus library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# The D-Bus library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the D-Bus library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Start the D-Bus daemon +DBUS_DAEMON_ENABLE="yes" + +# Arguments to pass to the D-Bus daemon +DBUS_DAEMON_ARGS="--system" diff --git a/bus/openrc/dbus.init.in b/bus/openrc/dbus.init.in new file mode 100644 index 00000000..b905d5a4 --- /dev/null +++ b/bus/openrc/dbus.init.in @@ -0,0 +1,26 @@ +#!/sbin/openrc-run + +description="D-Bus System Message Bus" + +depend() { + need localmount + after bootmisc +} + +start() { + ebegin "Starting D-Bus System Message Bus" + start-stop-daemon --start --quiet --pidfile /run/dbus/pid --exec @EXPANDED_BINDIR@/dbus-daemon -- --system + eend $? +} + +stop() { + ebegin "Stopping D-Bus System Message Bus" + start-stop-daemon --stop --quiet --pidfile /run/dbus/pid + eend $? +} + +reload() { + ebegin "Reloading D-Bus System Message Bus" + @EXPANDED_BINDIR@/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig + eend $? +} diff --git a/meson.build b/meson.build index 7281b7ec..633cb99b 100644 --- a/meson.build +++ b/meson.build @@ -554,6 +554,12 @@ else endif data_config.set('SYSTEMCTL', systemctl) +use_openrc = get_option('openrc').enabled() +if use_openrc + openrc_init_dir = get_option('sysconfdir') / 'init.d' + openrc_conf_dir = get_option('sysconfdir') / 'conf.d' +endif + elogind_opt = get_option('elogind') if use_systemd if elogind_opt.enabled() @@ -1432,6 +1438,7 @@ summary_dict += { 'Building inotify support': use_inotify, 'Building kqueue support': use_kqueue, 'Building systemd support': use_systemd, + 'Building OpenRC support': use_openrc, 'Building elogind support': use_elogind, 'Traditional activation': use_traditional_activation, 'Building X11 code': config.get('DBUS_BUILD_X11'), diff --git a/meson_options.txt b/meson_options.txt index 6f382437..485f6dbc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -251,6 +251,13 @@ option( description: 'Systemd at_console support' ) +option( + 'openrc', + type: 'feature', + value: 'auto', + description: 'OpenRC init script support' +) + option( 'test_socket_dir', type: 'string',