X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmain.c;h=a21a959be974e3e9b78e5711293bb1fed78c025d;hb=3be1d7e0c5bf60658d34eb6311d4e77c6803578c;hp=8ee12ef8fabfe49050702728da3e6b32da0eb8f7;hpb=d6239dc4b0cf55a953d6c40890859b85d504ef19;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index 8ee12ef8f..a21a959be 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1543,13 +1543,22 @@ int main(int argc, char *argv[]) { if (in_initrd()) log_info("Running in initial RAM disk."); - empty_etc = dir_is_empty("/etc") > 0; + /* Let's check whether /etc is already populated. We + * don't actually really check for that, but use + * /etc/machine-id as flag file. This allows container + * managers and installers to provision a couple of + * files already. If the container manager wants to + * provision the machine ID itself it should pass + * $container_uuid to PID 1.*/ + + empty_etc = access("/etc/machine-id", F_OK) < 0; if (empty_etc) log_info("Running with unpopulated /etc."); } else { - _cleanup_free_ char *t = uid_to_name(getuid()); - log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", - getuid(), t); + _cleanup_free_ char *t; + + t = uid_to_name(getuid()); + log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", getuid(), strna(t)); } if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) { @@ -1643,6 +1652,7 @@ int main(int argc, char *argv[]) { manager_set_default_rlimits(m, arg_default_rlimit); manager_environment_add(m, NULL, arg_default_environment); manager_set_show_status(m, arg_show_status); + manager_set_first_boot(m, empty_etc); /* Remember whether we should queue the default job */ queue_default_job = !arg_serialization || arg_switched_root;