bug-grub
[Top][All Lists]
Advanced

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

[PATCH] grub-install: add search-file option for load.cfg


From: Jon Ringle
Subject: [PATCH] grub-install: add search-file option for load.cfg
Date: Fri, 13 Jan 2012 21:59:22 -0500

Signed-off-by: Jon Ringle <address@hidden>
---
 util/grub-install.in |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/util/grub-install.in b/util/grub-install.in
index ff8bea8..20a3b7d 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -245,6 +245,9 @@ do
     --debug-image=*)
        debug_image="`echo "$option" | sed 's/--debug-image=//'`" ;;
 
+    --search-file)
+       set_search_file=yes ;;
+
     -f | --force)
         setup_force="--force" ;;
 
@@ -534,12 +537,25 @@ if [ "x${devabstraction_module}" = "x" ] ; then
              echo "UUID needed with cross-disk installs, but the filesystem 
containing ${grubdir} does not support UUIDs." 1>&2
           fi
              
-          exit 1
+          set_search_file=yes
+        fi
+
+        if [ "x${set_search_file}" = xyes ]; then
+          search_file=$(mktemp "${grubdir}/XXXXXXXXXXXXXXXXXXXXXXXXX.uuid")
+          search_file="$("${grub_mkrelpath}" "${search_file}")"
+        fi
+
+        if [ "x${search_file}" = "x" ] ; then
+          echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
+          echo 'set prefix=($root)'"${relative_grubdir}" >> 
"${grubdir}/load.cfg"
+          config_opt="-c ${grubdir}/load.cfg "
+          modules="$modules search_fs_uuid"
+        else
+          echo "search.file ${search_file} root " >> "${grubdir}/load.cfg"
+          echo 'set prefix=($root)'"${relative_grubdir}" >> 
"${grubdir}/load.cfg"
+          config_opt="-c ${grubdir}/load.cfg "
+          modules="$modules search_fs_file"
         fi
-        echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
-       echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
-       config_opt="-c ${grubdir}/load.cfg "
-        modules="$modules search_fs_uuid"
     elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then
         # we need to hardcode the partition number in the core image's prefix.
        if [ x"$grub_partition" = x ]; then
-- 
1.7.5.4




reply via email to

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