2007-07-02 Robert Millan <rmh@aybabtu.com>

* util/i386/efi/grub-install.in: Allow `grub_probe --target=partmap'
	invocation to fail, in order to support partition-less media.

	* util/i386/pc/grub-install.in: Likewise.

	* util/powerpc/ieee1275/grub-install.in: Use grub-probe to determine
	which fs or partmap modules are needed (akin to its sister scripts).

	Also use grub-probe to get rid of unportable /proc/mounts check.

	Print the same informational message that the other scripts do, before
	exitting.
This commit is contained in:
robertmh 2007-07-02 13:58:03 +00:00
parent 6193defe9f
commit 2c2a681b39
4 changed files with 67 additions and 20 deletions

View File

@ -1,3 +1,18 @@
2007-07-02 Robert Millan <rmh@aybabtu.com>
* util/i386/efi/grub-install.in: Allow `grub_probe --target=partmap'
invocation to fail, in order to support partition-less media.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Use grub-probe to determine
which fs or partmap modules are needed (akin to its sister scripts).
Also use grub-probe to get rid of unportable /proc/mounts check.
Print the same informational message that the other scripts do, before
exitting.
2007-06-23 Robert Millan <rmh@aybabtu.com>
* util/update-grub_lib.in (font_path): New function. Determine wether

View File

@ -186,13 +186,10 @@ if test "x$fs_module" = xfat; then :; else
exit 1
fi
# Then the partition map module.
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
if test "x$partmap_module" = x -a "x$modules" = x; then
echo "Auto-detection of a partition map module failed." 1>&2
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
exit 1
fi
# Then the partition map module. In order to support partition-less media,
# this command is allowed to fail (--target=fs already grants us that the
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
# _chain is often useful
modules="$modules $fs_module $partmap_module _chain"

View File

@ -219,13 +219,10 @@ if test "x$fs_module" = x -a "x$modules" = x; then
exit 1
fi
# Then the partition map module.
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
if test "x$partmap_module" = x -a "x$modules" = x; then
echo "Auto-detection of a partition map module failed." 1>&2
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
exit 1
fi
# Then the partition map module. In order to support partition-less media,
# this command is allowed to fail (--target=fs already grants us that the
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
# _chain is often useful
modules="$modules $fs_module $partmap_module _chain"

View File

@ -36,6 +36,8 @@ platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
rootdir=
grub_prefix=`echo /boot/grub | sed ${transform}`
modules=
@ -59,7 +61,9 @@ Install GRUB on your drive.
--modules=MODULES pre-load specified modules MODULES
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-probe=FILE use FILE as grub-probe
--no-nvram don't update the boot-device NVRAM variable
grub-install copies GRUB images into the DIR/boot directory specfied by
@ -83,8 +87,12 @@ for option in "$@"; do
modules=`echo "$option" | sed 's/--modules=//'` ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
--grub-mkdevicemap=*)
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-probe=*)
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
--no-nvram)
update_nvram=no ;;
# This is an undocumented feature...
@ -113,6 +121,7 @@ fi
# Initialize these directories here, since ROOTDIR was initialized.
bootdir=${rootdir}/boot
grubdir=${bootdir}/`echo grub | sed ${transform}`
device_map=${grubdir}/device.map
set $grub_mkimage dummy
if test -f "$1"; then
@ -123,8 +132,9 @@ else
fi
# Find the partition at the right mount point.
install_device=`awk '$2 == '"\"$grubdir\""' { print $1 }' < /proc/mounts`
if test "x$install_device" = x; then
install_device=`$grub_mkdevicemap --device-map=/dev/stdout | $grub_probe --target=device --device-map=/dev/stdin ${grubdir}`
if test "x$install_device" = "x`$grub_mkdevicemap --device-map=/dev/stdout | $grub_probe --target=device --device-map=/dev/stdin ${bootdir}`"; then
echo "$grubdir must be a mount point."
exit 1
fi
@ -134,6 +144,16 @@ fi
test -d "$bootdir" || mkdir "$bootdir" || exit 1
test -d "$grubdir" || mkdir "$grubdir" || exit 1
# Create the device map file if it is not present.
if test -f "$device_map"; then
:
else
# Create a safe temporary file.
test -n "$mklog" && log_file=`$mklog`
$grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
fi
# Copy the GRUB images to the GRUB directory.
for file in ${grubdir}/*.mod ${grubdir}/*.lst ; do
if test -f $file; then
@ -144,12 +164,21 @@ for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ; do
cp -f $file ${grubdir} || exit 1
done
# Create the core image with all modules, unless user specified a subset.
# XXX probe for partition map and filesystem?
if test "x$modules" = x; then
modules="$pkglibdir"/*.mod
# Create the core image. First, auto-detect the filesystem module.
fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
if test "x$fs_module" = x -a "x$modules" = x; then
echo "Auto-detection of a filesystem module failed." 1>&2
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
exit 1
fi
# Then the partition map module. In order to support partition-less media,
# this command is allowed to fail (--target=fs already grants us that the
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
modules="$modules $fs_module $partmap_module"
# Now perform the installation.
"$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
@ -187,5 +216,14 @@ if test $update_nvram = yes; then
}
fi
# Prompt the user to check if the device map is correct.
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,"
echo "fix it and re-run the script \`grub-install'."
echo
cat $device_map
# Bye.
exit 0