67 lines
3.0 KiB
Bash
67 lines
3.0 KiB
Bash
#!/bin/bash
|
|
# Merged Acronis images: one file per product.
|
|
# tree : old Acronis ISO content + new Acronis kernel sets
|
|
# BIOS : grub-pc image -> new Acronis (32-bit kernel, like their own menu)
|
|
# UEFI : ORIGINAL old Acronis EFI image -> ia32/xorboot boots old Acronis
|
|
set -e
|
|
SRC=/path/to/pf/acronis/Acronis_Boot_Disk_2024.iso
|
|
OLD=/path/to/pf/acronis/orig
|
|
OUT=/path/to/pf/acronis/merged
|
|
W=/root/merged
|
|
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/apt5.log 2>&1 || true
|
|
|
|
build_one() {
|
|
local name="$1" dir="$2" k32="$3" i32="$4" k64="$5" i64="$6"
|
|
local tree="$W/$name"
|
|
|
|
echo "=== $name"
|
|
mkdir -p "$tree" "$tree/$dir" "$W/$name.boot" "$tree/boot/grub/i386-pc"
|
|
|
|
# 1. old ISO content (this is what ia32 boots through its own loader)
|
|
xorriso -osirrox on -indev "$OLD/$name" -extract / "$tree" >/dev/null 2>&1
|
|
|
|
# 2. new kernel sets from the 2024 collection
|
|
7z e -y -o"$tree/$dir" "$SRC" \
|
|
"ACR/$dir/$k32" $(for i in $i32; do echo "ACR/$dir/$i"; done) \
|
|
"ACR/$dir/$k64" $(for i in $i64; do echo "ACR/$dir/$i"; done) >/dev/null
|
|
|
|
echo " old tree files: $(find "$tree" -type f | wc -l)"
|
|
# 3. BIOS menu -> new Acronis (same cmdline as their grub4dos menu)
|
|
cat > "$tree/boot/grub/grub.cfg" <<EOF
|
|
set timeout=0
|
|
set default=0
|
|
menuentry "Acronis" {
|
|
linux /$dir/$k32 vga=791 mbrcrcs=on force_modules=usbhid lang=ru quiet
|
|
initrd $(for i in $i32; do echo -n "/$dir/$i "; done)
|
|
}
|
|
EOF
|
|
|
|
# 4. BIOS El Torito image from grub-mkrescue
|
|
grub-mkrescue -o "$W/$name.base.iso" "$tree" >/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
|
|
|
|
# 5. ORIGINAL EFI image of the old ISO (acronis bootwiz) -> ia32 path stays intact
|
|
xorriso -osirrox on -indev "$OLD/$name" -extract_boot_images "$W/$name.boot" >/dev/null 2>&1
|
|
local efiimg
|
|
efiimg=$(ls "$W/$name.boot"/*uefi*.img 2>/dev/null | head -1)
|
|
cp -f "$efiimg" "$tree/efi_old.img"
|
|
|
|
# 6. final ISO
|
|
xorriso -as mkisofs -R -J -joliet-long -V PARAVIS_ACRONIS -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_old.img -no-emul-boot \
|
|
"$tree" >/tmp/xor_$name.log 2>&1 || { tail -8 /tmp/xor_$name.log; return 1; }
|
|
|
|
printf " -> %s: %s bytes (%s MB)\n" "$name" \
|
|
"$(stat -c %s "$OUT/$name.iso")" "$(( $(stat -c %s "$OUT/$name.iso") / 1048576 ))"
|
|
xorriso -indev "$OUT/$name.iso" -report_el_torito plain 2>&1 | grep -E 'El Torito boot img' | sed 's/^/ /'
|
|
echo -n " old loader present: "; 7z l -ba "$OUT/$name.iso" 2>/dev/null | grep -c -iE 'efi/boot/bootia32\.efi' || true
|
|
}
|
|
|
|
build_one ADD ATI2025 dat2.dat "dat3.dat dat4.dat" dat10.dat "dat11.dat dat12.dat"
|
|
build_one ABA ADDH12 dat10.dat "dat11.dat dat12.dat" dat14.dat "dat15.dat dat16.dat"
|
|
ls -l "$OUT"
|