2007-06-11 Robert Millan <rmh@aybabtu.com>

* util/i386/pc/grub-mkrescue.in: Add "set -e".
	Add --pkglibdir=DIR option to override pkglibdir.
	Mention --image-type=TYPE in help output.
	Fix --grub-mkimage (it was a no-op).
	Abort gracefuly when no parameter is given.
This commit is contained in:
robertmh 2007-06-11 19:22:27 +00:00
parent 7ee367e49b
commit 59d31694f2
2 changed files with 23 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2007-06-11 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/grub-mkrescue.in: Add "set -e".
Add --pkglibdir=DIR option to override pkglibdir.
Mention --image-type=TYPE in help output.
Fix --grub-mkimage (it was a no-op).
Abort gracefuly when no parameter is given.
2007-06-11 Robert Millan <rmh@aybabtu.com> 2007-06-11 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/grub-mkrescue.in: New file. * util/i386/pc/grub-mkrescue.in: New file.

View file

@ -1,4 +1,4 @@
#! /bin/sh #! /bin/sh -e
# Make GRUB rescue image # Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc. # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
@ -43,7 +43,9 @@ Make GRUB rescue image.
-h, --help print this message and exit -h, --help print this message and exit
-v, --version print the version information and exit -v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES --modules=MODULES pre-load specified modules MODULES
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage --grub-mkimage=FILE use FILE as grub-mkimage
--image-type=TYPE select floppy or cdrom (default)
grub-mkimage generates a bootable rescue image of the specified type. grub-mkimage generates a bootable rescue image of the specified type.
@ -52,6 +54,8 @@ EOF
} }
image_type=cdrom image_type=cdrom
input_dir=${pkglibdir}
grub_mkimage=grub-mkimage
# Check the arguments. # Check the arguments.
for option in "$@"; do for option in "$@"; do
@ -64,6 +68,8 @@ for option in "$@"; do
exit 0 ;; exit 0 ;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--image-type=*) --image-type=*)
@ -89,8 +95,13 @@ for option in "$@"; do
esac esac
done done
if test "x$output_image" = x; then
usage
exit 1
fi
if [ "x${modules}" = "x" ] ; then if [ "x${modules}" = "x" ] ; then
modules=`cd ${pkglibdir}/ && ls *.mod` modules=`cd ${input_dir}/ && ls *.mod`
fi fi
if [ "x${image_type}" = "xfloppy" ] ; then if [ "x${image_type}" = "xfloppy" ] ; then
@ -99,9 +110,9 @@ else
floppy_image=`mktemp` floppy_image=`mktemp`
fi fi
cp ${pkglibdir}/boot.img $floppy_image cp ${input_dir}/boot.img $floppy_image
core_img=`mktemp` core_img=`mktemp`
grub-mkimage -d ${pkglibdir}/ -o ${core_img} ${modules} ${grub_mkimage} -d ${input_dir}/ -o ${core_img} ${modules}
cat ${core_img} >> $floppy_image cat ${core_img} >> $floppy_image
rm -f ${core_img} rm -f ${core_img}