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:
parent
ba36be4119
commit
e4f6809bbc
4 changed files with 25 additions and 3 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
|
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
* util/grub.d/10_freebsd.in: Remove.
|
* util/grub.d/10_freebsd.in: Remove.
|
||||||
|
|
|
@ -31,7 +31,10 @@ kfreebsd_entry ()
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry "$1" {
|
menuentry "$1" {
|
||||||
EOF
|
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
|
cat << EOF
|
||||||
kfreebsd ${rel_dirname}/${basename}
|
kfreebsd ${rel_dirname}/${basename}
|
||||||
EOF
|
EOF
|
||||||
|
@ -58,6 +61,7 @@ EOF
|
||||||
list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
|
list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||||
done`
|
done`
|
||||||
|
prepare_boot_cache=
|
||||||
|
|
||||||
while [ "x$list" != "x" ] ; do
|
while [ "x$list" != "x" ] ; do
|
||||||
kfreebsd=`version_find_latest $list`
|
kfreebsd=`version_find_latest $list`
|
||||||
|
|
|
@ -47,7 +47,10 @@ linux_entry ()
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry "$1" {
|
menuentry "$1" {
|
||||||
EOF
|
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
|
cat << EOF
|
||||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
|
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
|
||||||
EOF
|
EOF
|
||||||
|
@ -64,6 +67,7 @@ EOF
|
||||||
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||||
done`
|
done`
|
||||||
|
prepare_boot_cache=
|
||||||
|
|
||||||
while [ "x$list" != "x" ] ; do
|
while [ "x$list" != "x" ] ; do
|
||||||
linux=`version_find_latest $list`
|
linux=`version_find_latest $list`
|
||||||
|
|
|
@ -74,6 +74,7 @@ EOF
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
|
LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
|
||||||
|
prepare_boot_cache=
|
||||||
|
|
||||||
for LINUX in ${LINUXPROBED} ; do
|
for LINUX in ${LINUXPROBED} ; do
|
||||||
LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
|
LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
|
||||||
|
@ -90,7 +91,10 @@ EOF
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry "${LLABEL} (on ${DEVICE})" {
|
menuentry "${LLABEL} (on ${DEVICE})" {
|
||||||
EOF
|
EOF
|
||||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
if [ -z "${prepare_boot_cache}" ]; then
|
||||||
|
prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")"
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${prepare_boot_cache}"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
linux ${LKERNEL} ${LPARAMS}
|
linux ${LKERNEL} ${LPARAMS}
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue