diff options
author | David P <megver83@parabola.nu> | 2021-12-30 01:23:53 -0300 |
---|---|---|
committer | David P <megver83@parabola.nu> | 2021-12-30 01:32:05 -0300 |
commit | a5acee9cc7bb4dfcd8be48389fa39b09f1f1415b (patch) | |
tree | b18df863eb8c3e7cfe06e4ef88c966ff178b6968 | |
parent | 44acfec7e130f896567fa0a3f1b6e6189d5bbb7d (diff) |
create a _validate_common_requirements_bootmode_uefi-x64() function
This is to avoid repeating the same code for systemd-boot and refind bootmodes.
The new function also checks if we're building an x64 system, otherwise fail,
because the x64 .efi files are only in x86_64 packages
It is, in theory, valid to skip this check as we could cross-compile x86_64
refind and systemd-boot binaries for i686 (then it would only have to fail for
armv7h), but extra work should be done. The only purpose for this would be to
boot an i686-only ISO in a UEFI machine, but we don't really need it. You can
use a dual ISO for that, or set up legacy BIOS.
Signed-off-by: David P <megver83@parabola.nu>
-rwxr-xr-x | parabolaiso/mkparabolaiso | 58 |
1 files changed, 17 insertions, 41 deletions
diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 5405492..9d0a17d 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -733,7 +733,7 @@ _validate_requirements_bootmode_bios.syslinux.eltorito() { _validate_requirements_bootmode_bios.syslinux.mbr } -_validate_requirements_bootmode_uefi-x64.systemd-boot.esp() { +_validate_common_requirements_bootmode_uefi-x64() { # Check if we are building an x64 system if [[ ! "${arch}" == "dual" ]] && [[ ! "${arch}" == "x86_64" ]]; then (( validation_error=validation_error+1 )) @@ -751,6 +751,21 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() { _msg_error "Validating '${bootmode}': mmd and/or mcopy are not available on this host. Install 'mtools'!" 0 fi + # Check for optional packages + if [[ "${arch}" == "dual" ]]; then + # shellcheck disable=SC2154 + if [[ ! " ${pkg_list_x86_64[*]} " =~ ' edk2-shell ' ]]; then + _msg_info "'edk2-shell' is not in the x86_64 package list. The ISO will not contain a bootable UEFI shell." + fi + elif [[ "${arch}" == "x86_64" ]]; then + if [[ ! " ${pkg_list[*]} " =~ ' edk2-shell ' ]]; then + _msg_info "'edk2-shell' is not in the package list. The ISO will not contain a bootable UEFI shell." + fi + fi +} + +_validate_requirements_bootmode_uefi-x64.systemd-boot.esp() { + _validate_common_requirements_bootmode_uefi-x64 # Check if systemd-boot configuration files exist if [[ ! -d "${profile}/efiboot/loader/entries" ]]; then (( validation_error=validation_error+1 )) @@ -770,38 +785,10 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() { fi done fi - - # Check for optional packages - if [[ "${arch}" == "dual" ]]; then - # shellcheck disable=SC2154 - if [[ ! " ${pkg_list_x86_64[*]} " =~ ' edk2-shell ' ]]; then - _msg_info "'edk2-shell' is not in the x86_64 package list. The ISO will not contain a bootable UEFI shell." - fi - elif [[ "${arch}" == "x86_64" ]]; then - if [[ ! " ${pkg_list[*]} " =~ ' edk2-shell ' ]]; then - _msg_info "'edk2-shell' is not in the package list. The ISO will not contain a bootable UEFI shell." - fi - fi } _validate_requirements_bootmode_uefi-x64.refind.esp() { - # Check if we are building an x64 system - if [[ ! "${arch}" == "dual" ]] && [[ ! "${arch}" == "x86_64" ]]; then - (( validation_error=validation_error+1 )) - _msg_error "Validating '${bootmode}': This bootmode is available for 'dual' and 'x86_64' architectures only!" 0 - fi - - # Check if mkfs.fat is available - if ! command -v mkfs.fat &> /dev/null; then - (( validation_error=validation_error+1 )) - _msg_error "Validating '${bootmode}': mkfs.fat is not available on this host. Install 'dosfstools'!" 0 - fi - - # Check if mmd and mcopy are available - if ! { command -v mmd &> /dev/null && command -v mcopy &> /dev/null; }; then - _msg_error "Validating '${bootmode}': mmd and/or mcopy are not available on this host. Install 'mtools'!" 0 - fi - + _validate_common_requirements_bootmode_uefi-x64 # Check if rEFInd configuration files exist if [[ ! -d "${profile}/efiboot/EFI/BOOT/entries" ]]; then (( validation_error=validation_error+1 )) @@ -821,17 +808,6 @@ _validate_requirements_bootmode_uefi-x64.refind.esp() { fi done fi - - # Check for optional packages - if [[ "${arch}" == "dual" ]]; then - if [[ ! " ${pkg_list_x86_64[*]} " =~ ' edk2-shell ' ]]; then - _msg_info "'edk2-shell' is not in the x86_64 package list. The ISO will not contain a bootable UEFI shell." - fi - elif [[ "${arch}" == "x86_64" ]]; then - if [[ ! " ${pkg_list[*]} " =~ ' edk2-shell ' ]]; then - _msg_info "'edk2-shell' is not in the package list. The ISO will not contain a bootable UEFI shell." - fi - fi } _validate_requirements_bootmode_uefi-x64.systemd-boot.eltorito() { |