diff --git a/ChangeLog b/ChangeLog index 61bcfc1fc..34518b011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-11-21 Carles Pina i Estany +2009-11-21 Robert Millan + + * 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 * configure.ac (UNIFONT_BDF): Rename to ... diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 5db287a38..23ac4e1e8 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -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,22 +82,40 @@ 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 - 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 \ - ${input_dir}/handler.lst ${input_dir}/parttool.lst; do - if test -f "$file"; then - cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ - fi - done +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 \ + ${input_dir}/handler.lst ${input_dir}/parttool.lst; do + if test -f "$file"; then + 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 -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 -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