Robert Millan writes:

> I reworked and cleaned up the patch a bit.  Please, can you test this one?

This has lvm after biosdisk, which looks ok.

    grub-mkimage --output=/boot/grub/core.img --prefix=/tmp/boot/grub ext2 
biosdisk lvm _chain

Haven't boot-tested this yet, but should be ok.

Btw, I'm editing grub-install all the time to not really install, what about a 
--dry-run option?  (patch against your version attached)

Greetings,
Jan.

-- 
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
Index: ChangeLog
===================================================================
RCS file: /sources/grub/grub2/ChangeLog,v
retrieving revision 1.484
diff -p -u -r1.484 ChangeLog
--- ChangeLog	8 Jan 2008 11:38:18 -0000	1.484
+++ ChangeLog	9 Jan 2008 13:33:51 -0000
@@ -1,3 +1,7 @@
+2008-01-09  Jan Nieuwenhuizen  <[EMAIL PROTECTED]>
+
+	* util/i386/pc/grub-install.in: Add --dry-run option.
+
 2008-01-08  Robert Millan  <[EMAIL PROTECTED]>
 
 	* loader/i386/pc/linux.c (grub_rescue_cmd_linux): For

--- util/i386/pc/grub-install.in~	2008-01-09 14:32:02.000000000 +0100
+++ util/i386/pc/grub-install.in	2008-01-09 14:28:25.000000000 +0100
@@ -44,6 +44,7 @@
 force_lba=
 recheck=no
 debug=no
+dry_run=
 
 # for make_system_path_relative_to_its_root()
 . ${libdir}/grub/update-grub_lib
@@ -57,6 +58,7 @@
 
   -h, --help              print this message and exit
   -v, --version           print the version information and exit
+  -n, --dry-run           do not install grub, just print install commands
   --modules=MODULES       pre-load specified modules MODULES
   --root-directory=DIR    install GRUB images under the directory DIR
                           instead of the root directory
@@ -86,6 +88,8 @@
     -v | --version)
 	echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
 	exit 0 ;;
+    -n | --dry-run)
+	dry_run=echo ;;
     --modules=*)
 	modules=`echo "$option" | sed 's/--modules=//'` ;;
     --root-directory=*)
@@ -174,8 +178,8 @@
 fi
 
 # Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
-test -d "$grubdir" || mkdir "$grubdir" || exit 1
+test -d "$bootdir" || $dry_run mkdir "$bootdir" || exit 1
+test -d "$grubdir" || $dry_run mkdir "$grubdir" || exit 1
 
 # If --recheck is specified, remove the device map, if present.
 if test $recheck = yes; then
@@ -203,11 +207,11 @@
 # Copy the GRUB images to the GRUB directory.
 for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
     if test -f $file && [ "`basename $file`" != menu.lst ]; then
-	rm -f $file || exit 1
+	$dry_run rm -f $file || exit 1
     fi
 done
 for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
-    cp -f $file ${grubdir} || exit 1
+    $dry_run cp -f $file ${grubdir} || exit 1
 done
 
 # Create the core image. First, auto-detect the filesystem module.
@@ -229,13 +233,14 @@
 # _chain is often useful
 modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
-$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
+$dry_run $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
 # Now perform the installation.
-$grub_setup --directory=${grubdir} --device-map=${device_map} \
+$dry_run $grub_setup --directory=${grubdir} --device-map=${device_map} \
     ${install_device} || exit 1
 
 # Prompt the user to check if the device map is correct.
+test -n "$dry_run" && echo "DRY RUN: Grub was not (re)installed."
 echo "Installation finished. No error reported."
 echo "This is the contents of the device map $device_map."
 echo "Check if this is correct or not. If any of the lines is incorrect,"
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to