2009-11-21 Carles Pina i Estany <carles@pina.cat>

2009-11-21  Robert Millan  <rmh.grub@aybabtu.com>

        * util/grub-mkrescue.in: Recognize `--override-directory' option.
        (process_input_dir): New function.  Process an arbitrary input
        directory.
        Misc adjustments to support both "override mode" and system-wide mode.
This commit is contained in:
Robert Millan 2009-11-21 13:11:38 +00:00
parent 6c09890c87
commit efda854e68
2 changed files with 51 additions and 18 deletions

View file

@ -1,3 +1,11 @@
2009-11-21 Carles Pina i Estany <carles@pina.cat>
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Recognize `--override-directory' option.
(process_input_dir): New function. Process an arbitrary input
directory.
Misc adjustments to support both "override mode" and system-wide mode.
2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac (UNIFONT_BDF): Rename to ...

View file

@ -27,10 +27,10 @@ PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
native_platform=@platform@
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
grub_mkisofs="grub-mkisofs"
# Usage: usage
# Print the usage.
@ -63,6 +63,12 @@ for option in "$@"; do
modules=`echo "$option" | sed 's/--modules=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
# Intentionally undocumented
--override-directory=*)
override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
PATH=${override_dir}:$PATH
export PATH
;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@ -76,9 +82,10 @@ done
iso9660_dir=`mktemp -d`
mkdir -p ${iso9660_dir}/boot/grub
for platform in pc coreboot ; do
input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform}
if test -e ${input_dir} ; then
process_input_dir ()
{
input_dir="$1"
platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
@ -87,11 +94,28 @@ for platform in pc coreboot ; do
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
}
if [ "${override_dir}" = "" ] ; then
if test -e "${coreboot_dir}" ; then
process_input_dir ${coreboot_dir} coreboot
fi
if test -e "${pc_dir}" ; then
process_input_dir ${pc_dir} pc
fi
else
process_input_dir ${override_dir} ${native_platform}
coreboot_dir=
pc_dir=
case "${native_platform}" in
coreboot) coreboot_dir=${override_dir} ;;
pc) pc_dir=${override_dir} ;;
esac
fi
done
# build coreboot core.img
if test -e ${coreboot_dir} ; then
if test -e "${coreboot_dir}" ; then
echo "Generates coreboot"
memdisk_img=`mktemp`
memdisk_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub
@ -115,7 +139,7 @@ EOF
memdisk tar search iso9660 configfile sh \
ata at_keyboard
rm -f ${memdisk_img}
grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
if [ "${source}" != "" ] ; then
@ -126,7 +150,8 @@ if [ "${source}" != "" ] ; then
fi
# build eltorito core.img
if test -e ${pc_dir} ; then
if test -e "${pc_dir}" ; then
echo "Generates eltorito"
core_img=`mktemp`
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
memdisk tar search iso9660 configfile sh \
@ -141,11 +166,11 @@ if test -e ${pc_dir} ; then
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
fi
# build iso image
${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir}
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r -J ${iso9660_dir}
rm -rf ${iso9660_dir}
exit 0