From 98ca2ba846597098ac7d130ef45eece3348de3aa Mon Sep 17 00:00:00 2001 From: okuji Date: Wed, 19 Apr 2000 10:34:35 +0000 Subject: [PATCH] fix some portability problems (by pavel). --- ChangeLog | 13 ++++++++ NEWS | 5 +++ netboot/README.netboot | 2 +- util/grub-install.in | 70 +++++++++++++++++++++++++----------------- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97d6e30c3..e0837ab28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2000-04-18 Pavel Roskin + + * 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 The user doesn't have to recompile GRUB for his/her buggy BIOS diff --git a/NEWS b/NEWS index f48f0a126..9f58eaaa5 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/netboot/README.netboot b/netboot/README.netboot index 138c2728a..1be2b398d 100644 --- a/netboot/README.netboot +++ b/netboot/README.netboot @@ -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 . +The URL is . These below are common options for configure. Perhaps you may not need to specify them. diff --git a/util/grub-install.in b/util/grub-install.in index c353514ee..9c0982093 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -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