This commit tweaks the in_first_boot() code to make it a proper shared helper. It tweaks the comments about the caching policy. This is important because while this is simialr to `in_initrd()` there is a suble difference: we never cache the result of access() because other parts of systemd will use this file to signal if anything about firstboot changes. This also tweaks it to return an int instead of a bool. So any error is returned as -errno. This allows other parts of systemd (like the random-seed) that need to make decisions about "unknown" first-boot state. This also means that the consumers need to get updated and we can now also use the new helper in random-seed-tool.c and have only a single helper to check for first-boot.
10 lines
173 B
C
10 lines
173 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "basic-forward.h"
|
|
|
|
bool in_initrd(void);
|
|
void in_initrd_force(bool value);
|
|
|
|
int in_first_boot(void);
|