Hi,

Zhang Boyang wrote:
> I guess there is no ready tool can merge two ISOs together.

Not directly. But xorriso can load the meta-data of an ISO, manipulate
that loaded model, and write the result as new ISO with the same boot
equipment as found in the loaded ISO.
As said, that would be no problem. Only enough disk space is needed, of
course, and a Debian version >= 9 or locally built GNU xorriso >= 1.4.2.


> After a quick look on dists/,
> I think these files are in same format with theses on online mirrors, so
> referring apt's documentation might be useful.

Searching "Debian Packages.gz" brought me to
  https://wiki.debian.org/DebianRepository/Format
which gives some hope for enlightenment.
I will try to merge DVD-1 and DVD-2 but then need a way to verify that
the result is fully functional.

It looks like i have to merge these files from DVD-1:

  ./dists/bullseye/contrib/binary-amd64/Packages.gz
  ./dists/bullseye/main/binary-amd64/Packages.gz
  ./dists/bullseye/main/debian-installer/binary-amd64/Packages.gz

  ./dists/bullseye/contrib/binary-amd64/Release
  ./dists/bullseye/main/binary-amd64/Release
  ./dists/bullseye/main/debian-installer/binary-amd64/Release
  ./dists/bullseye/Release

with these from DVD-2:

  ./bullseye/contrib/binary-amd64/Packages.gz
  ./bullseye/main/binary-amd64/Packages.gz

  ./bullseye/contrib/binary-amd64/Release
  ./bullseye/main/binary-amd64/Release
  ./bullseye/main/debian-installer/binary-amd64/Release
  ./bullseye/Release

Bystanders: Do i miss something yet ?

----------------------------------------------------------------------

To demonstrate the rest of my sketch i tried this with DVD instead of DLBD
(xorriso is GNU xorriso-1.5.2, equivalent to xorriso in Debian 11):

  DLBD_1=debian-11.2.0-amd64-DVD-1.iso
  DLDB_1_MOUNT=/mnt/dlbd_1
  DLDB_2=debian-11.2.0-amd64-DVD-2.iso
  DLDB_2_MOUNT=/mnt/dlbd_2
  RESULT=ALL_IN_ONE.iso

  sudo mkdir "$DLDB_1_MOUNT" "$DLDB_2_MOUNT"
  sudo mount "$DLBD_1" "$DLDB_1_MOUNT"
  cp -a "$DLDB_1_MOUNT/dists" merged_dists
  sudo umount "$DLDB_1_MOUNT"
  chmod -R u+w merged_dists
  sudo mount "$DLBD_2" "$DLDB_2_MOUNT"

  # TODO:
  # Merge the files in merged_dists with those from "$DLDB_2_MOUNT"

  xorriso -indev "$DLBD_1" \
          -outdev "$RESULT" \
          -map "$DLDB_2_MOUNT"/pool /pool \
          -map merged_dists /dists \
          -chown_r 0 /dists -- \
          -chgrp_r 0 /dists -- \
          -chmod_r a-w /dists -- \
          -boot_image any replay \
          -blank as_needed \
          -stdio_sync off \
          -padding included \
          -compliance no_emul_toc

  sudo umount "$DLDB_2_MOUNT"

  xorriso -indev "$RESULT" -report_el_torito plain -report_system_area plain

yields the typical boot jackalope (still escapes more coyotes than any
other ISO partition layout):

  El Torito catalog  : 4301  1
  El Torito cat path : /isolinux/boot.cat
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4        5598
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00   5184        4302
  El Torito img path :   1  /isolinux/isolinux.bin
  El Torito img opts :   1  boot-info-table isohybrid-suitable
  El Torito img path :   2  /boot/grub/efi.img
  System area options: 0x00000202
  System area summary: MBR isohybrid cyl-align-off GPT APM
  ISO image size/512 : 16754652
  Partition offset   : 0
  MBR heads per cyl  : 0
  MBR secs per head  : 0
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0     16754652
  MBR partition      :   2   0x00  0xef        17208         5184
  MBR partition path :   2  /boot/grub/efi.img
  GPT                :   N  Info
  GPT disk GUID      :      657a86211710b54c8e25101781372d9f
  GPT entry array    :      12  208  overlapping
  GPT lba range      :      64  16754598  16754651
  GPT partition name :   1  490053004f00480079006200720069006400
  GPT partname local :   1  ISOHybrid
  GPT partition GUID :   1  657a86211710b54c8e24101781372d9f
  GPT type GUID      :   1  a2a0d0ebe5b9334487c068b6b72699c7
  GPT partition flags:   1  0x1000000000000001
  GPT start and size :   1  0  16754596
  GPT partition name :   2  490053004f004800790062007200690064003100
  GPT partname local :   2  ISOHybrid1
  GPT partition GUID :   2  657a86211710b54c8e27101781372d9f
  GPT type GUID      :   2  a2a0d0ebe5b9334487c068b6b72699c7
  GPT partition flags:   2  0x1000000000000001
  GPT start and size :   2  17208  5184
  GPT partition path :   2  /boot/grub/efi.img
  APM                :   N  Info
  APM block size     :      2048
  APM gap fillers    :      0
  APM partition name :   1  EFI
  APM partition type :   1  Apple_HFS
  APM start and size :   1  4302  1296
  APM partition path :   1  /boot/grub/efi.img

For details of the xorriso run, see man xorriso.
For the report format, see
  xorriso -report_el_torito help -report_system_area help | less


Have a nice day :)

Thomas

Reply via email to