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:
parent
6193defe9f
commit
2c2a681b39
4 changed files with 67 additions and 20 deletions
15
ChangeLog
15
ChangeLog
|
@ -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>
|
2007-06-23 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
* util/update-grub_lib.in (font_path): New function. Determine wether
|
* util/update-grub_lib.in (font_path): New function. Determine wether
|
||||||
|
|
|
@ -186,13 +186,10 @@ if test "x$fs_module" = xfat; then :; else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Then the partition map module.
|
# Then the partition map module. In order to support partition-less media,
|
||||||
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
|
# this command is allowed to fail (--target=fs already grants us that the
|
||||||
if test "x$partmap_module" = x -a "x$modules" = x; then
|
# filesystem will be accessible).
|
||||||
echo "Auto-detection of a partition map module failed." 1>&2
|
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
|
||||||
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# _chain is often useful
|
# _chain is often useful
|
||||||
modules="$modules $fs_module $partmap_module _chain"
|
modules="$modules $fs_module $partmap_module _chain"
|
||||||
|
|
|
@ -219,13 +219,10 @@ if test "x$fs_module" = x -a "x$modules" = x; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Then the partition map module.
|
# Then the partition map module. In order to support partition-less media,
|
||||||
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
|
# this command is allowed to fail (--target=fs already grants us that the
|
||||||
if test "x$partmap_module" = x -a "x$modules" = x; then
|
# filesystem will be accessible).
|
||||||
echo "Auto-detection of a partition map module failed." 1>&2
|
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
|
||||||
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# _chain is often useful
|
# _chain is often useful
|
||||||
modules="$modules $fs_module $partmap_module _chain"
|
modules="$modules $fs_module $partmap_module _chain"
|
||||||
|
|
|
@ -36,6 +36,8 @@ platform=@platform@
|
||||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||||
|
|
||||||
grub_mkimage=${bindir}/`echo grub-mkimage | 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=
|
rootdir=
|
||||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||||
modules=
|
modules=
|
||||||
|
@ -59,7 +61,9 @@ Install GRUB on your drive.
|
||||||
--modules=MODULES pre-load specified modules MODULES
|
--modules=MODULES pre-load specified modules MODULES
|
||||||
--root-directory=DIR install GRUB images under the directory DIR
|
--root-directory=DIR install GRUB images under the directory DIR
|
||||||
instead of the root directory
|
instead of the root directory
|
||||||
|
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
--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
|
--no-nvram don't update the boot-device NVRAM variable
|
||||||
|
|
||||||
grub-install copies GRUB images into the DIR/boot directory specfied by
|
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=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
--grub-mkdevicemap=*)
|
||||||
|
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
|
--grub-probe=*)
|
||||||
|
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||||
--no-nvram)
|
--no-nvram)
|
||||||
update_nvram=no ;;
|
update_nvram=no ;;
|
||||||
# This is an undocumented feature...
|
# This is an undocumented feature...
|
||||||
|
@ -113,6 +121,7 @@ fi
|
||||||
# Initialize these directories here, since ROOTDIR was initialized.
|
# Initialize these directories here, since ROOTDIR was initialized.
|
||||||
bootdir=${rootdir}/boot
|
bootdir=${rootdir}/boot
|
||||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||||
|
device_map=${grubdir}/device.map
|
||||||
|
|
||||||
set $grub_mkimage dummy
|
set $grub_mkimage dummy
|
||||||
if test -f "$1"; then
|
if test -f "$1"; then
|
||||||
|
@ -123,8 +132,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find the partition at the right mount point.
|
# Find the partition at the right mount point.
|
||||||
install_device=`awk '$2 == '"\"$grubdir\""' { print $1 }' < /proc/mounts`
|
install_device=`$grub_mkdevicemap --device-map=/dev/stdout | $grub_probe --target=device --device-map=/dev/stdin ${grubdir}`
|
||||||
if test "x$install_device" = x; then
|
|
||||||
|
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."
|
echo "$grubdir must be a mount point."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -134,6 +144,16 @@ fi
|
||||||
test -d "$bootdir" || mkdir "$bootdir" || exit 1
|
test -d "$bootdir" || mkdir "$bootdir" || exit 1
|
||||||
test -d "$grubdir" || mkdir "$grubdir" || 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.
|
# Copy the GRUB images to the GRUB directory.
|
||||||
for file in ${grubdir}/*.mod ${grubdir}/*.lst ; do
|
for file in ${grubdir}/*.mod ${grubdir}/*.lst ; do
|
||||||
if test -f $file; then
|
if test -f $file; then
|
||||||
|
@ -144,12 +164,21 @@ for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ; do
|
||||||
cp -f $file ${grubdir} || exit 1
|
cp -f $file ${grubdir} || exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create the core image with all modules, unless user specified a subset.
|
# Create the core image. First, auto-detect the filesystem module.
|
||||||
# XXX probe for partition map and filesystem?
|
fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
|
||||||
if test "x$modules" = x; then
|
if test "x$fs_module" = x -a "x$modules" = x; then
|
||||||
modules="$pkglibdir"/*.mod
|
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
|
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.
|
# Now perform the installation.
|
||||||
"$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
|
"$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
|
||||||
|
|
||||||
|
@ -187,5 +216,14 @@ if test $update_nvram = yes; then
|
||||||
}
|
}
|
||||||
fi
|
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.
|
# Bye.
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue