Ext-Archive and Turduckens
Sometimes one kind of archive is stored inside another. For example, you might have a ZIP archive with three disk images and a PDF scan of the original documentation. The disk images might have a ShrinkIt archive or two on them. It's handy to be able to see all of these parts without having to extract all of the pieces.
Let's take a look at another sample:
cp2 v turducken/MultiPart.hdv
File: turducken/MultiPart.hdv Disk image (Unadorned) 1602KB multi-partition (APM) # Start block Count Name Type -- ----------- -------- ---------------- ------------------- 1 4 1600 ProDOS_Part Apple_PRODOS 2 1604 1600 HFS_Part Apple_HFS 3 1 3 Apple Apple_partition_map Partition #1 - 800KB ProDOS "Mixed.Disk", 119 blocks free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- SYS $0000 26-Mar-88 16:27 15485 16384 *PRODOS SYS $2000 18-Jun-84 00:00 10240 10752 *BASIC.SYSTEM SYS $0000 23-Dec-22 14:17 10240 10752 DOS.3.3 Embedded #1 - 140KB DOS 3.3 Vol 001, 526 sectors free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- A $0801 [No Date] 32 512 HELLO Embedded #2 - 140KB DOS 3.3 Vol 002, 526 sectors free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- A $0801 [No Date] 32 512 HELLO2 Embedded #3 - 140KB DOS 3.3 Vol 003, 526 sectors free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- A $0801 [No Date] 32 512 HELLO3 Embedded #4 - 140KB DOS 3.3 Vol 004, 526 sectors free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- A $0801 [No Date] 32 512 HELLO4 Embedded #5 - 140KB DOS 3.3 Vol 005, 526 sectors free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- A $0801 [No Date] 32 512 HELLO5 Partition #2 - 800KB HFS "New Disk", 600KB free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- DIR 20-Jan-23 12:08 0 0 Dir1 DIR 20-Jan-23 12:10 0 0 Dir1:Dir2 NON $0000 20-Jan-23 12:10 143360 143360 Dir1:Dir2:new-init.do LBR $8000 20-Jan-23 12:09 4480 4608 Dir1:Dir2:Samples.BXY CDV+ $0000 23-Dec-22 18:06 31920 32256 HardPressed.CDV NON $0000 30-Oct-22 12:16 1272 1536 SIMPLE.DOS.SDK NON $0000 24-Mar-23 15:13 5778 6144 small.woz.gz NON $0000 20-Mar-23 19:48 600 1024 Some.Files.zip Partition #3 - 2KB - unable to recognize partition contents
This is a multi-partition disk image, ostensibly from a very small hard drive. It's in Apple Partition Map (APM) format, which allows partitions to have names. You can see from the partition map shown at the very top that it has three partitions, two of which are 1600 blocks long (800KB). The third partition holds the partition map itself, and is only 3 blocks.
The default behavior of the catalog
command is to list everything
at the top level, and then descend into partitions and embedded volumes. It shows
all three partitions, and lists the contents of the ProDOS and HFS disks. The
ProDOS disk has 5 embedded DOS.MASTER volumes, which appear after the ProDOS files.
Disk images stored in archives are opened, but archives in disk images are not, which is why it doesn't show the contents of the archives stored in the HFS partition. You can control the behavior with the --depth option. For example, if you want to descend into everything possible, set the depth to maximum:
cp2 v --depth=max turducken/MultiPart.hdv
[... much output ...]
You can also restrict the depth with --depth=shallow, so that it only shows the top level. Doing this wouldn't be very useful unless we have a way to specify what the top level should be, so let's look at that.
Ext-Archive
Most commands take an ext-archive
argument, which is short for
"extended archive specifier". To see how this works, let's descend into the turducken
archive one level at a time.
cp2 v --depth=shallow turducken/MultiPart.hdv
File: turducken/MultiPart.hdv Disk image (Unadorned) 1602KB multi-partition (APM) # Start block Count Name Type -- ----------- -------- ---------------- ------------------- 1 4 1600 ProDOS_Part Apple_PRODOS 2 1604 1600 HFS_Part Apple_HFS 3 1 3 Apple Apple_partition_map
Let's look at the HFS partition. We can specify it by number (2), or for APM partitions we can use the partition name ("HFS_Part"). The value is added after the filename, separated with a colon (':'):
cp2 v --depth=shallow turducken/MultiPart.hdv:2
File: turducken/MultiPart.hdv:2 Partition - 800KB HFS "New Disk", 600KB free Type Auxtyp Modified Length Storage *Name ---- ------ --------------- -------- -------- ---------------------------------- DIR 20-Jan-23 12:08 0 0 Dir1 DIR 20-Jan-23 12:10 0 0 Dir1:Dir2 NON $0000 20-Jan-23 12:10 143360 143360 Dir1:Dir2:new-init.do LBR $8000 20-Jan-23 12:09 4480 4608 Dir1:Dir2:Samples.BXY CDV+ $0000 23-Dec-22 18:06 31920 32256 HardPressed.CDV NON $0000 30-Oct-22 12:16 1272 1536 SIMPLE.DOS.SDK NON $0000 24-Mar-23 15:13 5778 6144 small.woz.gz NON $0000 20-Mar-23 19:48 600 1024 Some.Files.zip
The file "Dir1:Dir2:Samples.BXY" is a ShrinkIt archive with a Binary ][ header. Let's see what's in there:
cp2 v --depth=shallow turducken/MultiPart.hdv:2:Dir1:Dir2:Samples.BXY
File: turducken/MultiPart.hdv:2:Dir1:Dir2:Samples.BXY Type Auxtyp Modified Format Length Size Name ---- ------ --------------- ------- -------- ---- ------------------------------ GWP+ $5445 10-Dec-14 16:21 LZW/2 1096 51% Teach Sample™ GWP+ $5445 18-Dec-14 13:58 LZW/2 1294 60% Charset.Map NON $0000 [No Date] Stored 14 100% nl-test–fi_‡_©! GWP+ $5445 12-Jan-15 12:57 LZW/2 562 28% Teach “test” / †example GWP+ $5445 14-Jan-15 12:18 LZW/2 1107 44% TEACH.SAMPLE AWP $EE7B 13-Oct-04 12:06 LZW/2 2214 65% AppleWorks Test
Note that subdirectories and archive parts are both separated by colons. (This particular archive has some files with strange names because it's used for testing filename handling.)
The commands that operate on files within archives, such as those used to add and extract, generally take an ext-archive argument. This allows you to add and extract files from nested archives easily.