add grub-install.

This commit is contained in:
okuji 1999-11-18 06:00:32 +00:00
parent a6d7cb06db
commit ca0ad141b6
22 changed files with 319 additions and 41 deletions

View file

@ -1,3 +1,13 @@
1999-11-18 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* 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 <okuji@kuicr.kyoto-u.ac.jp> 1999-11-16 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
From Pavel Roskin: From Pavel Roskin:

View file

@ -251,10 +251,12 @@ top_distdir = $(distdir)
# it guarantees that the distribution is self-contained by making another # it guarantees that the distribution is self-contained by making another
# tarfile. # tarfile.
distcheck: dist 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 - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build mkdir $(distdir)/=build
mkdir $(distdir)/=inst mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_install_base=`cd $(distdir)/=inst && pwd` \ dc_install_base=`cd $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \ && cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \ && ../configure --srcdir=.. --prefix=$$dc_install_base \
@ -267,8 +269,9 @@ distcheck: dist
&& test `find $$dc_install_base -type f -print | wc -l` -le 1 \ && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
&& $(MAKE) $(AM_MAKEFLAGS) dist \ && $(MAKE) $(AM_MAKEFLAGS) dist \
&& $(MAKE) $(AM_MAKEFLAGS) distclean \ && $(MAKE) $(AM_MAKEFLAGS) distclean \
&& rm -f $(distdir).tar.gz \
&& test `find . -type f -print | wc -l` -eq 0 && 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"; \ @banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \ dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \ echo "$$dashes"; \
@ -280,16 +283,16 @@ dist: distdir
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir) || chmod -R a+r $(distdir)
$(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz $(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 dist-all: distdir
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ -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 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir) || chmod -R a+r $(distdir)
$(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz $(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) distdir: $(DISTFILES)
-rm -rf $(distdir) -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
mkdir $(distdir) mkdir $(distdir)
here=`cd $(top_builddir) && pwd`; \ here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \ top_distdir=`cd $(distdir) && pwd`; \
@ -299,7 +302,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

5
configure vendored
View file

@ -2551,7 +2551,7 @@ ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile stage1/Makefile stage2/Makefile docs/Makefile \ trap 'rm -fr `echo "Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile util/Makefile grub/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 EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
@ -2668,7 +2668,7 @@ cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile stage1/Makefile stage2/Makefile docs/Makefile \ CONFIG_FILES=\${CONFIG_FILES-"Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile util/Makefile grub/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \
netboot/Makefile"} netboot/Makefile util/grub-install"}
EOF EOF
cat >> $CONFIG_STATUS <<\EOF cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@ -2847,3 +2847,4 @@ EOF
chmod +x $CONFIG_STATUS chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1

View file

@ -293,4 +293,4 @@ AC_SUBST(NET_EXTRAFLAGS)
# Output. # Output.
AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \ AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile util/Makefile grub/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \
netboot/Makefile]) netboot/Makefile util/grub-install])

2
debian/Makefile.in vendored
View file

@ -118,7 +118,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -3,7 +3,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \
appendices.texi appendices.texi
EXAMPLES = boot.S kernel.c multiboot.h EXAMPLES = boot.S kernel.c multiboot.h
multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi 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 HELP2MAN = help2man
SRC2TEXI = src2texi SRC2TEXI = src2texi
noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI)
@ -29,6 +29,11 @@ $(srcdir)/grub.8: ../grub/grub $(srcdir)/$(HELP2MAN)
$(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \ $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \
--section=8 --output=$@ $< --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) $(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN)
$(PERL) $(srcdir)/$(HELP2MAN) \ $(PERL) $(srcdir)/$(HELP2MAN) \
--name="check the format of a Multiboot kernel" \ --name="check the format of a Multiboot kernel" \

View file

