|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
From 59afe82145260430e426cf4ac999e8fc69e2a288 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
From: Lennart Poettering <lennart@poettering.net>
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
Date: Fri, 4 Jul 2014 03:13:05 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
Subject: [PATCH] main: change check whether /etc is unpopulated to look for
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
/etc/machine-id
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
Previously, we checked whether /etc was completely empty. This makes it
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
difficult though for container managers such as nspawn to install a
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
small number of files (such as /etc/timezone), and have the system
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
otherwise populate its own tree.
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
Hence, change this by looking for /etc/machine-id, which should be a
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
good sign whether /etc is populated or not.
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
(cherry picked from commit baa1bdf70f21848fbe01d3f383ae0f59d86a9bf3)
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
src/core/main.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
diff --git a/src/core/main.c b/src/core/main.c
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
index 38835fc620..1ca899998e 100644
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
--- a/src/core/main.c
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
+++ b/src/core/main.c
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
@@ -1543,7 +1543,7 @@ int main(int argc, char *argv[]) {
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
if (in_initrd())
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
log_info("Running in initial RAM disk.");
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
- empty_etc = dir_is_empty("/etc") > 0;
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
+ empty_etc = access("/etc/machine-id", F_OK) < 0;
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
if (empty_etc)
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
log_info("Running with unpopulated /etc.");
|
|
Zbigniew Jędrzejewski-Szmek |
43ff24 |
} else {
|