Hello!

>   Nobody works on a GRUB installer, so I've written it. This version
> is completely untested. Be careful.

Oh, yes!
Just for the beginning:

        * stage2/Makefile.am: Don't include files pre_stage2 and start
        in the distribution
        * util/Makefile.am: Typo fix: sbin_SCRIPS renamed to sbin_SCRIPTS
        * util/grub-install.in: Typo fix: grub_dir -> grubdir
        "test" was missing after "if"
        Check that $grub_shell exists before doing anything dangerous

grub-install still doesn't work. I don't want what is supposed to be
passed as the argument, so I cannot fix it.
For example:

------------
# ./grub-install hd 

    GRUB  version 0.5.94  (640K lower / 4096K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the
possible
   completions of a device/filename.  ESC at any time exits. ]

grub> root /dev/hda

Error: Device string unrecognizable

grub> setup /dev/hda /dev/hdc /dev/hdd

Error: Device string unrecognizable

grub> quit
------------

Also the following checks could be useful:
1) Check that grub-install is run by root
2) Check that stage1, stage2 and *stage1_5 are installed
3) Check that "rm" and "cp" succeed.

By the way, I think that GRUB shell should classify messages in three
categories:
1) Error messages - send to stderr
2) Transcript of commands - send to stdout
3) Messages for interactive users - send to stdout unless --batch is used

That "Minimal BASH-like line editing"... makes no sence here.

Also I think that --batch should get an optional argument - file name for
the input. Redirections are good for well debugged scripts, but not for
root, whose errors may cost too much.

Pavel Roskin
--- stage2/Makefile.am  Mon Nov  8 13:41:20 1999
+++ stage2/Makefile.am  Thu Nov 18 22:25:25 1999
@@ -24,7 +24,7 @@
 nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
        minix_stage1_5
 CLEANFILES = $(nodist_pkgdata_DATA)
-noinst_DATA = pre_stage2 start
+nodist_noinst_DATA = pre_stage2 start
 noinst_PROGRAMS = pre_stage2.exec start.exec \
        e2fs_stage1_5.exec fat_stage1_5.exec \
        ffs_stage1_5.exec minix_stage1_5.exec
--- util/Makefile.am    Thu Nov 18 20:48:42 1999
+++ util/Makefile.am    Thu Nov 18 21:36:23 1999
@@ -1,5 +1,5 @@
 bin_PROGRAMS = mbchk
-sbin_SCRIPS = grub-install
+sbin_SCRIPTS = grub-install
 
 # XXX: Need to search for a header file in docs, because of multiboot.h.
 AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs
--- util/grub-install.in        Thu Nov 18 01:00:32 1999
+++ util/grub-install.in        Thu Nov 18 22:00:25 1999
@@ -32,7 +32,7 @@
 grub_shell=${sbindir}/grub
 bootdir=/boot
 grubdir=${bootdir}/grub
-device_map=${grub_dir}/device.map
+device_map=${grubdir}/device.map
 log_file=/tmp/grub-install.log.$$
 
 install_device=
@@ -73,7 +73,7 @@
        | sed 's%.*\(/dev/[a-z0-9]*\).*%\1%'`
 
     # If not found, print an error message and exit.
-    if "x$tmp_drive" = x; then
+    if test "x$tmp_drive" = x; then
        echo "$1 does not have any corresponding BIOS drive."
        exit 1
     fi
@@ -118,6 +118,13 @@
        install_device=${option} ;;
     esac
 done
+
+# Test that GRUB is installed
+if test ! -f $grub_shell; then
+    echo "$grub_shell not found"
+    exit 1
+fi
+
 
 # Create the GRUB directory if it is not present.
 if test ! -d $bootdir; then

Reply via email to