Is it possible to test which menu item was used to start the system. If the choice of kernel was different i can for example do this in my login script
if uname -r | grep -q lowlatency; then
jack-start
fi
But relying on kernel release seams ugly. I like to use the boot menu for such things is that I use the boot menu for choosing kernel/operating system anyway so doing more after startup takes more time.
Possible solutions i thought of other than using uname
are
Set an environment variable when invoking the boot-menu entry. If this is possible is quite nice
I have configured grub to remember last used entry. Can I get what entry it was from somewhere? Yes, I found the file
/boot/grub/grubenv
Here is a solution I found:
/boot/grub/grubenv
contains the name of the chosen entrySo I can now use
Another way, using
proc/cmdline
, example:It's possible to use
~/.bashrc
, to set a custom environment variable that it's value depends onproc/cmdline
. As you can add a custom Linux boot parameter if you think/boot/vmlinuz-3.13.0-37-generic
is not enough to identify it.Reference: