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> 2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac (UNIFONT_BDF): Rename to ... * configure.ac (UNIFONT_BDF): Rename to ...

View file

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