Re: Grub 2 Title Tweaks Thread
Thanks drs305, got it working now:
your code was almost right, and got me on the way:
Code:
if [[ "${LONGNAME}" = "Enter Exact Title You Just Copied" && "${DEVICE}" = "/dev/sda1" ]] ; then
LONGNAME="Enter Desired New Title Here"
elif [ -z "${LONGNAME}" ] ; then
LONGNAME="${LABEL}"
fi
should be:
Code:
if [ "${LONGNAME}" = "Enter Exact Title You Just Copied" ] && [ "${DEVICE}" = "/dev/sda1" ] ; then
LONGNAME="Enter Desired New Title Here"
elif [ -z "${LONGNAME}" ] ; then
LONGNAME="${LABEL}"
fi
(just a different use of the [ ] items.)
Thanks!
Dax
Re: Grub 2 Title Tweaks Thread
This looks helpful; maybe I will try again. On the other hand, it perfectly illustrates what a bloated pile of failure GRUB2 is. The HOWTO for changing the GRUB2 boot menu is almost as long as the HOWTO for setting up a LAMP server, and that is desperately sad.
Re: Grub 2 Title Tweaks Thread
Thanks for this (and other) postings about grub2. I had a bit of trouble with some of the code, to be exact: part 2D. The string comparison gave me some errors. The solution was to quote both the parts before and after the equal sign. For this part it would be as follows:
(it's hard to see, but the changes (double quotes) are bold and underlined):
Code:
if [ "${nomemtest}" = "Memory" ] || [ "${nosingle}" = "single" ]; then
continue
fi
btw: I found the solution here:
http://stackoverflow.com/questions/1...ing-comparison
Re: Grub 2 Title Tweaks Thread
Quote:
Originally Posted by
alveola
Thanks for this (and other) postings about grub2. I had a bit of trouble with some of the code, to be exact: part 2D. The string comparison gave me some errors. The solution was to quote both the parts before and after the equal sign.
Ok, thanks. I'm at a hotel so I'll change them now and play with them when I return home.
Re: Grub 2 Title Tweaks Thread
I'm trying to remove the (on /dev/sda2) string this brain dead piece of crap keeps adding but I searched 10_linux for the string ${DEVICE} and didn't find it. Any ideas?
Re: Grub 2 Title Tweaks Thread
Quote:
Originally Posted by
deep64blue
I'm trying to remove the (on /dev/sda2) string this brain dead piece of crap keeps adding but I searched 10_linux for the string ${DEVICE} and didn't find it. Any ideas?
The 10_linux script works on the system partition and doesn't attach the "(on /dev/sda4)" label to the menuentry.
Most likely, you have another Linux installation on a different partition that is being detected by 30_os-prober. You can check by looking at /boot/grub/grub.cfg. The contents of this file are sectioned by the script that created it ("### BEGIN.... ). Find the menuentry which you want to change and then determine the section it is in. The section name is the same as the file you want to edit.
Re: Grub 2 Title Tweaks Thread
Wow, thanks for the great writeup. I'm a total newbie and I could follow it no problem!
This is perhaps trivial, but
Code:
codename="`lsb_release -cs`"
returns the codename in all lowercase. Would it be ridiculous to make it capitalize the first letter?
Another very particular question:
Would it be possible to use only the last part of the kernel version number to, for example, get an entry to read like "Ubuntu Karmic (-14)"
Re: Grub 2 Title Tweaks Thread
Quote:
Originally Posted by
burgerearl
This is perhaps trivial, but
Code:
codename="`lsb_release -cs`"
returns the codename in all lowercase. Would it be ridiculous to make it capitalize the first letter?
Hey, I said this thread was for truly anal users, so all ridiculous is accepted! ;-)
I worked with the 10-linux file, although you could modify them for use in the 30_os-prober file as well. I am referencing Section 1 of the first post. Under codename="`lsb_release -cs`" add this line:
Quote:
Codename="`echo $codename | tr [hjkl] [HJKL]`"
It's a hack, but will translate hardy/jaunty/karmic/lucid into Hardy/Jaunty/Karmic/Lucid. There is obviously a better script, but this is simple and will work specifically for those names. Note you couldn't add an I for intrepid, since it would turn out IntrepId...
Quote:
Another very particular question:
Would it be possible to use only the last part of the kernel version number to, for example, get an entry to read like "Ubuntu Karmic (-14)"
To shorten to just the trailing digits (example -14), add this variable in the same place:
Quote:
short_version="(-`echo $version | cut -d "-" -f 2`)"
If you want to see "-14-generic" use this:
Quote:
short_version="(-`echo $version | cut -d "-" -f 2-`)"
Then change the original line:
Quote:
linux_entry "${OS}, Linux ${version}" \
to:
Quote:
linux_entry "${Codename} ${shortversion}" \
Combined, the two should produce results like these:
Karmic (-14)
Karmic (-14-generic)
Re: Grub 2 Title Tweaks Thread
Perfect, that did exactly what I wanted. Thanks!
To reduce my newbliness, what would this be called? Just scripting language, or....? Basically, I'm wondering what I should search for to teach myself some of the syntax.
Re: Grub 2 Title Tweaks Thread
Quote:
Originally Posted by
burgerearl
Perfect, that did exactly what I wanted. Thanks!
To reduce my newbliness, what would this be called? Just scripting language, or....? Basically, I'm wondering what I should search for to teach myself some of the syntax.
If you look at the first line of the script files you will see most are bash. Some are sh. Everything I've tweaked has been with basic BASH scripting, and I'm talking very basic BASH. More complex BASH statements could be used in many of the examples but I've kept most of the tweaks simple.
There are lots of BASH examples and tutorials floating around the internet.