add a new utility, grub-md5-crypt.

This commit is contained in:
okuji 2000-10-21 21:58:46 +00:00
parent 728e74eef6
commit 7561bde29d
16 changed files with 207 additions and 22 deletions

View file

@ -1,3 +1,18 @@
2000-10-22 OKUJI Yoshinori <okuji@gnu.org>
* util/grub-install.in (usage): Removed unnecessary commas.
* util/grub-md5-crypt.in: New file.
* util/Makefile.am (sbin_SCRIPTS): Added grub-md5-crypt.
* configure.in (AC_OUTPUT): Added util/grub-md5-crypt.
* docs/Makefile.am (man_MANS): Added grub-md5-crypt.8.
[MAINTAINER_MODE] ($(srcdir)/grub-md5-crypt.8): New target.
* docs/grub-md5-crypt.8: New file. Generated by help2man.
* docs/grub.texi (grub-md5-crypt): New direntry.
(Invoking grub-md5-crypt): New entry.
* docs/user-ref.texi (Invoking grub-md5-crypt): New chapter.
2000-10-22 OKUJI Yoshinori <okuji@gnu.org>
From Matthias Granberry <matthias@slurpee.org>:

2
NEWS
View file

@ -12,6 +12,8 @@ New in 1.0 - XXXX-XX-XX:
items with their own passwords.
* New command, "displayapm".
* New command, "md5crypt".
* The new utility ``grub-md5-crypt'' is a fontend of the grub shell. It
encrypts a password in MD5 format.
New in 0.5.96 - 2000-10-04:
* New commands, "reboot" and "halt".

6
configure vendored
View file

@ -2998,7 +2998,8 @@ 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 util/grub-image util/grub-install config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
netboot/Makefile util/grub-image util/grub-install \
util/grub-md5-crypt config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@ -3125,7 +3126,8 @@ cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile util/Makefile grub/Makefile \
netboot/Makefile util/grub-image util/grub-install"}
netboot/Makefile util/grub-image util/grub-install \
util/grub-md5-crypt"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then

View file

@ -527,4 +527,5 @@ AC_SUBST(NETBOOT_DRIVERS)
dnl Output.
AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile util/Makefile grub/Makefile \
netboot/Makefile util/grub-image util/grub-install])
netboot/Makefile util/grub-image util/grub-install \
util/grub-md5-crypt])

View file

@ -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 grub-install.8
man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8
HELP2MAN = help2man
SRC2TEXI = src2texi
noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI)
@ -38,4 +38,10 @@ $(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN)
$(PERL) $(srcdir)/$(HELP2MAN) \
--name="check the format of a Multiboot kernel" \
--section=1 --output=$@ $<
$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN)
chmod 755 $<
$(PERL) $(srcdir)/$(HELP2MAN) \
--name="Encrypt a password in MD5 format" \
--section=8 --output=$@ $<
endif

View file

@ -93,7 +93,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 grub-install.8
man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8
HELP2MAN = help2man
SRC2TEXI = src2texi
noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI)
@ -469,6 +469,12 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
@MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \
@MAINTAINER_MODE_TRUE@ --section=1 --output=$@ $<
@MAINTAINER_MODE_TRUE@$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN)
@MAINTAINER_MODE_TRUE@ chmod 755 $<
@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \
@MAINTAINER_MODE_TRUE@ --name="Encrypt a password in MD5 format" \
@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $<
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -16,21 +16,21 @@ print the version information and exit
.TP
\fB\-\-root\-directory\fR=\fIDIR\fR
install GRUB images under the directory DIR
instead of the root directory.
instead of the root directory
.TP
\fB\-\-grub\-shell\fR=\fIFILE\fR
use FILE as the grub shell.
use FILE as the grub shell
.TP
\fB\-\-force\-lba\fR
force GRUB to use LBA mode even for a buggy
BIOS.
BIOS
.TP
\fB\-\-recheck\fR
probe a device map even if it already exists.
probe a device map even if it already exists
.PP
INSTALL_DEVICE can be a GRUB device name or a system device filename.
.PP
Reports bugs to <bug-grub@gnu.org>.
.SH "REPORTING BUGS"
Report bugs to <bug-grub@gnu.org>.
.SH "SEE ALSO"
The full documentation for
.B grub-install

32
docs/grub-md5-crypt.8 Normal file
View file

@ -0,0 +1,32 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH GRUB-MD5-CRYPT "8" "October 2000" "grub-md5-crypt (GNU GRUB )" FSF
.SH NAME
grub-md5-crypt \- Encrypt a password in MD5 format
.SH SYNOPSIS
.B grub-md5-crypt
[\fIOPTION\fR]
.SH DESCRIPTION
Encrypt a password in MD5 format.
.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
.TP
\fB\-\-grub\-shell\fR=\fIFILE\fR
use FILE as the grub shell
.SH "REPORTING BUGS"
Report bugs to <bug-grub@gnu.org>.
.SH "SEE ALSO"
The full documentation for
.B grub-md5-crypt
is maintained as a Texinfo manual. If the
.B info
and
.B grub-md5-crypt
programs are properly installed at your site, the command
.IP
.B info grub-md5-crypt
.PP
should give you access to the complete manual.

View file

