depot/third_party/nixpkgs/pkgs/os-specific/linux/systemd/0019-bootctl-also-print-efi-files-not-owned-by-systemd-in.patch
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

46 lines
2.1 KiB
Diff

From bc0f378a1149b59e88e9345e579d62fec7f50cdf Mon Sep 17 00:00:00 2001
From: Arian van Putten <arian.vanputten@gmail.com>
Date: Wed, 31 May 2023 13:27:13 +0200
Subject: [PATCH] bootctl: also print efi files not owned by systemd in status
We should not skip over unknown entries in EFI/BOOT/ but
also print them out in status so people are aware that they are there.
(cherry picked from commit a680d4fb87bad829989949e5ea4fc6db90453456)
---
src/boot/bootctl-status.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/boot/bootctl-status.c b/src/boot/bootctl-status.c
index 2e2bf1f7e1..f1ac4a9c8a 100644
--- a/src/boot/bootctl-status.c
+++ b/src/boot/bootctl-status.c
@@ -225,9 +225,8 @@ static int enumerate_binaries(
return log_error_errno(errno, "Failed to open file '%s' for reading: %m", filename);
r = get_file_version(fd, &v);
- if (r == -ESRCH) /* Not the file we are looking for. */
- continue;
- if (r < 0)
+
+ if (r < 0 && r != -ESRCH)
return r;
if (*previous) { /* Let's output the previous entry now, since now we know that there will be
@@ -242,10 +241,10 @@ static int enumerate_binaries(
/* Do not output this entry immediately, but store what should be printed in a state
* variable, because we only will know the tree glyph to print (branch or final edge) once we
* read one more entry */
- if (r > 0)
- r = asprintf(previous, "/%s/%s (%s%s%s)", path, de->d_name, ansi_highlight(), v, ansi_normal());
- else
+ if (r == -ESRCH) /* No systemd-owned file but still interesting to print */
r = asprintf(previous, "/%s/%s", path, de->d_name);
+ else /* if (r >= 0) */
+ r = asprintf(previous, "/%s/%s (%s%s%s)", path, de->d_name, ansi_highlight(), v, ansi_normal());
if (r < 0)
return log_oom();
--
2.39.2 (Apple Git-143)