teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 08a28eeca70eeefb55af61191b63e4c938daca73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Nykr=C3=BDn?= <lnykryn@redhat.com>
Date: Sat, 15 Oct 2016 19:54:58 +0200
Subject: [PATCH] virt: add possibility to skip the check for chroot (#4374)

https://bugzilla.redhat.com/show_bug.cgi?id=1379852
---
 src/basic/virt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/basic/virt.c b/src/basic/virt.c
index 10a2043..41012d5 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -33,6 +33,7 @@
 #include "string-table.h"
 #include "string-util.h"
 #include "virt.h"
+#include "env-util.h"
 
 static int detect_vm_cpuid(void) {
 
@@ -487,6 +488,9 @@ int detect_virtualization(void) {
 int running_in_chroot(void) {
         int ret;
 
+        if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
+                return 0;
+
         ret = files_same("/proc/1/root", "/");
         if (ret < 0)
                 return ret;
-- 
2.7.4