Use sane paths for intermediate EFI files
authorChristian Hofstaedtler <ch@grml.org>
Wed, 21 Dec 2011 02:24:15 +0000 (03:24 +0100)
committerChristian Hofstaedtler <ch@grml.org>
Wed, 21 Dec 2011 02:24:15 +0000 (03:24 +0100)
This way we also don't remove them from the chroot *after* building
the squashfs.

etc/grml/fai/config/scripts/GRMLBASE/45-efi
grml-live

index 0711698..673ac6b 100755 (executable)
@@ -21,11 +21,11 @@ if ! [ -r "${target}"/usr/lib/grub/x86_64-efi/moddep.lst ] ; then
   exit 0
 fi
 
-GRUB_EFI_IMAGE="${target}/tmp/grub_efi_image"
+BOOTX64="${target}/boot/bootx64.efi"
+EFI_IMG="${target}/boot/efi.img"
 TMP_CONFIG="${target}/tmp/grub_config_efi"
-EFI_IMAGE="${target}/tmp/efi_image"
 
-rm -f "$GRUB_EFI_IMAGE" "$TMP_CONFIG" "$EFI_IMAGE"
+rm -f "$BOOTX64" "$EFI_IMG" "$TMP_CONFIG"
 
 cat > "$TMP_CONFIG" <<EOF
 search --set -f /conf/bootid.txt root
@@ -37,37 +37,35 @@ else
 fi
 EOF
 
-GRUB_EFI_IMAGE="${GRUB_EFI_IMAGE##${target}}"
+BOOTX64="${BOOTX64##${target}}"
+EFI_IMG="${EFI_IMG##${target}}"
 TMP_CONFIG="${TMP_CONFIG##${target}}"
-EFI_IMAGE="${EFI_IMAGE##${target}}"
 
-$ROOTCMD grub-mkimage -O x86_64-efi -o "$GRUB_EFI_IMAGE" --prefix=/boot/grub/ --config="$TMP_CONFIG" \
+$ROOTCMD grub-mkimage -O x86_64-efi -o "$BOOTX64" --prefix=/boot/grub/ --config="$TMP_CONFIG" \
   bitmap boot btrfs cat chain cmp configfile cpio echo efi_gop       \
   efi_uga elf ext2 fat gfxmenu gfxterm gzio help iso9660 jpeg linux  \
   loopback lvm minicmd multiboot normal part_gpt part_msdos play png \
   probe raid regexp reiserfs search search_fs_file search_fs_uuid    \
   search_label squash4 terminal test video videoinfo xfs
 
-if ! [ -r "${target}/${GRUB_EFI_IMAGE}" ] ; then
+if ! [ -r "${target}/${BOOTX64}" ] ; then
   echo "Can not access grub efi image." >&2
   exit 1
 fi
 
-SIZE=$(du -sk "${target}/${GRUB_EFI_IMAGE}" | awk -F" " '{print $1'})
+SIZE=$(du -sk "${target}/${BOOTX64}" | awk -F" " '{print $1'})
 SIZE=$(((($SIZE / 32 )+2)*32))
 
-dd if=/dev/zero of="${target}/${EFI_IMAGE}" bs=1k count="$SIZE" 2>/dev/null
-$ROOTCMD mkfs.vfat -n GRML "$EFI_IMAGE" >/dev/null
-$ROOTCMD mmd -i "$EFI_IMAGE" ::EFI
-$ROOTCMD mmd -i "$EFI_IMAGE" ::EFI/BOOT
-$ROOTCMD mcopy -i "$EFI_IMAGE" "$GRUB_EFI_IMAGE" ::EFI/BOOT/bootx64.efi >/dev/null
+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
 
 rm -f "${target}/${TMP_CONFIG}"
-mv "${target}/${EFI_IMAGE}" "${target}/var/lib/grml_live_efi.img"
-mv "${target}/${GRUB_EFI_IMAGE}" "${target}/var/lib/grml_live_bootx64.efi"
 
-echo "Generated EFI image ${target}/var/lib/grml_live_efi.img"
-echo "Generated bootx64 image ${target}/var/lib/grml_live_bootx64.efi"
+echo "Generated EFI image $BOOTX64"
+echo "Generated bootx64 image $EFI_IMG"
 
 ## END OF FILE #################################################################
 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2
index 923c934..2fa42a8 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -1213,24 +1213,21 @@ else
            eindent
 
            if ! dpkg --compare-versions $(dpkg-query -W -f='${Version}\n' xorriso 2>/dev/null) gt-nl 1.1.6-1 ; then
-             log   "Disabling (U)EFI boot support since xorriso version is not recent enough."
-             ewarn "Disabling (U)EFI boot support since xorriso version is not recent enough." ; eend 0
+             log   "Disabling (U)EFI boot support because xorriso version is too old."
+             ewarn "Disabling (U)EFI boot support because xorriso version is too old." ; eend 0
            else
-             log   "xorriso with -eltorito-alt-boot present, enabling (U)EFI boot support."
-             einfo "xorriso with -eltorito-alt-boot present, enabling (U)EFI boot support." ; eend 0
-
-             if [ -r "${CHROOT_OUTPUT}/var/lib/grml_live_efi.img" ] ; then
-               einfo "Found /var/lib/grml_live_efi.img - moving to /boot/efi.img for ISO."
-               log   "Found /var/lib/grml_live_efi.img - moving to /boot/efi.img for ISO."
-               mv "${CHROOT_OUTPUT}/var/lib/grml_live_efi.img" "${BUILD_OUTPUT}/boot/efi.img"
+             if [ -r "${CHROOT_OUTPUT}/boot/efi.img" ] ; then
+               einfo "Found /boot/efi.img - using for ISO."
+               log   "Found /boot/efi.img - using for ISO."
+               cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/efi.img"
                eend $?
              fi
 
-             if [ -r "${CHROOT_OUTPUT}/var/lib/grml_live_bootx64.efi" ] ; then
-               einfo "Found /var/lib/grml_live_bootx64.efi - moving to /efi/boot/bootx64.efi for ISO"
-               log   "Found /var/lib/grml_live_bootx64.efi - moving to /efi/boot/bootx64.efi for ISO"
+             if [ -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then
+               einfo "Found /boot/bootx64.efi - using as /efi/boot/bootx64.efi for ISO."
+               log   "Found /boot/bootx64.efi - using as /efi/boot/bootx64.efi for ISO."
                mkdir -p "${BUILD_OUTPUT}/efi/boot/"
-               mv "${CHROOT_OUTPUT}/var/lib/grml_live_bootx64.efi" "${BUILD_OUTPUT}/efi/boot/bootx64.efi"
+               cp "${CHROOT_OUTPUT}/boot/bootx64.efi" "${BUILD_OUTPUT}/efi/boot/bootx64.efi"
                eend $?
              fi
 
@@ -1239,6 +1236,9 @@ else
                log   "/boot/efi.img found and amd64 architecture present, extending boot arguments."
                BOOT_ARGS="$BOOT_ARGS -boot-info-table -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
                eend $?
+             else
+               log   "Disabling (U)EFI boot support because /boot/efi.img is missing."
+               ewarn "Disabling (U)EFI boot support because /boot/efi.img is missing." ; eend 0
              fi
            fi