core: never apply first boot presets in the initrd

Presets are useful to initialize uninitialized /etc, but that doesn't
apply to the initrd.

Also, let's rename etc_empty → first_boot. After all, the variable
doesn't actually reflect whether /etc is really empty, it just reflects
whether /etc/machine-id existed originally or not. Moreover, we later on
directly initialize manager_set_first_boot() from it, hence let's just
name it the same way all through the codepath, to make this all less
confusing.

See: #7100
This commit is contained in:
Lennart Poettering
2017-11-17 11:28:17 +01:00
parent 85cb415124
commit fd1306121d
2 changed files with 14 additions and 14 deletions
+2 -1
View File
@@ -1345,8 +1345,9 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
if (r < 0)
return r;
/* If this is the first boot, and we are in the host system, then preset everything */
if (m->first_boot > 0 &&
m->unit_file_scope == UNIT_FILE_SYSTEM &&
MANAGER_IS_SYSTEM(m) &&
!m->test_run_flags) {
r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0);