@ -22,6 +22,8 @@
@direntry
* GRUB: (grub). The GRand Unified Bootloader
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password
in MD5 format
* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel
@end direntry
@ -113,6 +115,7 @@ Part II: The User Reference Manual
* 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 grub-md5-crypt:: How to generate a cryptic password
* Invoking mbchk:: How to use the Multiboot checker
Part III: The Programmer Reference Manual

View file

@ -1,3 +1,3 @@
@set UPDATED 14 October 2000
@set UPDATED 22 October 2000
@set EDITION 0.5.97
@set VERSION 0.5.97

View file

@ -1654,6 +1654,28 @@ grub-install --grub-shell="grub --read-only" /dev/fd0
@end table
@node Invoking grub-md5-crypt
@chapter Invoking grub-md5-crypt
The program @command{grub-md5-crypt} encrypts a password in MD5 format.
This is just a frontend of the grub shell (@pxref{Invoking the grub
shell}). Passwords encrypted by this program can be used with the
command @command{password} (@pxref{Command-line and menu commands}).
@command{grub-md5-crypt} accepts the following options:
@table @option
@item --help
Print a summary of the command line options and exit.
@item --version
Print the version information and exit.
@item --grub-shell=@var{file}
Use @var{file} as the grub shell.
@end table
@node Invoking mbchk
@chapter Invoking mbchk

View file

@ -1,3 +1,3 @@
@set UPDATED 14 October 2000
@set UPDATED 22 October 2000
@set EDITION 0.5.97
@set VERSION 0.5.97

View file

@ -1,5 +1,5 @@
bin_PROGRAMS = mbchk
sbin_SCRIPTS = grub-install
sbin_SCRIPTS = grub-install grub-md5-crypt
noinst_SCRIPTS = grub-image
# XXX: Need to search for a header file in docs, because of multiboot.h.

View file

@ -88,7 +88,7 @@ install_sh = @install_sh@
bin_PROGRAMS = mbchk
sbin_SCRIPTS = grub-install
sbin_SCRIPTS = grub-install grub-md5-crypt
noinst_SCRIPTS = grub-image
# XXX: Need to search for a header file in docs, because of multiboot.h.
@ -99,7 +99,7 @@ mbchk_LDADD = ../lib/libcommon.a
subdir = util
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = grub-image grub-install
CONFIG_CLEAN_FILES = grub-image grub-install grub-md5-crypt
PROGRAMS = $(bin_PROGRAMS)
@ -120,7 +120,8 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(mbchk_SOURCES)
depcomp = $(SHELL) $(top_srcdir)/depcomp
DEP_FILES = @AMDEP@ $(DEPDIR)/mbchk.Po
DIST_COMMON = Makefile.am Makefile.in grub-image.in grub-install.in
DIST_COMMON = Makefile.am Makefile.in grub-image.in grub-install.in \
grub-md5-crypt.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -143,6 +144,8 @@ grub-image: $(top_builddir)/config.status grub-image.in
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
grub-md5-crypt: $(top_builddir)/config.status grub-md5-crypt.in
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:

View file

@ -49,15 +49,15 @@ Install GRUB on your drive.
-h, --help print this message and exit
-v, --version print the version information and exit
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory.
--grub-shell=FILE use FILE as the grub shell.
instead of the root directory
--grub-shell=FILE use FILE as the grub shell
--force-lba force GRUB to use LBA mode even for a buggy
BIOS.
--recheck probe a device map even if it already exists.
BIOS
--recheck probe a device map even if it already exists
INSTALL_DEVICE can be a GRUB device name or a system device filename.
Reports bugs to <bug-grub@gnu.org>.
Report bugs to <bug-grub@gnu.org>.
EOF
}

93
util/grub-md5-crypt.in Normal file
View file

@ -0,0 +1,93 @@
#! /bin/sh
# Encrypt a password in MD5 format
# Copyright (C) 2000 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.
grub_shell=${sbindir}/grub
progname="grub-md5-crypt"
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
cat <<EOF
Usage: $progname [OPTION]
Encrypt a password in MD5 format.
-h, --help print this message and exit
-v, --version print the version information and exit
--grub-shell=FILE use FILE as the grub shell
Report bugs to <bug-grub@gnu.org>.
EOF
exit 0
;;
-v | --version)
echo "$progname (GNU GRUB ${VERSION})"
exit 0
;;
--grub-shell=*)
grub_shell=`echo "$option" | sed 's/--grub-shell=//'`
;;
*)
echo "$progname: unrecognized option `$option'"
echo "Usage: $progname [OPTION]"
echo "Try `$progname --help' for more information."
exit 1
;;
esac
done
# Suppress echo backs. I don't know if this is really portable. -okuji
stty -echo
# Prompt to enter a password.
echo -n "Password: "
# read only one line... I don't know any really portable command for this.
# Does anyone know? -okuji
if test "x$BASH" = x; then
# FIXME: Use Perl instead at the moment.
password=`perl -e '$line = <>; print $line;'`
else
# In BASH, use the builtin command ``read''.
read -r password
fi
# Resume echo backs.
echo
stty echo
if test "x$password" = x; then
echo "Empty password is not permitted."
exit 1
fi
# Run the grub shell.
$grub_shell --batch --device-map=/dev/null <<EOF \
| grep "^Encrypted: " | sed 's/^Encrypted: //'
md5crypt
$password
quit
EOF
# Bye.
exit 0