From ca0ad141b69216a298423b892e0dcfb37f347db2 Mon Sep 17 00:00:00 2001 From: okuji Date: Thu, 18 Nov 1999 06:00:32 +0000 Subject: [PATCH] add grub-install. --- ChangeLog | 10 +++ Makefile.in | 15 ++-- configure | 23 +++--- configure.in | 2 +- debian/Makefile.in | 2 +- docs/Makefile.am | 7 +- docs/Makefile.in | 21 +++-- docs/grub-install.8 | 29 +++++++ docs/grub.8 | 4 +- docs/grub.texi | 6 ++ docs/mbchk.1 | 2 +- docs/stamp-vti | 2 +- docs/user-ref.texi | 25 ++++++ docs/version.texi | 2 +- grub/Makefile.in | 2 +- lib/Makefile.in | 2 +- netboot/Makefile.in | 2 +- stage1/Makefile.in | 2 +- stage2/Makefile.in | 2 +- util/Makefile.am | 1 + util/Makefile.in | 9 +- util/grub-install.in | 190 +++++++++++++++++++++++++++++++++++++++++++ 22 files changed, 319 insertions(+), 41 deletions(-) create mode 100644 docs/grub-install.8 create mode 100644 util/grub-install.in diff --git a/ChangeLog b/ChangeLog index b1c904115..6e7b0e215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +1999-11-18 OKUJI Yoshinori + + * configure.in: Output grub-install. + * util/Makefile.am (sbin_SCRIPTS): New variable. + * util/grub-install.in: New file. + * docs/Makefile.am (man_MANS): Added grub-install.8. + [MAINTAINER_MODE] ($(srcdir)/grub-install.8): New target. + * docs/grub-install.8: New file. Generated by help2man. + * docs/user-ref.texi (Invoking grub-install): New chapter. + 1999-11-16 OKUJI Yoshinori From Pavel Roskin: diff --git a/Makefile.in b/Makefile.in index 6f1604a06..6668aff9d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -251,10 +251,12 @@ top_distdir = $(distdir) # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist - -rm -rf $(distdir) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst + chmod a-w $(distdir) dc_install_base=`cd $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ @@ -267,8 +269,9 @@ distcheck: dist && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && $(MAKE) $(AM_MAKEFLAGS) distclean \ + && rm -f $(distdir).tar.gz \ && test `find . -type f -print | wc -l` -eq 0 - -rm -rf $(distdir) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ @@ -280,16 +283,16 @@ dist: distdir ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz - -rm -rf $(distdir) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) dist-all: distdir -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz - -rm -rf $(distdir) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) distdir: $(DISTFILES) - -rm -rf $(distdir) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) mkdir $(distdir) here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(distdir) && pwd`; \ @@ -299,7 +302,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/configure b/configure index 9ab5ae1a5..7c0184524 100644 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13.1 +# Generated automatically using autoconf version 2.13.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -975,7 +975,7 @@ else fi echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - + if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= @@ -985,7 +985,7 @@ else MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE - + if test "x$enable_maintainer_mode" = xyes; then # Extract the first word of "perl", so it can be a program name with args. @@ -1005,7 +1005,7 @@ else *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_PERL="$ac_dir/$ac_word" @@ -1363,7 +1363,7 @@ else *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy=""$with_binutils:$PATH"" - for ac_dir in $ac_dummy; do + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_RANLIB="$ac_dir/$ac_word" @@ -1430,7 +1430,7 @@ echo "configure:1430: checking whether optimization for size works" >&5 if eval "test \"\${size_flag+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - + saved_CFLAGS=$CFLAGS CFLAGS="-Os -g" cat > conftest.$ac_ext <&6 @@ -1489,7 +1489,7 @@ else *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy=""$with_binutils:$PATH"" - for ac_dir in $ac_dummy; do + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_OBJCOPY="$ac_dir/$ac_word" @@ -2230,7 +2230,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then cat >> confdefs.h <&6 fi @@ -2551,7 +2551,7 @@ ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile stage1/Makefile stage2/Makefile docs/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \ - netboot/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + netboot/Makefile util/grub-install config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -2847,3 +2847,4 @@ EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 + diff --git a/configure.in b/configure.in index 4e4193147..8d630c285 100644 --- a/configure.in +++ b/configure.in @@ -293,4 +293,4 @@ AC_SUBST(NET_EXTRAFLAGS) # Output. AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \ - netboot/Makefile]) + netboot/Makefile util/grub-install]) diff --git a/debian/Makefile.in b/debian/Makefile.in index 2e5760632..2fe119ecc 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -118,7 +118,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/docs/Makefile.am b/docs/Makefile.am index 766305dd9..e3fbe4ca0 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -3,7 +3,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \ appendices.texi EXAMPLES = boot.S kernel.c multiboot.h multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 +man_MANS = grub.8 mbchk.1 grub-install.8 HELP2MAN = help2man SRC2TEXI = src2texi noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) @@ -29,6 +29,11 @@ $(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN) $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ --section=8 --output=$@ $< +$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) + chmod 755 $< + $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ + --section=8 --output=$@ $< + $(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) $(PERL) $(srcdir)/$(HELP2MAN) \ --name="check the format of a Multiboot kernel" \ diff --git a/docs/Makefile.in b/docs/Makefile.in index 6e0112bff..f22f9c521 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -88,7 +88,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \ EXAMPLES = boot.S kernel.c multiboot.h multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 +man_MANS = grub.8 mbchk.1 grub-install.8 HELP2MAN = help2man SRC2TEXI = src2texi noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) @@ -257,12 +257,12 @@ mostlyclean-aminfo: -rm -f grub.aux grub.cp grub.cps grub.dvi grub.fn grub.fns grub.pgs \ grub.ky grub.kys grub.ps grub.log grub.pg grub.toc grub.tp \ grub.tps grub.vr grub.vrs grub.op grub.tr grub.cv grub.cn \ - multiboot.aux multiboot.cp multiboot.cps multiboot.dvi \ - multiboot.fn multiboot.fns multiboot.pgs multiboot.ky \ - multiboot.kys multiboot.ps multiboot.log multiboot.pg \ - multiboot.toc multiboot.tp multiboot.tps multiboot.vr \ - multiboot.vrs multiboot.op multiboot.tr multiboot.cv \ - multiboot.cn + grub.cm grub.ov multiboot.aux multiboot.cp multiboot.cps \ + multiboot.dvi multiboot.fn multiboot.fns multiboot.pgs \ + multiboot.ky multiboot.kys multiboot.ps multiboot.log \ + multiboot.pg multiboot.toc multiboot.tp multiboot.tps \ + multiboot.vr multiboot.vrs multiboot.op multiboot.tr \ + multiboot.cv multiboot.cn multiboot.cm multiboot.ov clean-aminfo: @@ -366,7 +366,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -459,6 +459,11 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ @MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< +@MAINTAINER_MODE_TRUE@$(srcdir)/grub-install.8: ../util/grub-install $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ chmod 755 $< +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) --name="install GRUB on your drive" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< + @MAINTAINER_MODE_TRUE@$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ @MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \ diff --git a/docs/grub-install.8 b/docs/grub-install.8 new file mode 100644 index 000000000..52a8b08b0 --- /dev/null +++ b/docs/grub-install.8 @@ -0,0 +1,29 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.016. +.TH GRUB-INSTALL "8" "November 1999" "grub-install (GNU GRUB 0.5.94)" FSF +.SH NAME +grub-install \- install GRUB on your drive +.SH SYNOPSIS +.B grub-install +[\fIOPTION\fR] \fIinstall_device\fR +.SH DESCRIPTION +Install GRUB on your drive. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version information and exit +.PP +Reports bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub-install +is maintained as a Texinfo manual. If the +.B info +and +.B grub-install +programs are properly installed at your site, the command +.IP +.B info grub-install +.PP +should give you access to the complete manual. diff --git a/docs/grub.8 b/docs/grub.8 index 192182d5f..7cc86459f 100644 --- a/docs/grub.8 +++ b/docs/grub.8 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.016. -.TH GRUB "8" "October 1999" "GNU GRUB 0.5.94" FSF +.TH GRUB "8" "November 1999" "GNU GRUB 0.5.94" FSF .SH NAME GRUB \- the grub shell .SH SYNOPSIS @@ -18,7 +18,7 @@ specify stage2 boot_drive [default=0x0] specify stage2 config_file [default=/boot/grub/menu.lst] .TP \fB\-\-device\-map\fR=\fIFILE\fR -specify the device map file [default=/boot/grub/device.map] +Use the device map file FILE .TP \fB\-\-help\fR display this message and exit diff --git a/docs/grub.texi b/docs/grub.texi index 65d1e3c29..b3765342e 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -19,6 +19,11 @@ * GRUB: (grub). The GRand Unified Bootloader @end direntry +@dircategory Kernel +@direntry +* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +@end direntry + @dircategory Kernel @direntry * mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel @@ -105,6 +110,7 @@ Part II: The User Reference Manual * Command:: The list of available builtin commands * Troubleshooting:: Error messages produced by GRUB * Invoking the grub shell:: How to use the grub shell +* Invoking grub-install:: How to use the GRUB installer * Invoking mbchk:: How to use the Multiboot checker Part III: The Programmer Reference Manual diff --git a/docs/mbchk.1 b/docs/mbchk.1 index ef9cd1e55..e8d984a87 100644 --- a/docs/mbchk.1 +++ b/docs/mbchk.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.016. -.TH MBCHK "1" "October 1999" "GNU GRUB 0.5.94" FSF +.TH MBCHK "1" "November 1999" "mbchk (GNU GRUB 0.5.94)" FSF .SH NAME mbchk \- check the format of a Multiboot kernel .SH SYNOPSIS diff --git a/docs/stamp-vti b/docs/stamp-vti index 696f15d68..aab7e08e1 100644 --- a/docs/stamp-vti +++ b/docs/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 26 October 1999 +@set UPDATED 18 November 1999 @set EDITION 0.5.94 @set VERSION 0.5.94 diff --git a/docs/user-ref.texi b/docs/user-ref.texi index 07a9fece8..50f55bc56 100644 --- a/docs/user-ref.texi +++ b/docs/user-ref.texi @@ -1343,6 +1343,31 @@ comments in the file if needed, as the grub shell assumes that a line is just a comment if the first character is @samp{#}. +@node Invoking grub-install +@chapter Invoking grub-install + +The program @command{grub-install} installs GRUB on your drive by the +grub shell (@pxref{Invoking the grub shell}). You must specify the +device name on which you want to install GRUB, like this: + +@example +grub-install @var{install_device} +@end example + +The device name @var{install_device} is an OS device name or a GRUB +device name. + +@command{grub-install} accepts the following options: + +@table @option +@item --help +Print a summary of the command line options and exit. + +@item --version +Print the version number of GRUB and exit. +@end table + + @node Invoking mbchk @chapter Invoking mbchk diff --git a/docs/version.texi b/docs/version.texi index 696f15d68..aab7e08e1 100644 --- a/docs/version.texi +++ b/docs/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 26 October 1999 +@set UPDATED 18 November 1999 @set EDITION 0.5.94 @set VERSION 0.5.94 diff --git a/grub/Makefile.in b/grub/Makefile.in index 46d6a4303..d23fd4a2d 100644 --- a/grub/Makefile.in +++ b/grub/Makefile.in @@ -221,7 +221,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/lib/Makefile.in b/lib/Makefile.in index a373cba35..5a33cdb62 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -197,7 +197,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/netboot/Makefile.in b/netboot/Makefile.in index 239693069..737711df2 100644 --- a/netboot/Makefile.in +++ b/netboot/Makefile.in @@ -241,7 +241,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/stage1/Makefile.in b/stage1/Makefile.in index 354a585ad..fe6f478c0 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -221,7 +221,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/stage2/Makefile.in b/stage2/Makefile.in index fbd5354ee..b55f5380d 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -477,7 +477,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/util/Makefile.am b/util/Makefile.am index 5d8c83868..21e9a9d56 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -1,4 +1,5 @@ bin_PROGRAMS = mbchk +sbin_SCRIPS = 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 diff --git a/util/Makefile.in b/util/Makefile.in index 7d2f26e5c..3f4051980 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -83,6 +83,7 @@ install_sh = @install_sh@ bin_PROGRAMS = mbchk +sbin_SCRIPS = 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 @@ -92,7 +93,7 @@ mbchk_LDADD = ../lib/libcommon.a subdir = util mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = grub-install PROGRAMS = $(bin_PROGRAMS) @@ -109,7 +110,7 @@ CFLAGS = @CFLAGS@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(mbchk_SOURCES) -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = Makefile.am Makefile.in grub-install.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -129,6 +130,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +grub-install: $(top_builddir)/config.status grub-install.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-binPROGRAMS: @@ -218,7 +221,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir); \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/util/grub-install.in b/util/grub-install.in new file mode 100644 index 000000000..34c7db123 --- /dev/null +++ b/util/grub-install.in @@ -0,0 +1,190 @@ +#! /bin/sh + +# Install GRUB on your drive. +# Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Initialize some variables. +prefix=@prefix@ +exec_prefix=@exec_prefix@ +sbindir=@sbindir@ +datadir=@datadir@ +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +host_cpu=@host_cpu@ +host_os=@host_os@ +host_vendor=@host_vendor@ +pkgdatadir=${datadir}/${PACKAGE}/${host_cpu}-${host_vendor} + +grub_shell=${sbindir}/grub +bootdir=/boot +grubdir=${bootdir}/grub +device_map=${grub_dir}/device.map +log_file=/tmp/grub-install.log.$$ + +install_device= + +# Usage: usage +# Print the usage. +usage () { + cat <. +EOF +} + +# Usage: convert os_device +# Convert an OS device to the corresponding GRUB drive. +# This part is OS-specific. +convert () { + # Break the device name into the disk part and the partition part. + case $host_os in + linux*) + tmp_disk=`echo $1 | sed 's%[0-9]*$%%'` + tmp_part=`echo $1 | sed "s%$tmp_disk%%"` ;; + gnu*) + tmp_disk=`echo $1 | sed 's%s[0-9]*[a-g]?%%'` + tmp_part=`echo $1 | sed "s%$tmp_disk%%"` ;; + *) + echo "grub-install does not support your OS yet." + exit 1 ;; + esac + + # Get the drive name. + tmp_drive=`grep -v '^#' $device_map | grep $tmp_disk \ + | sed 's%.*\(/dev/[a-z0-9]*\).*%\1%'` + + # If not found, print an error message and exit. + if "x$tmp_drive" = x; then + echo "$1 does not have any corresponding BIOS drive." + exit 1 + fi + + if test "x$tmp_part" != x; then + # If a partition is specified, we need to translate it into the + # GRUB's syntax. + case $host_os in + linux*) + echo $tmp_drive | sed "s%)$%,`expr $tmp_part - 1`)%" ;; + gnu*) + tmp_pc_slice=`echo $tmp_part | sed "s%s\([0-9]*\)[a-g]?%\1%"` + tmp_bsd_partition=`echo $tmp | sed "s%s[0-9]*\([a-g]?\)%\1%"` + tmp_drive=`echo $tmp_drive \ + | sed "s%)%,\`expr $tmp_pc_slice - 1\`)%"` + if test "x$tmp_bsd_partition" != x; then + tmp_drive=`echo $tmp_drive \ + | sed "s%)%,\`sed y%abcdefg%0123456%\`)%"` + fi + echo $tmp_drive ;; + esac + else + # If no partition is specified, just print the drive name. + echo $tmp_drive + fi +} + +# Check the arguments. +for option; do + case "$option" in + -h | --help) + usage + exit 0 ;; + -v | --version) + echo "grub-install (GNU GRUB ${VERSION})" + exit 0 ;; + *) + if test "x$install_device" != x; then + usage + exit 1 + fi + install_device=${option} ;; + esac +done + +# Create the GRUB directory if it is not present. +if test ! -d $bootdir; then + mkdir $bootdir +fi + +if test ! -d $grubdir; then + mkdir $grubdir +fi + +# Create the device map file if it is not present. +if test ! -f $device_map; then + $grub_shell --batch --device-map=$device_map <$log_file +quit +EOF + if grep "Error: " $log_file >/dev/null; then + cat $log_file + exit 1 + fi + + rm -f $log_file +fi + +# Copy the GRUB images to the GRUB directory. +rm -f ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5 +cp ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5 ${grubdir} + +# Check for INSTALL_DEVICE. +if test "x$install_device" = x; then + usage + exit 1 +elif echo $install_device | sed 's%^/dev/%%' >/dev/null; then + install_drive=`convert $install_device` +elif echo $install_device | sed 's%^([hf][0-9,]*)$%%' >/dev/null; then + install_drive=$install_device +else + usage + exit 1 +fi + +# Get the root drive. +# For now, this uses the program `df' to get the device name, but is +# this really portable? +root_device=`df ${grubdir} | grep /dev/ | sed 's%.*\(/dev/[a-z0-9]*\).*%\1%'` +root_drive=`convert $root_device` + +# Now perform the installation. +$grub_shell --batch --device-map=$device_map <$log_file +root $root_drive +setup $install_drive +quit +EOF + +if grep "Error: " $log_file >/dev/null; then + cat $log_file + exit 1 +fi + +rm -f $log_file + +# Prompt the user to check if the device map is correct. +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. +exit 0