2009-10-26 Colin Watson <cjwatson@ubuntu.com>

Improve grub-mkconfig performance when there are several menu
	entries on a single filesystem.

	* util/grub.d/10_linux.in (linux_entry): Cache the output of
	prepare_grub_to_access_device.
	* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise.
	* util/grub.d/30_os-prober.in: Likewise.
This commit is contained in:
cjwatson 2009-10-26 16:28:04 +00:00
parent ba36be4119
commit e4f6809bbc
4 changed files with 25 additions and 3 deletions

View file

@ -31,7 +31,10 @@ kfreebsd_entry ()
cat << EOF
menuentry "$1" {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
kfreebsd ${rel_dirname}/${basename}
EOF
@ -58,6 +61,7 @@ EOF
list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
while [ "x$list" != "x" ] ; do
kfreebsd=`version_find_latest $list`