naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
572a44
From 650b4c3e4e004acfe7c201fd8a3e9d9c87824593 Mon Sep 17 00:00:00 2001
a4b143
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
a4b143
Date: Thu, 3 Oct 2013 22:13:01 -0400
a4b143
Subject: [PATCH] gpt-auto-generator: exit immediately if in container
a4b143
a4b143
Otherwise we get an ugly warning when running systemd in
a4b143
a container.
a4b143
---
a4b143
 src/gpt-auto-generator/gpt-auto-generator.c | 8 ++++++++
a4b143
 1 file changed, 8 insertions(+)
a4b143
a4b143
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
a4b143
index ca54925..d2b4213 100644
a4b143
--- a/src/gpt-auto-generator/gpt-auto-generator.c
a4b143
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
a4b143
@@ -38,6 +38,7 @@
a4b143
 #include "libudev.h"
a4b143
 #include "special.h"
a4b143
 #include "unit-name.h"
a4b143
+#include "virt.h"
a4b143
 
a4b143
 /* TODO:
a4b143
  *
a4b143
@@ -481,6 +482,13 @@ int main(int argc, char *argv[]) {
a4b143
         umask(0022);
a4b143
 
a4b143
         if (in_initrd()) {
a4b143
+                log_debug("In initrd, exiting.");
a4b143
+                r = 0;
a4b143
+                goto finish;
a4b143
+        }
a4b143
+
a4b143
+        if (detect_container(NULL) > 0) {
a4b143
+                log_debug("In a container, exiting.");
a4b143
                 r = 0;
a4b143
                 goto finish;
a4b143
         }