diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-07-09 11:50:03 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-07-09 11:50:03 -0300 |
commit | 43694a8cc70667498f3ffc5d9325b7d0428558e5 (patch) | |
tree | 7f588e061d5a34b2d9a6d133add8db3cab21df92 /src | |
parent | 0aa7a4c2258c867d972b6df9b500674596975d88 (diff) | |
parent | 59658d1958a7990722240e23c25163e98aa013c8 (diff) |
Merge pull request #531 from dvdhrm/boot-buildid
boot: use BUILD_ID if VERSION_ID is not available
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/efi/boot.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index eb1a4e3b66..827c11844c 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1517,6 +1517,7 @@ static VOID config_entry_add_linux( Config *config, EFI_LOADED_IMAGE *loaded_ima CHAR16 *os_name = NULL; CHAR16 *os_id = NULL; CHAR16 *os_version = NULL; + CHAR16 *os_build = NULL; bufsize = sizeof(buf); err = uefi_call_wrapper(linux_dir->Read, 3, linux_dir, &bufsize, buf); @@ -1547,35 +1548,45 @@ static VOID config_entry_add_linux( Config *config, EFI_LOADED_IMAGE *loaded_ima line = content; while ((line = line_get_key_value(content, (CHAR8 *)"=", &pos, &key, &value))) { if (strcmpa((CHAR8 *)"PRETTY_NAME", key) == 0) { + FreePool(os_name); os_name = stra_to_str(value); continue; } if (strcmpa((CHAR8 *)"ID", key) == 0) { + FreePool(os_id); os_id = stra_to_str(value); continue; } if (strcmpa((CHAR8 *)"VERSION_ID", key) == 0) { + FreePool(os_version); os_version = stra_to_str(value); continue; } + + if (strcmpa((CHAR8 *)"BUILD_ID", key) == 0) { + FreePool(os_build); + os_build = stra_to_str(value); + continue; + } } - if (os_name && os_id && os_version) { + if (os_name && os_id && (os_version || os_build)) { CHAR16 *conf; CHAR16 *path; - conf = PoolPrint(L"%s-%s", os_id, os_version); + conf = PoolPrint(L"%s-%s", os_id, os_version ? : os_build); path = PoolPrint(L"\\EFI\\Linux\\%s", f->FileName); config_entry_add_loader(config, loaded_image->DeviceHandle, LOADER_LINUX, conf, 'l', os_name, path); FreePool(conf); FreePool(path); - FreePool(os_name); - FreePool(os_id); - FreePool(os_version); } + FreePool(os_name); + FreePool(os_id); + FreePool(os_version); + FreePool(os_build); FreePool(content); } uefi_call_wrapper(linux_dir->Close, 1, linux_dir); |