@ -88,7 +88,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \
EXAMPLES = boot.S kernel.c multiboot.h EXAMPLES = boot.S kernel.c multiboot.h
multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi 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 HELP2MAN = help2man
SRC2TEXI = src2texi SRC2TEXI = src2texi
noinst_SCRIPTS = $(HELP2MAN) $(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 \ -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.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 \ grub.tps grub.vr grub.vrs grub.op grub.tr grub.cv grub.cn \
multiboot.aux multiboot.cp multiboot.cps multiboot.dvi \ grub.cm grub.ov multiboot.aux multiboot.cp multiboot.cps \
multiboot.fn multiboot.fns multiboot.pgs multiboot.ky \ multiboot.dvi multiboot.fn multiboot.fns multiboot.pgs \
multiboot.kys multiboot.ps multiboot.log multiboot.pg \ multiboot.ky multiboot.kys multiboot.ps multiboot.log \
multiboot.toc multiboot.tp multiboot.tps multiboot.vr \ multiboot.pg multiboot.toc multiboot.tp multiboot.tps \
multiboot.vrs multiboot.op multiboot.tr multiboot.cv \ multiboot.vr multiboot.vrs multiboot.op multiboot.tr \
multiboot.cn multiboot.cv multiboot.cn multiboot.cm multiboot.ov
clean-aminfo: clean-aminfo:
@ -366,7 +366,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || 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@ $(PERL) $(srcdir)/$(HELP2MAN) --name="the grub shell" \
@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< @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@$(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN)
@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ @MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \
@MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \ @MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \

29
docs/grub-install.8 Normal file
View file

@ -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 <bug-grub@gnu.org>.
.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.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.016. .\" 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 .SH NAME
GRUB \- the grub shell GRUB \- the grub shell
.SH SYNOPSIS .SH SYNOPSIS
@ -18,7 +18,7 @@ specify stage2 boot_drive [default=0x0]
specify stage2 config_file [default=/boot/grub/menu.lst] specify stage2 config_file [default=/boot/grub/menu.lst]
.TP .TP
\fB\-\-device\-map\fR=\fIFILE\fR \fB\-\-device\-map\fR=\fIFILE\fR
specify the device map file [default=/boot/grub/device.map] Use the device map file FILE
.TP .TP
\fB\-\-help\fR \fB\-\-help\fR
display this message and exit display this message and exit

View file

@ -19,6 +19,11 @@
* GRUB: (grub). The GRand Unified Bootloader * GRUB: (grub). The GRand Unified Bootloader
@end direntry @end direntry
@dircategory Kernel
@direntry
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
@end direntry
@dircategory Kernel @dircategory Kernel
@direntry @direntry
* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel * 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 * Command:: The list of available builtin commands
* Troubleshooting:: Error messages produced by GRUB * Troubleshooting:: Error messages produced by GRUB
* Invoking the grub shell:: How to use the grub shell * 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 * Invoking mbchk:: How to use the Multiboot checker
Part III: The Programmer Reference Manual Part III: The Programmer Reference Manual

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.016. .\" 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 .SH NAME
mbchk \- check the format of a Multiboot kernel mbchk \- check the format of a Multiboot kernel
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,3 +1,3 @@
@set UPDATED 26 October 1999 @set UPDATED 18 November 1999
@set EDITION 0.5.94 @set EDITION 0.5.94
@set VERSION 0.5.94 @set VERSION 0.5.94

View file

@ -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{#}. 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 @node Invoking mbchk
@chapter Invoking mbchk @chapter Invoking mbchk

View file

@ -1,3 +1,3 @@
@set UPDATED 26 October 1999 @set UPDATED 18 November 1999
@set EDITION 0.5.94 @set EDITION 0.5.94
@set VERSION 0.5.94 @set VERSION 0.5.94

View file

@ -221,7 +221,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -197,7 +197,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -241,7 +241,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -221,7 +221,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -477,7 +477,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View file

@ -1,4 +1,5 @@
bin_PROGRAMS = mbchk bin_PROGRAMS = mbchk
sbin_SCRIPS = grub-install
# XXX: Need to search for a header file in docs, because of multiboot.h. # XXX: Need to search for a header file in docs, because of multiboot.h.
AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs

View file

@ -83,6 +83,7 @@ install_sh = @install_sh@
bin_PROGRAMS = mbchk bin_PROGRAMS = mbchk
sbin_SCRIPS = grub-install
# XXX: Need to search for a header file in docs, because of multiboot.h. # XXX: Need to search for a header file in docs, because of multiboot.h.
AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs AM_CFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/docs
@ -92,7 +93,7 @@ mbchk_LDADD = ../lib/libcommon.a
subdir = util subdir = util
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES = grub-install
PROGRAMS = $(bin_PROGRAMS) PROGRAMS = $(bin_PROGRAMS)
@ -109,7 +110,7 @@ CFLAGS = @CFLAGS@
CCLD = $(CC) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(mbchk_SOURCES) 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) 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) \ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && 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: mostlyclean-binPROGRAMS:
@ -218,7 +221,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \ cp -pR $$d/$$file $(distdir); \
else \ else \
test -f $(distdir)/$$file \ test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \

190
util/grub-install.in Normal file
View file

@ -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: grub-install [OPTION] install_device
Install GRUB on your drive.
-h, --help print this message and exit
-v, --version print the version information and exit
Reports bugs to <bug-grub@gnu.org>.
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 <<EOF >$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 <<EOF >$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