1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

main: change check whether /etc is unpopulated to look for /etc/machine-id

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.
This commit is contained in:
Lennart Poettering 2014-07-04 03:13:05 +02:00
parent fa229d0928
commit baa1bdf70f

View 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 {