summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfunctions/bootloaders.sh80
-rwxr-xr-xfunctions/configuration.sh33
-rwxr-xr-xscripts/build/binary_grub-efi6
-rwxr-xr-xscripts/build/binary_grub-legacy6
-rwxr-xr-xscripts/build/binary_grub-pc6
-rwxr-xr-xscripts/build/binary_syslinux4
6 files changed, 43 insertions, 92 deletions
diff --git a/functions/bootloaders.sh b/functions/bootloaders.sh
deleted file mode 100755
index a6883a67f..000000000
--- a/functions/bootloaders.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-## live-build(7) - System Build Scripts
-## Copyright (C) 2016-2020 The Debian Live team
-## Copyright (C) 2016 Adrian Gibanel Lopez <adrian15sgd@gmail.com>
-##
-## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
-## This is free software, and you are welcome to redistribute it
-## under certain conditions; see COPYING for details.
-
-Is_Requested_Bootloader ()
-{
- local BOOTLOADER
- for BOOTLOADER in ${LB_BOOTLOADERS}; do
- if [ "${BOOTLOADER}" = "${1}" ]; then
- return 0
- fi
- done
- return 1
-}
-
-Is_First_Bootloader ()
-{
- if [ "${LB_FIRST_BOOTLOADER}" != "${1}" ]; then
- return 1
- fi
- return 0
-}
-
-Is_Extra_Bootloader ()
-{
- if Is_First_Bootloader "${1}"; then
- return 1
- fi
- if ! Is_Requested_Bootloader "${1}"; then
- return 1
- fi
- return 0
-}
-
-Check_Non_First_Bootloader ()
-{
- if Is_First_Bootloader "${1}"; then
- Echo_error "Bootloader: \`${1}\` is not supported as a first bootloader."
- exit 1
- fi
-}
-
-Check_Non_Extra_Bootloader ()
-{
- if Is_Extra_Bootloader "${1}"; then
- Echo_error "Bootloader: \`${1}\` is not supported as a extra bootloader."
- exit 1
- fi
-}
-
-Check_First_Bootloader_Role ()
-{
- Check_Non_Extra_Bootloader "${1}"
-
- if ! Is_First_Bootloader "${1}"; then
- exit 0
- fi
-}
-
-Check_Extra_Bootloader_Role ()
-{
- Check_Non_First_Bootloader "${1}"
-
- if ! Is_Extra_Bootloader "${1}"; then
- exit 0
- fi
-}
-
-Check_Any_Bootloader_Role ()
-{
- if ! Is_Requested_Bootloader "${1}"; then
- exit 0
- fi
-}
diff --git a/functions/configuration.sh b/functions/configuration.sh
index 6b5cfdc63..85873bdcd 100755
--- a/functions/configuration.sh
+++ b/functions/configuration.sh
@@ -576,12 +576,35 @@ Validate_config_permitted_values ()
Echo_warning "You have specified no bootloaders; I predict that you will experience some problems!"
else
local BOOTLOADER
- for BOOTLOADER in ${LB_BOOTLOADERS}; do
- if ! In_list "${BOOTLOADER}" grub-legacy grub-pc grub-efi syslinux; then
- Echo_error "The following is not a valid bootloader: '%s'" "${BOOTLOADER}"
- exit 1
- fi
+ local BOOTLOADERS_BIOS=0
+ local BOOTLOADERS_EFI=0
+ for BOOTLOADER in $LB_BOOTLOADERS; do
+ # Note, multiple instances of the same bootloader should be rejected,
+ # to avoid issues (e.g. in `binary_iso` bootloader handling).
+ case "${BOOTLOADER}" in
+ grub-legacy|grub-pc|syslinux)
+ BOOTLOADERS_BIOS=$(( $BOOTLOADERS_BIOS + 1 ))
+ ;;
+ grub-efi)
+ BOOTLOADERS_EFI=$(( $BOOTLOADERS_EFI + 1 ))
+ ;;
+ *)
+ Echo_error "The following is not a valid bootloader: '%s'" "${BOOTLOADER}"
+ exit 1
+ ;;
+ esac
done
+ if [ $BOOTLOADERS_BIOS -ge 2 ]; then
+ Echo_error "Invalid bootloader selection. Multiple BIOS instances specified."
+ exit 1
+ fi
+ if [ $BOOTLOADERS_EFI -ge 2 ]; then
+ Echo_error "Invalid bootloader selection. Multiple EFI instances specified."
+ exit 1
+ fi
+ if [ $BOOTLOADERS_BIOS -eq 0 ] && [ $BOOTLOADERS_EFI -eq 0 ]; then
+ Echo_warning "You have specified no bootloaders; I predict that you will experience some problems!"
+ fi
fi
local CACHE_STAGE
diff --git a/scripts/build/binary_grub-efi b/scripts/build/binary_grub-efi
index 6b4101e8f..2fec81d63 100755
--- a/scripts/build/binary_grub-efi
+++ b/scripts/build/binary_grub-efi
@@ -21,11 +21,13 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
-if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+if ! In_list "grub-efi" $LB_BOOTLOADERS; then
exit 0
fi
-Check_Any_Bootloader_Role "grub-efi"
+if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+ exit 0
+fi
Echo_message "Begin preparing Grub based EFI support..."
diff --git a/scripts/build/binary_grub-legacy b/scripts/build/binary_grub-legacy
index 19b80e7bb..6399b8e5f 100755
--- a/scripts/build/binary_grub-legacy
+++ b/scripts/build/binary_grub-legacy
@@ -21,11 +21,13 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
-if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+if ! In_list "grub-legacy" $LB_BOOTLOADERS; then
exit 0
fi
-Check_First_Bootloader_Role "grub-legacy"
+if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+ exit 0
+fi
Echo_message "Begin installing grub-legacy..."
diff --git a/scripts/build/binary_grub-pc b/scripts/build/binary_grub-pc
index cd385ead2..ac6fd04a1 100755
--- a/scripts/build/binary_grub-pc
+++ b/scripts/build/binary_grub-pc
@@ -21,11 +21,13 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
-if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+if ! In_list "grub-pc" $LB_BOOTLOADERS; then
exit 0
fi
-Check_Any_Bootloader_Role "grub-pc"
+if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
+ exit 0
+fi
Echo_message "Begin installing grub-pc..."
diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
index c4b985a41..2374d5c55 100755
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -21,7 +21,9 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
-Check_Any_Bootloader_Role "syslinux"
+if ! In_list "syslinux" $LB_BOOTLOADERS; then
+ exit 0
+fi
Echo_message "Begin installing syslinux..."