bus: install systemd-bus-proxyd unit files for compatibility with dbus1

This commit is contained in:
Lennart Poettering 2013-12-13 20:29:35 +01:00
parent 207d1d0922
commit 7c9a6f9063
8 changed files with 178 additions and 102 deletions

70
.gitignore vendored
View File

@ -1,8 +1,22 @@
*.a
*.cache
*.html
*.la
*.lo
*.log
*.o
*.plist
*.pyc
*.stamp
*.trs
*~
.deps/
.dirstamp
.libs/
/*.tar.bz2
/*.tar.gz
/*.tar.xz
/Makefile
/defined
/undefined
/exported
/exported-*
/TAGS
/accelerometer
/ata_id
@ -12,6 +26,9 @@
/cdrom_id
/collect
/coverage/
/defined
/exported
/exported-*
/gtk-doc.make
/hostnamectl
/install-tree
@ -25,13 +42,14 @@
/systemadm
/systemctl
/systemd
/systemd-activate
/systemd-ac-power
/systemd-activate
/systemd-analyze
/systemd-ask-password
/systemd-backlight
/systemd-binfmt
/systemd-bootchart
/systemd-bus-proxyd
/systemd-cat
/systemd-cgls
/systemd-cgroups-agent
@ -73,11 +91,10 @@
/systemd-reply-password
/systemd-rfkill
/systemd-run
/systemd-socket-proxyd
/systemd-shutdown
/systemd-shutdownd
/systemd-sleep
/systemd-bus-proxyd
/systemd-socket-proxyd
/systemd-sysctl
/systemd-system-update-generator
/systemd-timedated
@ -93,18 +110,18 @@
/test-bus-chat
/test-bus-creds
/test-bus-error
/test-bus-gvariant
/test-bus-introspect
/test-bus-kernel
/test-bus-kernel-bloom
/test-bus-kernel-benchmark
/test-bus-kernel-bloom
/test-bus-marshal
/test-bus-match
/test-bus-memfd
/test-bus-objects
/test-bus-signature
/test-bus-server
/test-bus-signature
/test-bus-zero-copy
/test-bus-gvariant
/test-calendarspec
/test-catalog
/test-cgroup
@ -129,19 +146,23 @@
/test-journal
/test-journal-enum
/test-journal-flush
/test-journal-init
/test-journal-interleaving
/test-journal-match
/test-journal-send
/test-journal-stream
/test-journal-init
/test-journal-syslog
/test-journal-verify
/test-libsystemd-*-sym*
/test-libudev
/test-libudev-sym*
/test-list
/test-log
/test-login
/test-login-shared
/test-login-tables
/test-loopback
/test-machine-tables
/test-mmap-cache
/test-namespace
/test-network
@ -152,13 +173,11 @@
/test-rtnl
/test-sched-prio
/test-sleep
/test-strip-tab-ansi
/test-strbuf
/test-strip-tab-ansi
/test-strv
/test-strxcpyx
/test-tables
/test-login-tables
/test-machine-tables
/test-time
/test-udev
/test-unit-file
@ -166,31 +185,12 @@
/test-utf8
/test-util
/test-watchdog
/test-libsystemd-*-sym*
/test-libudev-sym*
/timedatectl
/udevadm
/undefined
/v4l_id
/*.tar.bz2
/*.tar.gz
/*.tar.xz
*.trs
*.log
*.a
*.cache
*.html
*.la
*.lo
*.o
*.plist
*.stamp
*.pyc
__pycache__/
*~
.deps/
.dirstamp
.libs/
Makefile.in
__pycache__/
aclocal.m4
config.h
config.h.in

View File

@ -1898,6 +1898,22 @@ bus-proxyd-uninstall-hook:
INSTALL_EXEC_HOOKS += bus-proxyd-install-hook
UNINSTALL_EXEC_HOOKS += bus-proxyd-uninstall-hook
nodist_systemunit_DATA += \
units/systemd-bus-proxyd@.service
dist_systemunit_DATA += \
units/systemd-bus-proxyd.socket
dist_userunit_DATA += \
units/user/systemd-bus-proxyd.socket
USER_UNIT_ALIASES += \
$(systemunitdir)/systemd-bus-proxyd@.service systemd-bus-proxyd@.service
EXTRA_DIST += \
units/systemd-bus-proxyd@.service.in
# ------------------------------------------------------------------------------
systemd_tty_ask_password_agent_SOURCES = \
src/tty-ask-password-agent/tty-ask-password-agent.c

View File

@ -40,18 +40,20 @@
#include "bus-util.h"
#include "build.h"
#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
const char *arg_bus_path = DEFAULT_BUS_PATH;
#ifdef ENABLE_KDBUS
const char *arg_bus_path = "kernel:path=/dev/kdbus/0-system/bus;unix:path=/run/dbus/system_bus_socket";
#else
const char *arg_bus_path = "unix:path=/run/dbus/system_bus_socket";
#endif
static int help(void) {
printf("%s [OPTIONS...]\n\n"
"STDIO or socket-activatable proxy to a given DBus endpoint.\n\n"
"Connection STDIO or a socket to a given bus address.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -p --bus-path=PATH Path to the kernel bus (default: %s)\n",
program_invocation_short_name, DEFAULT_BUS_PATH);
" -p --bus-path=PATH Bus address to forward to (default: %s)\n",
program_invocation_short_name, arg_bus_path);
return 0;
}

View File

@ -28,7 +28,7 @@
#include "unit-name.h"
#include "cgroup-util.h"
static const char *arg_dest = "/tmp";
static const char *arg_dest_late = "/tmp", *arg_dest = "/tmp";
static int create_dbus_files(
const char *path,
@ -52,7 +52,7 @@ static int create_dbus_files(
if (!s)
return log_oom();
a = strjoin(arg_dest, "/", s, NULL);
a = strjoin(arg_dest_late, "/", s, NULL);
if (!a)
return log_oom();
@ -98,7 +98,7 @@ static int create_dbus_files(
service = s;
}
b = strjoin(arg_dest, "/", name, ".busname", NULL);
b = strjoin(arg_dest_late, "/", name, ".busname", NULL);
if (!b)
return log_oom();
@ -127,7 +127,7 @@ static int create_dbus_files(
return -errno;
}
lnk = strjoin(arg_dest, "/" SPECIAL_BUSNAMES_TARGET ".wants/", name, ".busname", NULL);
lnk = strjoin(arg_dest_late, "/" SPECIAL_BUSNAMES_TARGET ".wants/", name, ".busname", NULL);
if (!lnk)
return log_oom();
@ -264,6 +264,21 @@ static int link_busnames_target(const char *units) {
return 0;
}
static int link_compatibility(const char *units) {
const char *f, *t;
f = strappenda(units, "/systemd-socket-proxy.socket");
t = strappenda(arg_dest, "/" SPECIAL_DBUS_SOCKET);
mkdir_parents_label(t, 0755);
if (symlink(f, t) < 0) {
log_error("Failed to create symlink %s: %m", t);
return -errno;
}
return 0;
}
int main(int argc, char *argv[]) {
const char *path, *type, *units;
int r, q;
@ -273,8 +288,10 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
if (argc > 1)
arg_dest = argv[3];
if (argc > 1) {
arg_dest = argv[1];
arg_dest_late = argv[3];
}
log_set_target(LOG_TARGET_SAFE);
log_parse_environment();
@ -306,5 +323,9 @@ int main(int argc, char *argv[]) {
if (q < 0)
r = q;
q = link_compatibility(units);
if (q < 0)
r = q;
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

111
units/.gitignore vendored
View File

@ -1,66 +1,67 @@
/systemd-backlight@.service
/systemd-rfkill@.service
/halt-local.service
/rc-local.service
/systemd-hybrid-sleep.service
/systemd-journal-gatewayd.service
/systemd-journal-flush.service
/systemd-hibernate.service
/systemd-suspend.service
/console-getty.service
/console-getty.service.m4
/container-getty@.service
/container-getty@.service.m4
/systemd-journald.service
/user@.service
/systemd-logind.service
/systemd-localed.service
/systemd-timedated.service
/systemd-hostnamed.service
/console-shell.service
/console-shell.service.m4
/systemd-sysctl.service
/systemd-ask-password-console.service
/rescue.service
/rescue.service.m4
/systemd-ask-password-wall.service
/systemd-quotacheck.service
/quotaon.service
/systemd-fsck@.service
/systemd-fsck-root.service
/systemd-tmpfiles-clean.service
/systemd-tmpfiles-setup.service
/systemd-tmpfiles-setup-dev.service
/systemd-halt.service
/systemd-poweroff.service
/systemd-reboot.service
/systemd-kexec.service
/systemd-user-sessions.service
/systemd-readahead-done.service
/systemd-tmpfiles.service
/systemd-readahead-collect.service
/systemd-readahead-replay.service
/serial-getty@.service
/systemd-modules-load.service
/systemd-remount-fs.service
/systemd-vconsole-setup.service
/systemd-shutdownd.service
/systemd-random-seed.service
/systemd-initctl.service
/getty@.service
/systemd-update-utmp.service
/systemd-update-utmp-runlevel.service
/systemd-binfmt.service
/emergency.service
/systemd-udev-settle.service
/systemd-udev-trigger.service
/systemd-udevd.service
/container-getty@.service
/container-getty@.service.m4
/debug-shell.service
/emergency.service
/getty@.service
/halt-local.service
/initrd-cleanup.service
/initrd-parse-etc.service
/initrd-switch-root.service
/initrd-udevadm-cleanup-db.service
/kmod-static-nodes.service
/quotaon.service
/rc-local.service
/rescue.service
/rescue.service.m4
/serial-getty@.service
/systemd-ask-password-console.service
/systemd-ask-password-wall.service
/systemd-backlight@.service
/systemd-binfmt.service
/systemd-bus-proxyd@.service
/systemd-fsck-root.service
/systemd-fsck@.service
/systemd-halt.service
/systemd-hibernate.service
/systemd-hostnamed.service
/systemd-hybrid-sleep.service
/systemd-initctl.service
/systemd-journal-flush.service
/systemd-journal-gatewayd.service
/systemd-journald.service
/systemd-kexec.service
/systemd-localed.service
/systemd-logind.service
/systemd-machined.service
/systemd-modules-load.service
/systemd-networkd.service
/systemd-nspawn@.service
/systemd-machined.service
/kmod-static-nodes.service
/systemd-poweroff.service
/systemd-quotacheck.service
/systemd-random-seed.service
/systemd-readahead-collect.service
/systemd-readahead-done.service
/systemd-readahead-replay.service
/systemd-reboot.service
/systemd-remount-fs.service
/systemd-rfkill@.service
/systemd-shutdownd.service
/systemd-suspend.service
/systemd-sysctl.service
/systemd-timedated.service
/systemd-tmpfiles-clean.service
/systemd-tmpfiles-setup-dev.service
/systemd-tmpfiles-setup.service
/systemd-tmpfiles.service
/systemd-udev-settle.service
/systemd-udev-trigger.service
/systemd-udevd.service
/systemd-update-utmp-runlevel.service
/systemd-update-utmp.service
/systemd-user-sessions.service
/systemd-vconsole-setup.service
/user@.service

View File

@ -0,0 +1,12 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Legacy D-Bus Protocol Compatibility Socket
[Socket]
ListenStream=/run/dbus/system_bus_socket

View File

@ -0,0 +1,12 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Description]
Description=Legacy D-Bus Protocol Compatibility Daemon
[Service]
ExecStart=@rootlibexecdir@/systemd-bus-proxyd

View File

@ -0,0 +1,12 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Legacy D-Bus Protocol Compatibility Socket
[Socket]
ListenStream=%r/bus