grub-devel
[Top][All Lists]
Advanced

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

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


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] grub-install: add search-file option for load.cfg
Date: Mon, 27 Feb 2012 02:24:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0

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<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


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




reply via email to

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