fix some portability problems (by pavel).

This commit is contained in:
okuji 2000-04-19 10:34:35 +00:00
parent 92fca67cf5
commit 98ca2ba846
4 changed files with 61 additions and 29 deletions

View file

@ -1,3 +1,16 @@
2000-04-18 Pavel Roskin <pavel_roskin@geocities.com>
* util/grub-install.in: Don't use `!' in `test' for more
portability.
Don't use `for' without `in' for compatability with ash.
Check install_device before running grub if possible. Added
error messages if install_device is not set or not unique.
Exit if mkdir fails.
Add a message about successful installation.
Remove unneeded backslash in the final message.
(convert): use `test -b' instead of `test -e' because ash
doesn't understand the later. Correct error message accordingly.
2000-04-17 OKUJI Yoshinori <okuji@gnu.org>
The user doesn't have to recompile GRUB for his/her buggy BIOS

5
NEWS
View file

@ -16,6 +16,11 @@ New in 0.5.95 - XXXX-XX-XX:
LBA mode, you should specify it. It is necessary if your BIOS is too
buggy. In the previous version, it was a compile-time option, but you
don't have to recompile GRUB any longer.
* Likewise, now the command "setup" and the script "grub-install" also
accept `--force-lba' option. Specifying this option to "setup" or
"grub-install" has the same effect as to the command "install".
* The configure script doesn't accept the option
`--disable-lba-support-bitmap-check' any longer. Use the option above.
New in 0.5.94 - 2000-03-06:
* Stage 1 supports both the LBA mode and the CHS mode.

View file

@ -2,7 +2,7 @@ You can use the netboot support to download OS images from a network.
Nearly all the device drivers are coming from the network-based boot
loader, Etherboot. Please visit its web page. They have rich
documentations so you will be able to get useful information from there.
The URL is <http://www.slug.org.au/etherboot/>.
The URL is <http://etherboot.sourceforge.net/>.
These below are common options for configure. Perhaps you may not need
to specify them.

View file

@ -63,8 +63,10 @@ EOF
# This part is OS-specific.
convert () {
# First, check if the device file exists.
if test ! -e "$1"; then
echo "$1: Not found." 1>&2
if test -b "$1"; then
:
else
echo "$1: Not found or not a block device." 1>&2
exit 1
fi
@ -116,7 +118,7 @@ convert () {
}
# Check the arguments.
for option; do
for option in "$@"; do
case "$option" in
-h | --help)
usage
@ -135,6 +137,7 @@ for option; do
debug=yes ;;
*)
if test "x$install_device" != x; then
echo "More than one install_devices?" 1>&2
usage
exit 1
fi
@ -142,6 +145,12 @@ for option; do
esac
done
if test "x$install_device" = x; then
echo "install_device not specified." 1>&2
usage
exit 1
fi
# If the debugging feature is enabled, print commands.
if test $debug = yes; then
set -x
@ -153,17 +162,23 @@ grubdir=${bootdir}/grub
device_map=${grubdir}/device.map
# Check if GRUB is installed
if test ! -f "$grub_shell"; then
if test -f "$grub_shell"; then
:
else
echo "${grub_shell}: Not found." 1>&2
exit 1
fi
if test ! -f "$pkgdatadir/stage1"; then
if test -f "$pkgdatadir/stage1"; then
:
else
echo "${pkgdatadir}/stage1: Not found." 1>&2
exit 1
fi
if test ! -f "$pkgdatadir/stage2"; then
if test -f "$pkgdatadir/stage2"; then
:
else
echo "${pkgdatadir}/stage2: Not found." 1>&2
exit 1
fi
@ -172,11 +187,13 @@ fi
# Stage 1.5 does not exist.
# Create the GRUB directory if it is not present.
test -d "$bootdir" || mkdir "$bootdir"
test -d "$grubdir" || mkdir "$grubdir"
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
if test -f "$device_map"; then
:
else
# Create a safe temporary file.
test -x /bin/tempfile && log_file=`tempfile --prefix=grub`
@ -192,25 +209,21 @@ EOF
fi
# Check for INSTALL_DEVICE.
if test "x$install_device" = x; then
case "$install_device" in
/dev/*)
install_drive=`convert "$install_device"`
# I don't know why, but some shells wouldn't die if exit is
# called in a function.
if test "x$install_drive" = x; then
exit 1
fi ;;
\([hf]d[0-9]*\))
install_drive="$install_device" ;;
*)
echo "Format of install_device not recognized." 1>&2
usage
exit 1
else
case "$install_device" in
/dev/*)
install_drive=`convert "$install_device"`
# I don't know why, but some shells wouldn't die if exit is
# called in a function.
if test "x$install_drive" = x; then
exit 1
fi ;;
\([hf]d[0-9]*\))
install_drive="$install_device" ;;
*)
usage
exit 1 ;;
esac
fi
exit 1 ;;
esac
# Get the root drive.
# For now, this uses the program `df' to get the device name, but is
@ -256,9 +269,10 @@ fi
rm -f $log_file
# 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 "fix it and re-run the script \`grub-install'."
echo
cat $device_map