+2002-06-12 Yoshinori K. Okuji <okuji@enbug.org>
+
+ * util/grub-md5-crypt.in: Prompt to retype a password, and check
+ if the passwords matches. Suggested by Matt Perry
+ <matt@primefactor.com>.
+ Also, don't use Perl any longer, because *BSD's sh and GNU
+ support ``read -r'', and GRUB doesn't support any other
+ operating system anyway.
+
2002-06-12 Yoshinori K. Okuji <okuji@enbug.org>
The terminal handling code is rewritten radically.
Leendert Meyer <leen.meyer@home.nl>
M. Meiarashi <mes@st.rim.or.jp>
Mark Lundeberg <aa026@pgfn.bc.ca>
+Matt Perry <matt@primefactor.com>
Matt Yourst <yourst@mit.edu>
Matthias Granberry <matthias@slurpee.org>
Matthias Kretschmer <m.kretschmer@bsdger.org>
#! /bin/sh
# Encrypt a password in MD5 format
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright (C) 2000,2002 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
# Prompt to enter a password.
echo -n "Password: "
+read -r password
+echo
-# 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
+# One more time.
+echo -n "Retype password: "
+read -r password2
+echo
# Resume echo backs.
-echo
stty echo
if test "x$password" = x; then
exit 1
fi
+if test "x$password" != "x$password2"; then
+ echo "Sorry, passwords do not match."
+ exit 1
+fi
+
# Run the grub shell.
$grub_shell --batch --device-map=/dev/null <<EOF \
| grep "^Encrypted: " | sed 's/^Encrypted: //'