grub-install: add search-file option for load.cfg
A message that is not in the archive (sent off-list or not yet received): [email protected]
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
Quoted 50 lines · Jon Ringle
Signed-off-by Jon Ringle<[email protected]>--- util/grub-install.in | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-)util/grub-install.in +21
-5@@ -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
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko