chiark / gitweb /
main: change check whether /etc is unpopulated to look for /etc/machine-id
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Jul 2014 01:13:05 +0000 (03:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Jul 2014 01:24:42 +0000 (03:24 +0200)
Previously, we checked whether /etc was completely empty. This makes it
difficult though for container managers such as nspawn to install a
small number of files (such as /etc/timezone), and have the system
otherwise populate its own tree.

Hence, change this by looking for /etc/machine-id, which should be a
good sign whether /etc is populated or not.

src/core/main.c

index 38835fc62008a724a4799a396226e51de6d62309..1ca899998ed54e43767f9159f373b389553ff915 100644 (file)
@@ -1543,7 +1543,7 @@ int main(int argc, char *argv[]) {
                 if (in_initrd())
                         log_info("Running in initial RAM disk.");
 
-                empty_etc = dir_is_empty("/etc") > 0;
+                empty_etc = access("/etc/machine-id", F_OK) < 0;
                 if (empty_etc)
                         log_info("Running with unpopulated /etc.");
         } else {