bootctl: Also display the root for entry paths

People apparently expect the bootloader to magically know the userspace
filesystem tree and get confused when boot files aren't found because of
this. Printing the root of entry paths will hopefully make it easier for
people to understand a bad configuration.

To hopefully make it clear that the prefix should not be used inside of
a config snipped, it is greyed out and uses an extra path separator:
    <gray>/root/</gray>/boot/loader/path
This commit is contained in:
Jan Janssen
2022-10-12 15:11:14 +02:00
parent 1a9874905a
commit 7851732262
+6 -2
View File
@@ -726,7 +726,7 @@ static int boot_entry_load_unified(
if (!tmp.root)
return log_oom();
tmp.kernel = strdup(skip_leading_chars(k, "/"));
tmp.kernel = path_make_absolute(k, "/");
if (!tmp.kernel)
return log_oom();
@@ -1278,7 +1278,11 @@ static void boot_entry_file_list(
int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT, F_OK, NULL, NULL);
printf("%13s%s ", strempty(field), field ? ":" : " ");
/* Note that this shows two '/' between the root and the file. This is intentional to highlight (in
* the abscence of color support) to the user that the boot loader is only interested in the second
* part of the file. */
printf("%13s%s %s%s/%s", strempty(field), field ? ":" : " ", ansi_grey(), root, ansi_normal());
if (status < 0) {
errno = -status;
printf("%s%s%s (%m)\n", ansi_highlight_red(), p, ansi_normal());