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

Reply via email to