daandemeyer / rpms / systemd

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