summaryrefslogtreecommitdiff
path: root/scripts/build/binary_iso
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-04 17:28:48 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-04 21:48:03 +0100
commit3a523c3fc12ef23e720020e2bad151fc91b8b35d (patch)
treef8fe4bef17ba263d6e535260d3b345a50b8638b3 /scripts/build/binary_iso
parentd7883ec32b2bb907fce17fb759c08c5cd9851fc3 (diff)
downloadvyos-live-build-3a523c3fc12ef23e720020e2bad151fc91b8b35d.tar.gz
vyos-live-build-3a523c3fc12ef23e720020e2bad151fc91b8b35d.zip
binary_iso: properly handle multiple bootloaders
with LB_BOOTLOADER_BIOS and LB_BOOTLOADER_EFI introduced, we can simplify and correct things here. previously it was possible for more than one of each type to be added. Gbp-Dch: Short
Diffstat (limited to 'scripts/build/binary_iso')
-rwxr-xr-xscripts/build/binary_iso104
1 files changed, 54 insertions, 50 deletions
diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
index ddd70b6c9..e4c98368c 100755
--- a/scripts/build/binary_iso
+++ b/scripts/build/binary_iso
@@ -105,56 +105,60 @@ fi
# Set an explicit modification date
XORRISO_OPTIONS="${XORRISO_OPTIONS} --modification-date=$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m%d%H%m%S00)"
-BOOTLOADER_NUMBER=0
-for BOOTLOADER in ${LB_BOOTLOADERS}
-do
- BOOTLOADER_NUMBER=$(expr ${BOOTLOADER_NUMBER} + 1)
- # Handle xorriso architecture specific options
-
- # If the bootloader number is greater or equal than 2 it means
- # we are not the first bootloader and thus we need to tell
- # mkisosfs to add an additional eltorito entry
- if [ ${BOOTLOADER_NUMBER} -ge 2 ]
- then
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot "
- fi
- case "${BOOTLOADER}" in
- grub-legacy)
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/stage2_eltorito"
- XORRISO_EXCLUDE="boot/grub/stage2_eltorito"
- ;;
-
- grub-pc)
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/grub_eltorito"
- XORRISO_EXCLUDE="boot/grub/grub_eltorito"
- ;;
-
- syslinux)
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat"
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
- XORRISO_EXCLUDE="isolinux/isolinux.bin"
- ;;
-
- grub-efi)
- if [ -e binary/boot/grub/efi.img ]
- then
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -e boot/grub/efi.img -no-emul-boot"
- XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat -isohybrid-apm-hfsplus"
- else
- Echo_message "No EFI boot code to include in the ISO"
- fi
- ;;
-
- *)
- Echo_warning "Bootloader on your architecture not yet supported by live-build."
- Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)."
- sleep 5
- ;;
- esac
-
-done
+# Enable BIOS bootloader selection
+case "${LB_BOOTLOADER_BIOS}" in
+ grub-legacy)
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/stage2_eltorito"
+ XORRISO_EXCLUDE="boot/grub/stage2_eltorito"
+ ;;
+
+ grub-pc)
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/grub_eltorito"
+ XORRISO_EXCLUDE="boot/grub/grub_eltorito"
+ ;;
+
+ syslinux)
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat"
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
+ XORRISO_EXCLUDE="isolinux/isolinux.bin"
+ ;;
+
+ "")
+ ;;
+
+ *)
+ Echo_error "Unhandled BIOS bootloader selection"
+ exit 1
+ ;;
+esac
+
+# If both BIOS and EFI bootloaders are in play, we need to tell mkisosfs to add
+# an additional eltorito entry.
+if [ -n "${LB_BOOTLOADER_BIOS}" ] && [ -n "${LB_BOOTLOADER_EFI}" ]; then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot"
+fi
+
+# Enable EFI bootloader selection
+case "${LB_BOOTLOADER_EFI}" in
+ grub-efi)
+ if [ -e binary/boot/grub/efi.img ]; then
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -e boot/grub/efi.img -no-emul-boot"
+ XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat -isohybrid-apm-hfsplus"
+ else
+ Echo_message "No EFI boot code to include in the ISO"
+ fi
+ ;;
+
+ "")
+ ;;
+
+ *)
+ Echo_error "Unhandled EFI bootloader selection"
+ exit 1
+ ;;
+esac
#if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
#then