I had to rewrite it because of several problems involving lack of fallback if UUID is unavailable, lack of documentation and so on. Committed my version
On 14.01.2012 03:59, Jon Ringle wrote:
Signed-off-by: Jon Ringle<j...@ringle.org>
---
  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


--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


_______________________________________________
Bug-grub mailing list
Bug-grub@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-grub

Reply via email to