commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[2658] 2009-10-26 Colin Watson <address@hidden>


From: Colin Watson
Subject: [2658] 2009-10-26 Colin Watson <address@hidden>
Date: Mon, 26 Oct 2009 16:28:06 +0000

Revision: 2658
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2658
Author:   cjwatson
Date:     2009-10-26 16:28:04 +0000 (Mon, 26 Oct 2009)
Log Message:
-----------
2009-10-26  Colin Watson  <address@hidden>

        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.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/util/grub.d/10_kfreebsd.in
    trunk/grub2/util/grub.d/10_linux.in
    trunk/grub2/util/grub.d/30_os-prober.in

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-10-26 00:41:58 UTC (rev 2657)
+++ trunk/grub2/ChangeLog       2009-10-26 16:28:04 UTC (rev 2658)
@@ -1,3 +1,13 @@
+2009-10-26  Colin Watson  <address@hidden>
+
+       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  <address@hidden>
 
        * util/grub.d/10_freebsd.in: Remove.

Modified: trunk/grub2/util/grub.d/10_kfreebsd.in
===================================================================
--- trunk/grub2/util/grub.d/10_kfreebsd.in      2009-10-26 00:41:58 UTC (rev 
2657)
+++ trunk/grub2/util/grub.d/10_kfreebsd.in      2009-10-26 16:28:04 UTC (rev 
2658)
@@ -31,7 +31,10 @@
   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 @@
 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`

Modified: trunk/grub2/util/grub.d/10_linux.in
===================================================================
--- trunk/grub2/util/grub.d/10_linux.in 2009-10-26 00:41:58 UTC (rev 2657)
+++ trunk/grub2/util/grub.d/10_linux.in 2009-10-26 16:28:04 UTC (rev 2658)
@@ -47,7 +47,10 @@
   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
        linux   ${rel_dirname}/${basename} 
root=${linux_root_device_thisversion} ro $2
 EOF
@@ -64,6 +67,7 @@
 list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
         if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
       done`
+prepare_boot_cache=
 
 while [ "x$list" != "x" ] ; do
   linux=`version_find_latest $list`

Modified: trunk/grub2/util/grub.d/30_os-prober.in
===================================================================
--- trunk/grub2/util/grub.d/30_os-prober.in     2009-10-26 00:41:58 UTC (rev 
2657)
+++ trunk/grub2/util/grub.d/30_os-prober.in     2009-10-26 16:28:04 UTC (rev 
2658)
@@ -74,6 +74,7 @@
     ;;
     linux)
       LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | 
paste -s -d ' '`"
+      prepare_boot_cache=
 
       for LINUX in ${LINUXPROBED} ; do
         LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
@@ -90,7 +91,10 @@
         cat << EOF
 menuentry "${LLABEL} (on ${DEVICE})" {
 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
        linux ${LKERNEL} ${LPARAMS}
 EOF





reply via email to

[Prev in Thread] Current Thread [Next in Thread]