X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=etc%2Fgrml%2Ffai%2Fconfig%2Fscripts%2FGRMLBASE%2F45-grub-images;h=16c0e9a195d4e44cd8abb56b8c5cb8160f8f91a7;hp=60249893eed88a6e638784e062e666fbbad80de5;hb=642e1b389347bcb8d6e44b483c327e45225427f4;hpb=06021ae3a93b2e3a21058fdbf4d69d646dd83312 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images b/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images index 6024989..16c0e9a 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images +++ b/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images @@ -1,36 +1,30 @@ #!/bin/bash -# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-efi -# Purpose: create grub image for use in ISO for EFI boot +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images +# Purpose: create grub images for use in ISO # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ set -e +set -u +TMP_CONFIG="/tmp/grub_config_efi" -BOOTX64="${target}/boot/bootx64.efi" -EFI_IMG="${target}/boot/efi.img" -TMP_CONFIG="${target}/tmp/grub_config_efi" +# this allows us to find this specific Grml ISO, +# even if there are multiple Grml ISOs present +bootfile="${GRML_NAME}_$(TZ=UTC date +%s)" +echo "$bootfile" > "${target}/"boot/grub/bootfile.txt -rm -f "$BOOTX64" "$EFI_IMG" "$TMP_CONFIG" - -cat > "$TMP_CONFIG" < "${target}/${TMP_CONFIG}" <&2 - exit 1 +if ifclass I386 ; then + if [ -r "${target}"/usr/lib/grub/i386-efi/moddep.lst ] ; then + ARCHS+=(i386-efi) + ADDITIONAL_MODULES[i386-efi]="efi_gop efi_uga" + else + echo "/usr/lib/grub/i386-efi/moddep.lst could not be found, skipping." + echo "NOTE: grub-efi-ia32 not installed?" fi - - SIZE=$(du --apparent-size -sk "${target}/${BOOTX64}" | awk -F" " '{print $1'}) - SIZE=$(((($SIZE / 32 )+2)*32)) - - dd if=/dev/zero of="${target}/${EFI_IMG}" bs=1k count="$SIZE" 2>/dev/null - $ROOTCMD mkfs.vfat -n GRML "$EFI_IMG" >/dev/null - $ROOTCMD mmd -i "$EFI_IMG" ::EFI - $ROOTCMD mmd -i "$EFI_IMG" ::EFI/BOOT - $ROOTCMD mcopy -i "$EFI_IMG" "$BOOTX64" ::EFI/BOOT/bootx64.efi >/dev/null - echo "Generated EFI image $BOOTX64" - echo "Generated bootx64 image $EFI_IMG" fi +for arch in "${ARCHS[@]}" ; do + filename='' + case "$arch" in + i386-pc) filename=/boot/grub/grub.img ;; + x86_64-efi) filename=/boot/bootx64.efi ;; + i386-efi) filename=/boot/bootia32.efi ;; + esac + + $ROOTCMD grub-mkimage -O $arch -o "$filename" --prefix=/boot/grub/ --config="$TMP_CONFIG" \ + echo iso9660 part_msdos search_fs_file test \ + fat ext2 reiserfs xfs btrfs squash4 part_gpt lvm \ + ${ADDITIONAL_MODULES[$arch]} +done + rm -f "${target}/${TMP_CONFIG}" echo "Generated Grub images" - ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2