#1040526 grub-pc: update-grub; 40_custom - visible feedback

Package:
grub-pc
Source:
grub-pc
Description:
GRand Unified Bootloader, version 2 (PC/BIOS version)
Submitter:
mh
Date:
2023-07-21 12:51:03 UTC
Severity:
normal
#1040526#5
Date:
2023-07-07 10:02:54 UTC
From:
To:
Dear Maintainer,

This is a followup to bug 1040455 (closed now) as a wishlist bug:

Please change the template 40_custom in a way that users get a visible
feedback for their entries when running update-grub.

A somewhat skilled user might be able to create a new menuentry in
/ect/grub.d/*40_custom. But making something like
"menuentry 'what-name-ever'"
visible as on screen output (like all other kernels found by other
scripts under /etc/40_custom) needs too much scripting skills for
average users. So please enhance the existing script template
accordingly (upstream) to show some usefull feedback / visible output.

Michael

#1040526#10
Date:
2023-07-08 10:43:54 UTC
From:
To:
Am Fri, 07 Jul 2023 10:06:04 +0000
schrieb "Debian Bug Tracking System" <owner@bugs.debian.org>:
...

I need to correct a wrong path:

wrong:
********
visible as on screen output (like all other kernels found by other
scripts under /etc/40_custom)
********

right:
*******
visible as on screen output (like all other kernels found by other
scripts under /etc/grub.d/)
*******

Michael

#1040526#15
Date:
2023-07-21 12:46:20 UTC
From:
To:
This is how the original template for /etc/grub.d/40_custom looks:

************************
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply
type the # menu entries you want to add after this comment.  Be careful
not to change # the 'exec tail' line above.
*************************

It should be changed to:

*************************
#!/bin/sh
if grep -Fxq "#GRUB_DISABLE_OS_PROBER=false" /etc/default/grub; then
  sed -En "s/^menuentry '([^']+).*/Found custom entry: \1/p" $0 >&2;
fi; #new for feedback on terminal
exec tail -n +6 $0 # +6 instead of +3 due to above lines
# This file provides an easy way to add custom menu entries.  Simply
type the # menu entries you want to add after this comment.  Be careful
not to change # the 'exec tail' line above.
*************************

This way the user gets a *complete* on screen feedback of what
kernel entries are found and copied to /boot/grub/grub.cfg .
(The explaining comments should obviously be deleted)

With os-prober enabled those custom entries would be found without this
new function and then copied to grub.cfg AND listed as such on screen.
To avoid double entries the new added function will therefore be
executed only if os-prober is _not_ active.


Greetings

Michael