mirror of
https://github.com/systemd/systemd.git
synced 2025-02-15 09:57:39 +03:00
boot-entry: prioritize machine ID only when it is not randomly generated
Preparation for later commits. The parameter will be used in kernel-install later.
This commit is contained in:
parent
965b481d9b
commit
3b5fc5fb1b
@ -120,6 +120,7 @@ int settle_entry_token(void) {
|
||||
arg_root,
|
||||
etc_kernel(),
|
||||
arg_machine_id,
|
||||
/* machine_id_is_random = */ false,
|
||||
&arg_entry_token_type,
|
||||
&arg_entry_token);
|
||||
if (r < 0)
|
||||
|
@ -115,6 +115,7 @@ int boot_entry_token_ensure(
|
||||
const char *root,
|
||||
const char *etc_kernel,
|
||||
sd_id128_t machine_id,
|
||||
bool machine_id_is_random,
|
||||
BootEntryTokenType *type,
|
||||
char **token) {
|
||||
|
||||
@ -133,14 +134,22 @@ int boot_entry_token_ensure(
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
r = entry_token_from_machine_id(machine_id, type, token);
|
||||
if (r != 0)
|
||||
return r;
|
||||
if (!machine_id_is_random) {
|
||||
r = entry_token_from_machine_id(machine_id, type, token);
|
||||
if (r != 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = entry_token_from_os_release(root, type, token);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (machine_id_is_random) {
|
||||
r = entry_token_from_machine_id(machine_id, type, token);
|
||||
if (r != 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"No machine ID set, and %s/etc/os-release carries no ID=/IMAGE_ID= fields.",
|
||||
strempty(root));
|
||||
|
@ -19,6 +19,7 @@ int boot_entry_token_ensure(
|
||||
const char *root,
|
||||
const char *etc_kernel, /* will be prefixed with root, typically /etc/kernel. */
|
||||
sd_id128_t machine_id,
|
||||
bool machine_id_is_random,
|
||||
BootEntryTokenType *type, /* input and output */
|
||||
char **token); /* output, but do not pass uninitialized value. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user