chiark / gitweb /
execute: automatically record start/exit timestamps for forked processes
[elogind.git] / main.c
diff --git a/main.c b/main.c
index ea001b18b0266fa92d1c9c38728d17e56cbe3785..139770edeccc5d230af7448277bd14bbd3c6e150 100644 (file)
--- a/main.c
+++ b/main.c
@@ -32,6 +32,8 @@
 #include "manager.h"
 #include "log.h"
 #include "mount-setup.h"
+#include "hostname-setup.h"
+#include "load-fragment.h"
 
 static enum {
         ACTION_RUN,
@@ -70,7 +72,7 @@ static int parse_proc_cmdline_word(const char *word) {
         };
 
         if (startswith(word, "systemd.default="))
-                return set_default_unit(word + 15);
+                return set_default_unit(word + 16);
 
         else if (startswith(word, "systemd.log_target=")) {
 
@@ -293,6 +295,10 @@ int main(int argc, char *argv[]) {
 
         log_debug("systemd running in %s mode.", manager_running_as_to_string(running_as));
 
+        if (running_as == MANAGER_INIT)
+                if (hostname_setup() < 0)
+                        goto finish;
+
         if ((r = manager_new(running_as, &m)) < 0) {
                 log_error("Failed to allocate manager object: %s", strerror(-r));
                 goto finish;
@@ -307,7 +313,12 @@ int main(int argc, char *argv[]) {
 
         if ((r = manager_load_unit(m, default_unit, &target)) < 0) {
                 log_error("Failed to load default target: %s", strerror(-r));
-                goto finish;
+
+                log_info("Trying to load rescue target...");
+                if ((r = manager_load_unit(m, SPECIAL_RESCUE_TARGET, &target)) < 0) {
+                        log_error("Failed to load rescue target: %s", strerror(-r));
+                        goto finish;
+                }
         }
 
         if (action == ACTION_TEST) {