summaryrefslogtreecommitdiff
path: root/parabolaiso
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2021-12-30 01:12:50 -0300
committerDavid P <megver83@parabola.nu>2021-12-30 01:12:50 -0300
commit44acfec7e130f896567fa0a3f1b6e6189d5bbb7d (patch)
treee0619f33bdb4eda27b1f74400b3090253dffdfa2 /parabolaiso
parent83ee7d98a0e99d3a2434375582edda3f31d017db (diff)
Throw an error if an uefi-x64 bootmode built for a non-x64 system
Also improve armv7h validations Signed-off-by: David P <megver83@parabola.nu>
Diffstat (limited to 'parabolaiso')
-rwxr-xr-xparabolaiso/mkparabolaiso37
1 files changed, 24 insertions, 13 deletions
diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso
index 349d987..5405492 100755
--- a/parabolaiso/mkparabolaiso
+++ b/parabolaiso/mkparabolaiso
@@ -362,7 +362,7 @@ _make_packages() {
eval "buildmode_pkg_list_arch=(\${buildmode_pkg_list_${arch}[@]})"
# Install the qemu-arm-static binary
- if [[ "${arch}" == "armv7h" ]] && [[ ! "$(uname -m)" == armv7? ]]; then
+ if [[ "${arch}" == "armv7h" ]] && ! setarch armv7l /bin/true 2>/dev/null; then
install -d -m 0755 -- "${pacstrap_dir}/usr/bin"
install -m 0755 -- /usr/bin/qemu-arm-static "${pacstrap_dir}/usr/bin"
fi
@@ -615,7 +615,6 @@ _make_bootmode_uefi-x64.refind.esp() {
fi
# Copy kernel and initramfs to FAT image.
- # systemd-boot can only access files from the EFI system partition it was launched from.
_make_boot_on_fat
_msg_info "Done! rEFInd set up for UEFI booting successfully."
@@ -735,6 +734,12 @@ _validate_requirements_bootmode_bios.syslinux.eltorito() {
}
_validate_requirements_bootmode_uefi-x64.systemd-boot.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 ))
@@ -772,7 +777,7 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
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
- else
+ 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
@@ -780,6 +785,12 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
}
_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 ))
@@ -816,7 +827,7 @@ _validate_requirements_bootmode_uefi-x64.refind.esp() {
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
- else
+ 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
@@ -954,19 +965,19 @@ _validate_requirements_buildmode_bootstrap() {
(( validation_error=validation_error+1 ))
_msg_error "Validating build mode '${_buildmode}': bsdtar is not available on this host. Install 'libarchive'!" 0
fi
- if [[ "${arch}" == "armv7h" ]] && [[ ! "$(uname -m)" == armv7? ]]; then
- if [[ ! -e "/usr/lib/binfmt.d/qemu-arm.conf" ]]; then
- (( validation_error=validation_error+1 ))
- _msg_error "Validating build mode '${_buildmode}': qemu-user-static-binfmt is not available on this host. Install 'qemu-user-static-binfmt'!" 0
- fi
+
+ if [[ "${arch}" == "armv7h" ]] && ! setarch armv7l /bin/true &> /dev/null; then
# Make sure that qemu-static is set up with binfmt_misc
if [[ -z $(grep -l -xF \
-e "interpreter /usr/bin/qemu-arm-static" \
- -r -- /proc/sys/fs/binfmt_misc 2>/dev/null \
- | xargs -r grep -xF 'enabled') ]]
- then
+ -r -- /proc/sys/fs/binfmt_misc 2> /dev/null \
+ | xargs -r grep -xF 'enabled') ]]; then
+ (( validation_error=validation_error+1 ))
+ _msg_error "Validating build mode '${_buildmode}': binfmt_misc entry for qemu-arm-static is not available. Install 'qemu-user-static-binfmt'!" 0
+ fi
+ if ! command -v qemu-arm-static &> /dev/null; then
(( validation_error=validation_error+1 ))
- _msg_error "Validating build mode '${_buildmode}': binfmt is not available on this host. Start the binfmt service!" 0
+ _msg_error "Validating build mode '${_buildmode}': qemu-arm-static is not available on this host. Install 'qemu-user-static'!" 0
fi
fi
}