Merge pull request #16543 from poettering/nspawn-run-host

nspawn: /run/host/ tweaks
This commit is contained in:
Lennart Poettering
2020-08-20 16:20:05 +02:00
committed by GitHub
11 changed files with 144 additions and 50 deletions
+10
View File
@@ -491,6 +491,16 @@ int detect_container(void) {
}
}
/* The container manager might have placed this in the /run/host hierarchy for us, which is best
* because we can be consumed just like that, without special privileges. */
r = read_one_line_file("/run/host/container-manager", &m);
if (r > 0) {
e = m;
goto translate_name;
}
if (!IN_SET(r, -ENOENT, 0))
return log_debug_errno(r, "Failed to read /run/systemd/container: %m");
if (getpid_cached() == 1) {
/* If we are PID 1 we can just check our own environment variable, and that's authoritative.
* We distinguish three cases: