}
}
+ /* Make the first-boot file visible now: the credential import
+ * consults in_first_boot() for systemd.credentials_boot_policy= which runs
+ * before the manager object is created. */
+ (void) update_first_boot_file(first_boot);
+
assert_se(uname(&uts) >= 0);
if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0)
}
void manager_set_first_boot(Manager *m, bool b) {
+ int r;
+
assert(m);
if (!MANAGER_IS_SYSTEM(m))
return;
if (m->first_boot != (int) b) {
- if (b)
- (void) touch("/run/systemd/first-boot");
- else
- (void) unlink("/run/systemd/first-boot");
+ r = update_first_boot_file(b);
+ if (r < 0)
+ log_warning_errno(r, "Failed to update the first-boot file, ignoring: %m");
}
m->first_boot = b;
}
+int update_first_boot_file(bool b) {
+ if (b)
+ return touch("/run/systemd/first-boot");
+
+ if (unlink("/run/systemd/first-boot") < 0 && errno != ENOENT)
+ return -errno;
+
+ return 0;
+}
+
void manager_disable_confirm_spawn(void) {
(void) touch("/run/systemd/confirm_spawn_disabled");
}
int manager_allocate_idle_pipe(Manager *m);
+int update_first_boot_file(bool b);
+
void unit_defaults_init(UnitDefaults *defaults, RuntimeScope scope);
void unit_defaults_done(UnitDefaults *defaults);