richardphibel / rpms / systemd

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