chiark / gitweb /
container: skip a few things when we are run in a container such as accessing /proc...
[elogind.git] / src / fsck.c
index fdcf6b43c5d08335a650f7a0a713f3d3068aa945..a3c83c3c2428000e5bddc9d0d76b0f1d4730d451 100644 (file)
@@ -57,7 +57,7 @@ static void start_target(const char *target, bool isolate) {
         else
                 mode = "replace";
 
-        log_debug("Running request %s/start/%s", target, mode);
+        log_info("Running request %s/start/%s", target, mode);
 
         if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) {
                 log_error("Could not allocate message.");
@@ -106,6 +106,9 @@ static int parse_proc_cmdline(void) {
         int r;
         size_t l;
 
+        if (detect_virtualization(NULL) > 0)
+                return 0;
+
         if ((r = read_one_line_file("/proc/cmdline", &line)) < 0) {
                 log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
                 return 0;
@@ -121,7 +124,7 @@ static int parse_proc_cmdline(void) {
                         arg_skip = true;
                 else if (startswith(w, "fsck.mode"))
                         log_warning("Invalid fsck.mode= parameter. Ignoring.");
-#ifdef TARGET_FEDORA
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
                 else if (strneq(w, "fastboot", l))
                         arg_skip = true;
                 else if (strneq(w, "forcefsck", l))
@@ -247,18 +250,22 @@ int main(int argc, char *argv[]) {
                 else
                         log_error("fsck failed due to unknown reason.");
 
-                if (status.si_code == CLD_EXITED && status.si_status & 2)
+                if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory)
                         /* System should be rebooted. */
                         start_target(SPECIAL_REBOOT_TARGET, false);
-                else
+                else if (status.si_code == CLD_EXITED && (status.si_status & 6))
                         /* Some other problem */
                         start_target(SPECIAL_EMERGENCY_TARGET, true);
+                else {
+                        r = EXIT_SUCCESS;
+                        log_warning("Ignoring error.");
+                }
 
         } else
                 r = EXIT_SUCCESS;
 
         if (status.si_code == CLD_EXITED && (status.si_status & 1))
-                touch("/dev/.systemd/quotacheck");
+                touch("/dev/.run/systemd/quotacheck");
 
 finish:
         if (udev_device)