chiark / gitweb /
core: fix require $XDG_RUNTIME_DIR
authorKay Sievers <kay@vrfy.org>
Thu, 7 Nov 2013 13:14:22 +0000 (14:14 +0100)
committerKay Sievers <kay@vrfy.org>
Thu, 7 Nov 2013 13:14:22 +0000 (14:14 +0100)
  $ sudo dracut -f
  Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.
  /usr/lib/dracut/modules.d/98systemd/module-setup.sh: line 10:
    ((: >= 198 : syntax error: operand expected (error token is ">= 198 ")

src/core/main.c

index ec7758db127bb4911609308e653a9a0c6ecc6616..8abad6d25728216c69e5ed890e2742f2dce80db1 100644 (file)
@@ -1383,12 +1383,6 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        if (arg_running_as == SYSTEMD_USER &&
-            !getenv("XDG_RUNTIME_DIR")) {
-                log_error("Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.");
-                goto finish;
-        }
-
         if (arg_running_as == SYSTEMD_SYSTEM &&
             arg_action == ACTION_RUN &&
             running_in_chroot() > 0) {
@@ -1411,6 +1405,12 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
+        if (arg_running_as == SYSTEMD_USER &&
+            !getenv("XDG_RUNTIME_DIR")) {
+                log_error("Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.");
+                goto finish;
+        }
+
         assert_se(arg_action == ACTION_RUN || arg_action == ACTION_TEST);
 
         /* Close logging fds, in order not to confuse fdset below */