Last active
February 10, 2018 20:17
-
-
Save xenithorb/a7cd12c3482a2c5de73fd4e90a24b793 to your computer and use it in GitHub Desktop.
Add redundant menuentries in GRUB with extra cmdline paramaters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IMPORTANT: Add the following to /etc/default/grub first! | |
# | |
# export GRUB_CMDLINE_LINUX_APPEND='<your_extra_cmdline_params>' | |
# export GRUB_OS_NAME_APPEND='<your_appended_id>' | |
# | |
# Note: ^ The export at the beginning is imperative unlike the rest | |
# | |
# Also maybe of interest (to save the selection): | |
# | |
# GRUB_DEFAULT=saved | |
# GRUB_SAVEDEFAULT=true | |
# | |
GRUB_DISABLE_RECOVERY=true | |
GRUB_LINUX_MAKE_DEBUG=false | |
OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" | |
OS_VERS+=" ${GRUB_OS_NAME_APPEND}" | |
GRUB_CMDLINE_LINUX+=" ${GRUB_CMDLINE_LINUX_APPEND}" | |
menuentry_id_append=$(sed 's|[[:space:]]|_|g;s|[[:punct:]]||g;s|\(.*\)|\L\1|' <<< "${GRUB_OS_NAME_APPEND:-custom}" ) | |
fifo="${0}_fifo"; mkfifo "$fifo" | |
sed -e '/^[ ]*OS_VERS=.*/d;/^[ ]*local OS_VERS/d;/^#/d' \ | |
-e 's|advanced standard \\|advanced-'"${menuentry_id_append}"' standard \\|' \ | |
${0%/*}/10_linux > "$fifo" & | |
source "$fifo" | |
rm "$fifo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Small revision to the grub entry duplicator
https://gist.github.com/xenithorb/a7cd12c3482a2c5de73fd4e90a24b793/revisions#diff-3ba936fd2b2a7eb91978a384d602ba46
Due to:
They would previously be generated with the same "id" and thus grub would pick the first one when
savedefault
is used ... so it picks the wrong one - with this patch it adds a lowered/trimmed version ofGRUB_OS_NAME_APPEND
to the id to make it unique.So now with:
It produces (in /boot/grub2/grubenv):