#!/bin/bash # Rebuild Acronis component images (self-contained: source ISO on D:). # Result: C:/PF/acronis/new/{ADD,ABA}.iso with BIOS + dual-arch EFI. set -e SRC=/path/to/pf/acronis/Acronis_Boot_Disk_2024.iso OUT=/path/to/pf/acronis/new W=/root/acrbuild rm -rf "$W"; mkdir -p "$W" "$OUT" apt-get install -y grub-pc-bin grub-efi-amd64-bin grub-efi-ia32-bin mtools xorriso >/tmp/apt3.log 2>&1 || true build_one() { local name="$1" srcdir="$2" kernel="$3" initrds="$4" local tree="$W/$name" mkdir -p "$tree/$srcdir" echo "=== $name : ACR/$srcdir" 7z e -y -o"$tree/$srcdir" "$SRC" "ACR/$srcdir/$kernel" $(for i in $initrds; do echo "ACR/$srcdir/$i"; done) >/dev/null ls -l "$tree/$srcdir" | tail -4 mkdir -p "$tree/boot/grub" cat > "$tree/boot/grub/grub.cfg" </tmp/mk_$name.log 2>&1 xorriso -osirrox on -indev "$W/$name.base.iso" \ -extract /boot/grub/i386-pc/eltorito.img "$tree/boot/grub/i386-pc/eltorito.img" >/dev/null 2>&1 # 2. our own EFI boot image with BOTH loaders cat > "$W/$name.cfg" </dev/null mmd -i "$tree/efi.img" ::/EFI ::/EFI/BOOT mcopy -i "$tree/efi.img" "$W/BOOTIA32.EFI" ::/EFI/BOOT/BOOTIA32.EFI mcopy -i "$tree/efi.img" "$W/BOOTIA32.EFI" ::/EFI/BOOT/BOOTX64.EFI # 3. final ISO: BIOS from grub-pc + our dual EFI image xorriso -as mkisofs -o "$OUT/$name.iso" \ -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -e efi.img -no-emul-boot \ "$tree" >/tmp/xor_$name.log 2>&1 printf " -> %s.iso %s bytes\n" "$name" "$(stat -c %s "$OUT/$name.iso")" xorriso -indev "$OUT/$name.iso" -report_el_torito plain 2>&1 | grep -E 'El Torito boot img' | sed 's/^/ /' rm -f /tmp/e.img xorriso -osirrox on -indev "$OUT/$name.iso" -extract /efi.img /tmp/e.img >/dev/null 2>&1 printf " efi.img: "; mdir -i /tmp/e.img ::/EFI/BOOT | grep -oE 'BOOT(IA32|X64) +EFI' | tr '\n' ' '; echo } build_one ADD ATI2025 dat10.dat "dat11.dat dat12.dat" build_one ABA ADDH12 dat14.dat "dat15.dat dat16.dat" ls -l "$OUT"