Use submenus in grub-mkconfig.
* util/grub-mkconfig.in: Define GRUB_ACTUAL_DEFAULT. * util/grub-mkconfig_lib.in (grub_quote): New function. (gettext_printf): Use gettext and not gettext_quoted to fix several messages. * util/grub.d/10_hurd.in: Use submenus. * util/grub.d/10_kfreebsd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/grub.d/10_netbsd.in: Likewise. * util/grub.d/20_linux_xen.in: Likewise. * util/grub.d/30_os-prober.in: Likewise. * util/grub.d/10_illumos.in: Add missing quoting. * util/grub.d/10_windows.in: Likewise.
This commit is contained in:
parent
d9bef9bc43
commit
0cdc126ca2
11 changed files with 424 additions and 154 deletions
|
@ -52,7 +52,7 @@ osx_entry() {
|
|||
# TRANSLATORS: it refers on the OS residing on device %s
|
||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} $bitstr $onstr" --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
|
||||
menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
@ -73,10 +73,11 @@ EOF
|
|||
$1 /kernelcache boot-uuid=\${uuid} rd=*uuid
|
||||
else
|
||||
$1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
|
||||
elif [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
fi
|
||||
fi
|
||||
if [ -f /Extra/Extensions.mkext ]; then
|
||||
xnu_mkext /Extra/Extensions.mkext
|
||||
|
@ -123,7 +124,7 @@ for OS in ${OSPROBED} ; do
|
|||
|
||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} $onstr" --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
@ -147,6 +148,9 @@ EOF
|
|||
LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
|
||||
prepare_boot_cache=
|
||||
boot_device_id=
|
||||
is_first_entry=true
|
||||
title_correction_code=
|
||||
OS="${LONGNAME}"
|
||||
|
||||
for LINUX in ${LINUXPROBED} ; do
|
||||
LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
|
||||
|
@ -166,7 +170,7 @@ EOF
|
|||
fi
|
||||
|
||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||
recovery_params="$(echo "${LPARAMS}" | grep single)"
|
||||
recovery_params="$(echo "${LPARAMS}" | grep single)" || true
|
||||
counter=1
|
||||
while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
|
||||
counter=$((counter+1));
|
||||
|
@ -175,26 +179,59 @@ EOF
|
|||
boot_device_id="$(grub_get_device_id "${DEVICE}")"
|
||||
fi
|
||||
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
|
||||
cat << EOF
|
||||
menuentry "${LLABEL} $onstr" --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}"
|
||||
cat << EOF
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
cat << EOF
|
||||
menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
printf '%s\n' "${prepare_boot_cache}"
|
||||
cat << EOF
|
||||
linux ${LKERNEL} ${LPARAMS}
|
||||
EOF
|
||||
if [ -n "${LINITRD}" ] ; then
|
||||
if [ -n "${LINITRD}" ] ; then
|
||||
cat << EOF
|
||||
initrd ${LINITRD}
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
|
||||
is_first_entry=false
|
||||
fi
|
||||
title="${LLABEL} $onstr"
|
||||
cat << EOF
|
||||
menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t\t/"
|
||||
printf '%s\n' "${prepare_boot_cache}" | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
linux ${LKERNEL} ${LPARAMS}
|
||||
EOF
|
||||
if [ -n "${LINITRD}" ] ; then
|
||||
cat << EOF
|
||||
initrd ${LINITRD}
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
|
||||
replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
|
||||
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
|
||||
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
|
||||
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
|
||||
fi
|
||||
done
|
||||
if [ x"$is_first_entry" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
echo "$title_correction_code"
|
||||
;;
|
||||
macosx)
|
||||
OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
|
||||
|
@ -204,7 +241,7 @@ EOF
|
|||
hurd)
|
||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} $onstr" --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue