diff options
author | David P <megver83@parabola.nu> | 2020-10-03 18:22:23 -0300 |
---|---|---|
committer | David P <megver83@parabola.nu> | 2020-10-03 18:22:23 -0300 |
commit | dc7a7f8e2c77aee8e1404e05a30cbfd6e18d5a94 (patch) | |
tree | 47f3bd00a71ec3d53b574ab279c3f920904ff7aa | |
parent | ac1e3b9deb55fd0a297d0d2a6f0481e5a874ddb5 (diff) |
[archiso] Replace bash arithmetic with awk functionsv48.1
Copied from archiso commit 55cfb8ba0
archiso/mkarchiso:
The bash arithmethics in _make_boot_uefi-x64.systemd-boot.esp() introduced rounding issues, that can lead to
insufficient FAT image size for the files.
Conversion functions for awk now replace the bash arithmetics and additionally
size up to the next full MiB.
Add an info message about the size of the created FAT image.
Fixes #70
Signed-off-by: David P <megver83@parabola.nu>
-rwxr-xr-x | parabolaiso/mkparabolaiso | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 0eb1831..719d703 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -555,7 +555,8 @@ _make_boot_uefi-x64.systemd-boot.esp() { _msg_info "Setting up systemd-boot for UEFI booting..." install -d -m 0755 -- "${isofs_dir}/EFI/parabolaiso" - efiboot_imgsize="$(( (( (( $(du --apparent-size -bc \ + # the required image size in KiB (rounded up to the next full MiB with an additional MiB for reserved sectors) + efiboot_imgsize="$(du -bc \ "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" \ "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" \ "${profile}/efiboot/" \ @@ -564,6 +565,7 @@ _make_boot_uefi-x64.systemd-boot.esp() { 2>/dev/null | awk 'END {print $1}') / 1048576 )) +1 )) * 1024 ))" # The FAT image must be created with mkfs.fat not mformat, as some systems have issues with mformat made images: # https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html + _msg_info "Creating FAT image of size: ${efiboot_imgsize} KiB..." mkfs.fat -C -n PARABOLAISO_EFI "${isofs_dir}/EFI/parabolaiso/efiboot.img" "$efiboot_imgsize" mmd -i "${isofs_dir}/EFI/parabolaiso/efiboot.img" ::/EFI ::/EFI/BOOT @@ -596,7 +598,8 @@ _make_boot_uefi-x64.refind.esp() { _msg_info "Setting up rEFInd for UEFI booting..." install -d -m 0755 -- "${isofs_dir}/EFI/parabolaiso" - efiboot_imgsize="$(( (( (( $(du --apparent-size -bc \ + # the required image size in KiB (rounded up to the next full MiB with an additional MiB for reserved sectors) + efiboot_imgsize="$(du -bc \ "${airootfs_dir}/usr/share/refind/refind_x64.efi" \ "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" \ "${profile}/efiboot/" \ @@ -605,6 +608,7 @@ _make_boot_uefi-x64.refind.esp() { 2>/dev/null | awk 'END {print $1}') / 1048576 )) +1 )) * 1024 ))" # The FAT image must be created with mkfs.fat not mformat, as some systems have issues with mformat made images: # https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html + _msg_info "Creating FAT image of size: ${efiboot_imgsize} KiB..." mkfs.fat -C -n PARABOLAISO_EFI "${isofs_dir}/EFI/parabolaiso/efiboot.img" "$efiboot_imgsize" mmd -i "${isofs_dir}/EFI/parabolaiso/efiboot.img" ::/EFI ::/EFI/BOOT |