]> err.no Git - systemd/commitdiff
main: fall back to rescue target when default target cannot be loaded
authorLennart Poettering <lennart@poettering.net>
Thu, 8 Apr 2010 00:00:40 +0000 (02:00 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 8 Apr 2010 00:00:40 +0000 (02:00 +0200)
main.c
manager.h

diff --git a/main.c b/main.c
index 18af93418dd38f0dcd263aaa4f4014ef270f9ce6..b4fbdb58f5243027eef64ad5f5868b3ead27706c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -307,7 +307,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) {
index b6c0a51ecf1da67da58bf0ccacb1331b5bf6a5fd..817bc00bc825ac1cd92e9a8a2324405e16965088 100644 (file)
--- a/manager.h
+++ b/manager.h
@@ -83,6 +83,7 @@ struct Watch {
 #define SPECIAL_SYSLOG_TARGET "syslog.target"             /* Should pull in syslog.socket or syslog.service */
 #define SPECIAL_RTC_SET_TARGET "rtc-set.target"           /* LSB's $time */
 #define SPECIAL_BASIC_TARGET "basic.target"
+#define SPECIAL_RESCUE_TARGET "rescue.target"
 
 /* For SysV compatibility. Usually an alias for a saner target. On
  * SysV-free systems this doesn't exist. */