Skip to content

Commit

Permalink
grub2: Show output when run in systemd by default
Browse files Browse the repository at this point in the history
xref coreos/rpm-ostree#5071

Hiding errors by default is painful. At least as of
recently in Fedora it looks like the command is nice
and quiet by default, I only see

```
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
```
  • Loading branch information
cgwalters committed Aug 29, 2024
1 parent 2b01c93 commit 349aa3a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libostree/ostree-bootloader-grub2.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,15 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, int bootver
grub_argv[2] = gs_file_get_path_cached (new_config_path);

GSpawnFlags grub_spawnflags = G_SPAWN_SEARCH_PATH;
if (!g_getenv ("OSTREE_DEBUG_GRUB2"))
const bool running_in_systemd = getenv ("INVOCATION_ID") != NULL;
const bool debug_grub2 = g_getenv ("OSTREE_DEBUG_GRUB2");
/* If we're running in systemd (as part of `ostree-finalize-staged.service`)
* then we do want to gather output from the binary so that if something fails
* we can debug it.
*
* We also have an opt-in variable to display errors.
*/
if (!(running_in_systemd || debug_grub2))
grub_spawnflags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;
cdata.root = grub2_mkconfig_chroot;
g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
Expand Down

0 comments on commit 349aa3a

Please sign in to comment.