GitHubのミラーです
https://github.com/FascodeNet/alterlinux
Revisión | 55cfb8ba021266d754eb21fb22c666f9f7a49442 (tree) |
---|---|
Tiempo | 2020-10-04 05:55:31 |
Autor | David Runge <dvzrv@arch...> |
Commiter | David Runge |
Replace bash arithmetic with awk functions
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 a ceil() function rounds the calculated
size up to the next full MiB.
Add an info message about the size of the created FAT image.
Fixes #70
@@ -544,16 +544,22 @@ _make_boot_uefi-x64.systemd-boot.esp() { | ||
544 | 544 | _msg_info "Setting up systemd-boot for UEFI booting..." |
545 | 545 | install -d -m 0755 -- "${isofs_dir}/EFI/archiso" |
546 | 546 | |
547 | - efiboot_imgsize="$(( (( (( $(du --apparent-size -bc \ | |
547 | + # the required image size in KiB (rounded up to the next full MiB with an additional MiB for reserved sectors) | |
548 | + efiboot_imgsize="$(du -bc \ | |
548 | 549 | "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" \ |
549 | 550 | "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" \ |
550 | 551 | "${profile}/efiboot/" \ |
551 | 552 | "${airootfs_dir}/boot/vmlinuz-"* \ |
552 | 553 | "${airootfs_dir}/boot/initramfs-"*".img" \ |
553 | 554 | "${airootfs_dir}/boot/"{intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio} \ |
554 | - 2>/dev/null | awk 'END {print $1}') / 1048576 )) +1 )) * 1024 ))" | |
555 | + 2>/dev/null | awk 'function ceil(x){return int(x)+(x>int(x))} | |
556 | + function byte_to_kib(x){return x/1024} | |
557 | + function mib_to_kib(x){return x*1024} | |
558 | + END {print mib_to_kib(ceil((byte_to_kib($1)+1024)/1024))}' | |
559 | + )" | |
555 | 560 | # The FAT image must be created with mkfs.fat not mformat, as some systems have issues with mformat made images: |
556 | 561 | # https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html |
562 | + _msg_info "Creating FAT image of size: ${efiboot_imgsize} KiB..." | |
557 | 563 | mkfs.fat -C -n ARCHISO_EFI "${isofs_dir}/EFI/archiso/efiboot.img" "$efiboot_imgsize" |
558 | 564 | |
559 | 565 | mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" ::/EFI ::/EFI/BOOT |