[systemd-devel] [PATCH 3/3] bootctl: print machine and boot ids in status
Lennart Poettering
lennart at poettering.net
Fri May 15 07:01:23 PDT 2015
On Tue, 05.05.15 01:16, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> This was removed in merging of gummmiboot (0974a682d155a58), but seems genuinely
> useful.
Well, we already show this in "hostnamectl", so I figure we dont need
this in both tools?
> ---
> src/boot/bootctl.c | 20 +++++++++++++++++---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
> index 99c3fee686..19c2768f82 100644
> --- a/src/boot/bootctl.c
> +++ b/src/boot/bootctl.c
> @@ -1048,7 +1048,22 @@ static int bootctl_main(int argc, char*argv[]) {
> _cleanup_free_ char *fw_info = NULL;
> _cleanup_free_ char *loader = NULL;
> _cleanup_free_ char *loader_path = NULL;
> - sd_id128_t loader_part_uuid = {};
> + sd_id128_t id, loader_part_uuid = {};
> + char buf[33];
> +
> + printf("System:\n");
> +
> + r = sd_id128_get_machine(&id);
> + if (r >= 0)
> + printf(" Machine ID: %s\n", sd_id128_to_string(id, buf));
> + else
> + log_warning_errno(r, "Failed to query machine ID: %m");
> +
> + r = sd_id128_get_boot(&id);
> + if (r >= 0)
> + printf(" Boot ID: %s\n", sd_id128_to_string(id, buf));
> + else
> + log_warning_errno(r, "Failed to query boot ID: %m");
>
> if (is_efi_boot()) {
> read_loader_efi_var("LoaderFirmwareType", &fw_type);
> @@ -1061,7 +1076,6 @@ static int bootctl_main(int argc, char*argv[]) {
> if (r < 0 && r == -ENOENT)
> log_warning_errno(r, "Failed to read EFI variable LoaderDevicePartUUID: %m");
>
> - printf("System:\n");
> printf(" Firmware: %s (%s)\n", strna(fw_type), strna(fw_info));
>
> r = is_efi_secure_boot();
> @@ -1087,7 +1101,7 @@ static int bootctl_main(int argc, char*argv[]) {
> printf(" File: %s%s\n", draw_special_char(DRAW_TREE_RIGHT), strna(loader_path));
> printf("\n");
> } else
> - printf("System:\n Not booted with EFI\n");
> + printf(" Not booted with EFI\n");
>
> r = status_binaries(arg_path, uuid);
> if (r < 0)
> --
> 2.3.5
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list