Feature Request - Multibooters -System Hostnames in Menu Lines

Asked by Herman Felderhof

I tried out Grub-Customizer for the first time today and I love it, it's great! I was impressed by how easily I can set a nice splashimage and add colours to my GRUB Menu, well done!

I often boot more than one Gnu/Linux and also like to have a USB Auxilliary installation or two which may be included in my GRUB Menu if they're plugged in when the menu is updated.
Having a list of 'Ubuntu, with Linux (followed by some numbers)' doesn't help me decide which line to select in order to choose an operating system to boot.
I want to be able to see the operating system's host names in my GRUB Menu, since those are more meaningful to humans.

I have tried doing some of my own reading, experiments trials and errors to achieve this. In the end I have discovered that it's surprisingly simple.

For the main operating system I edited /etc/grub.d/10_linux as follows, (approximately lines 79 to 91),
[code]
linux_entry ()
{
  os="$1"
  version="$2"
  recovery="$3"
  args="$4"
  if ${recovery} ; then
    title="$(gettext_quoted "%s, OCZ-Oneiric with Linux %s (recovery mode)")"
  else
    title="$(gettext_quoted "%s, OCZ-Oneiric with Linux %s")"
  fi
  printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
  cat << EOF
[/code]I inserted my OS host name 'OCZ-Oneiric' as shown.
When update-grub is run, (or when Grub-Customizer is started), this causes the home operating system's own Grub Menu Lines to display the home OS host name.

And in all other operating systems in other disks and partitions, I append the following line to /etc/lsb-release: HOSTNAME=<Hostname>
[code]
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"
HOSTNAME=USB-Narwhal
[/code]
Where: The OS hostname is "USB-Narwhal", ( replace with the appropriate hostname for the OS the file belongs to).

Whenever update-grub is run, (or when Grub-Customizer is started), this causes the Grub Menu Lines for all other Gnu/Linux installations to display the OS host names for those operating systems.

Actually, I edit both files in all operating systems like this, so they all will be listed the way I like in each others GRUB Menus.

I have tried this out in Ubuntu Natty Narwhal, Oneiric Ocelot and Precise Pangolin and it seems to work well for me so far. But I'm lazy and I don't mind sharing my secret if in exchange for the prospect that these edits can be done easier by having them included in Grub-Customizer.

Of course I imagine you would need to investigate how this may affect any other programs which might also use those files.
I am hoping it will turn out to be okay. I haven't been trying this over a long time period yet so I'm not sure, but all I can say it seems to work well for me so far.

Regards, Herman :)

Question information

Language:
English Edit question
Status:
Answered
For:
Grub Customizer Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Daniel Richter (danielrichter2007) said :
#1

I don't think that Grub Customizer is a good place for something like this.

The problems are:

* automatic modification of program code is very unstable. If the 10_linux will be modified by its authors, the functionality is broken in most cases
 * I have no idea how to show up such a feature on the grub customizer gui - in a way where users understand what it's intended to do. It would be a seconds way of renaming menuentries.

The better way is to ask the grub2 developers about generating better menuentry titles by default.

Revision history for this message
Herman Felderhof (herman543) said :
#2

Okay, nevermind then, sorry for bothering you. I don't think I will bother the GRUB developers though, it's more of a customization. Have a nice day,
Regards, Herman :)

Can you help with this problem?

Provide an answer of your own, or ask Herman Felderhof for more information if necessary.

To post a message you must log in.