env-file: port write_env_file() to label_ops_pre()

Let's make more use of label_ops_pre()/label_ops_post(), and replace
write_env_file_label() by a flag to write_env_file().

This simplifies and normalizes the code.

This also makes one relevant change: it sets the new
WRITE_ENV_FILE_LABEL flag in firstboot.c when we write locale.conf,
where we previously did not (but should have). This should address one
detail of #37857.
This commit is contained in:
Lennart Poettering
2025-06-18 10:21:26 +02:00
parent 9ea5a6e7d6
commit 3e5320e27d
11 changed files with 42 additions and 61 deletions
+6 -1
View File
@@ -448,7 +448,12 @@ static int process_locale(int rfd) {
locales[i] = NULL;
r = write_env_file(pfd, f, NULL, locales);
r = write_env_file(
pfd,
f,
/* headers= */ NULL,
locales,
WRITE_ENV_FILE_LABEL);
if (r < 0)
return log_error_errno(r, "Failed to write /etc/locale.conf: %m");