chiark / gitweb /
cryptsetup: call static variables parsed from command line arg_XYZ like in all other...
[elogind.git] / src / dbus1-generator / dbus1-generator.c
index 1c24b3ad6350c0de95023b55304ad247e5a88086..b3dedb77c663a522af67965265d1c6ac39ae2921 100644 (file)
@@ -66,7 +66,8 @@ static int create_dbus_files(
                         "# Automatically generated by systemd-dbus1-generator\n\n"
                         "[Unit]\n"
                         "SourcePath=%s\n"
-                        "Description=DBUS1: %s\n\n"
+                        "Description=DBUS1: %s\n"
+                        "Documentation=man:systemd-dbus1-generator(8)\n\n"
                         "[Service]\n"
                         "ExecStart=%s\n"
                         "Type=dbus\n"
@@ -84,10 +85,19 @@ static int create_dbus_files(
                         fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type);
 
                         if (streq(type, "system"))
-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=kernel:path=/dev/kdbus/0-system\n");
-                        else if (streq(type, "session"))
-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=kernel:path=/dev/kdbus/%lu-user;unix:path=/run/user/%lu/bus\n",
-                                        (unsigned long) getuid(), (unsigned long) getuid());
+                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_PATH "\n");
+                        else if (streq(type, "session")) {
+                                char *run;
+
+                                run = getenv("XDG_RUNTIME_DIR");
+                                if (!run) {
+                                        log_error("XDG_RUNTIME_DIR not set.");
+                                        return -EINVAL;
+                                }
+
+                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT "\n",
+                                        (unsigned long) getuid(), run);
+                        }
                 }
 
                 fflush(f);
@@ -113,10 +123,12 @@ static int create_dbus_files(
                 "# Automatically generated by systemd-dbus1-generator\n\n"
                 "[Unit]\n"
                 "SourcePath=%s\n"
-                "Description=DBUS1: %s\n\n"
+                "Description=DBUS1: %s\n"
+                "Documentation=man:systemd-dbus1-generator(8)\n\n"
                 "[BusName]\n"
                 "Name=%s\n"
-                "Service=%s\n",
+                "Service=%s\n"
+                "AllowWorld=talk\n",
                 path,
                 name,
                 name,