/[grub]/grub/util/grub-install.in
ViewVC logotype

Diff of /grub/util/grub-install.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by proski, Mon Feb 11 08:10:35 2002 UTC revision 1.35 by okuji, Sat Apr 6 12:15:13 2002 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
3  # Install GRUB on your drive.  # Install GRUB on your drive.
4  #   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.  #   Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
5  #  #
6  # This file is free software; you can redistribute it and/or modify it  # This file is free software; you can redistribute it and/or modify it
7  # under the terms of the GNU General Public License as published by  # under the terms of the GNU General Public License as published by
# Line 31  pkgdatadir=${datadir}/${PACKAGE}/${host_ Line 31  pkgdatadir=${datadir}/${PACKAGE}/${host_
31    
32  grub_shell=${sbindir}/grub  grub_shell=${sbindir}/grub
33  log_file=/tmp/grub-install.log.$$  log_file=/tmp/grub-install.log.$$
34    img_file=/tmp/grub-install.img.$$
35  rootdir=  rootdir=
36  grub_prefix=/boot/grub  grub_prefix=/boot/grub
37    
# Line 41  debug=no Line 42  debug=no
42    
43  # look for secure tempfile creation wrappers on this platform  # look for secure tempfile creation wrappers on this platform
44  if test -x /bin/tempfile; then  if test -x /bin/tempfile; then
45      mkstemp="/bin/tempfile --prefix=grub"      mklog="/bin/tempfile --prefix=grub"
46        mkimg="/bin/tempfile --prefix=grub"
47  elif test -x /bin/mktemp; then  elif test -x /bin/mktemp; then
48      mkstemp="/bin/mktemp /tmp/grub-install.log.XXXXXX"      mklog="/bin/mktemp /tmp/grub-install.log.XXXXXX"
49        mkimg="/bin/mktemp /tmp/grub-install.img.XXXXXX"
50  else  else
51      mkstemp=""      mklog=""
52        mkimg=""
53  fi  fi
54    
55  # Usage: usage  # Usage: usage
# Line 306  if test -f "$device_map"; then Line 310  if test -f "$device_map"; then
310      :      :
311  else  else
312      # Create a safe temporary file.      # Create a safe temporary file.
313      test -n "$mkstemp" && log_file=`$mkstemp`      test -n "$mklog" && log_file=`$mklog`
314    
315      $grub_shell --batch --device-map=$device_map <<EOF >$log_file      $grub_shell --batch --device-map=$device_map <<EOF >$log_file
316  quit  quit
# Line 375  for file in \ Line 379  for file in \
379      cp -f $file ${grubdir} || exit 1      cp -f $file ${grubdir} || exit 1
380  done  done
381    
382    # Make sure that GRUB reads the same images as the host OS.
383    test -n "$mkimg" && img_file=`$mkimg`
384    test -n "$mklog" && log_file=`$mklog`
385    
386    for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
387        count=5
388        tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"`
389        while test $count -gt 0; do
390            $grub_shell --batch --device-map=$device_map <<EOF >$log_file
391    dump ${root_drive}${tmp} ${img_file}
392    quit
393    EOF
394            if grep "Error [0-9]*: " $log_file >/dev/null; then
395                :
396            elif cmp $file $img_file >/dev/null; then
397                break
398            fi
399            sleep 1
400            count=`expr $count - 1`    
401        done
402        if test $count -eq 0; then
403            echo "The file $file not read correctly." 1>&2
404            exit 1
405        fi
406    done
407    
408    rm -f $img_file
409    rm -f $log_file
410    
411  # Create a safe temporary file.  # Create a safe temporary file.
412  test -n "$mkstemp" && log_file=`$mkstemp`  test -n "$mklog" && log_file=`$mklog`
413    
414  # Now perform the installation.  # Now perform the installation.
415  $grub_shell --batch --device-map=$device_map <<EOF >$log_file  $grub_shell --batch --device-map=$device_map <<EOF >$log_file

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26