3 # Encrypt a password in MD5 format
4 # Copyright (C) 2000,2002 Free Software Foundation, Inc.
6 # 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
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # Replaced by the configure script.
22 exec_prefix
=@exec_prefix@
25 # Initialize some variables.
26 grub_shell
=${sbindir}/grub
27 progname
="grub-md5-crypt"
29 # Check the arguments.
30 for option
in "$@"; do
34 Usage: $progname [OPTION]
35 Encrypt a password in MD5 format.
37 -h, --help print this message and exit
38 -v, --version print the version information and exit
39 --grub-shell=FILE use FILE as the grub shell
41 Report bugs to <bug-grub@gnu.org>.
47 echo "$progname (GNU GRUB ${VERSION})"
52 grub_shell
=`echo "$option" | sed 's/--grub-shell=//'`
56 echo "$progname: unrecognized option \`$option'"
57 echo "Usage: $progname [OPTION]"
58 echo "Try \`$progname --help' for more information."
64 # Suppress echo backs. I don't know if this is really portable. -okuji
67 # Prompt to enter a password.
73 echo -n "Retype password: "
80 if test "x$password" = x
; then
81 echo "Empty password is not permitted."
85 if test "x$password" != "x$password2"; then
86 echo "Sorry, passwords do not match."
91 $grub_shell --batch --device-map=/dev
/null
<<EOF \
92 | grep "^Encrypted: " | sed 's/^Encrypted: //'