[PATCH 2/5] bus: change --systemd-activation to --activation=systemd
Scott James Remnant
scott at netsplit.com
Wed Dec 22 07:27:04 PST 2010
In the same spirit as the previous patch, rather than adding a new
command-line option for each activation type, take a parameter to
choose between them.
The old option has been left in as an undocumented equivalent for
compatibility.
---
bus/dbus.service.in | 2 +-
bus/main.c | 17 ++++++++++++++++-
doc/dbus-daemon.1.in | 2 +-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/bus/dbus.service.in b/bus/dbus.service.in
index 399306f..4d9e101 100644
--- a/bus/dbus.service.in
+++ b/bus/dbus.service.in
@@ -6,5 +6,5 @@ After=syslog.target
[Service]
ExecStartPre=@EXPANDED_BINDIR@/dbus-uuidgen --ensure
ExecStartPre=-/bin/rm -f @DBUS_SYSTEM_PID_FILE@
-ExecStart=@EXPANDED_BINDIR@/dbus-daemon --system --address=systemd: --nofork --systemd-activation
+ExecStart=@EXPANDED_BINDIR@/dbus-daemon --system --address=systemd: --nofork --activation=systemd
ExecReload=@EXPANDED_BINDIR@/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
diff --git a/bus/main.c b/bus/main.c
index f158d0f..601d4b4 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -75,7 +75,7 @@ signal_handler (int sig)
static void
usage (void)
{
- fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--systemd-activation]\n");
+ fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--activation=systemd]\n");
exit (1);
}
@@ -314,6 +314,21 @@ main (int argc, char **argv)
force_fork = FORK_ALWAYS;
else if (strcmp (arg, "--systemd-activation") == 0)
activation_type = ACTIVATION_SYSTEMD;
+ else if (strstr (arg, "--activation=") == arg)
+ {
+ const char *activation;
+
+ activation = strchr (arg, '=');
+ ++activation;
+
+ if (strcmp (activation, "systemd") == 0)
+ activation_type = ACTIVATION_SYSTEMD;
+ else
+ {
+ fprintf (stderr, "Unknown activation type: %s.\n", activation);
+ usage ();
+ }
+ }
else if (strcmp (arg, "--system") == 0)
{
check_two_config_files (&config_file, "system");
diff --git a/doc/dbus-daemon.1.in b/doc/dbus-daemon.1.in
index a54f863..9aaa316 100644
--- a/doc/dbus-daemon.1.in
+++ b/doc/dbus-daemon.1.in
@@ -91,7 +91,7 @@ Print the introspection information for all D-Bus internal interfaces.
Set the address to listen on. This option overrides the address
configured in the configuration file.
.TP
-.I "--systemd-activation"
+.I "--activation=systemd"
Enable systemd-style service activation. Only useful in conjunction
with the systemd system and session manager on Linux.
--
1.7.1
More information about the dbus
mailing list