Re: Can't mount CD image of Win95 game
Hi,
i wrote:
> > To obtain the offset of the first occurence of "CD001", do
> >
> > offst=$( expr \
> > $( grep -a -o -b -m 1 CD001 cdimage.iso \
> > | sed -e 's/:/ /' \
> > | awk '{ print $1 }' ) - 32769 )
The Wanderer wrote:
> Cutting down the command line led me to discover that even with '-m 1',
> four different numbers are printed by the grep-pipeline subshell.
> (Without '-m 1', seven are printed.)
This contradicts the promises of man grep about option -m.
> Inserting '| head -n 1 ' into the pipeline, right after grep, got this
> to produce the expected first-occurrence-only information.
So the new safer proposal is:
offst=$( expr \
$( grep -a -o -b -m 1 CD001 cdimage.iso \
| head -1 \
| sed -e 's/:/ /' \
| awk '{ print $1 }' ) - 32769 )
Afterwards $offst should hold a number > 0, which may be used with mount
option -o offset=.
---
About the occurences of CD001 in debian-11.5.0-amd64-netinst.iso :
32769:CD001 ... Primary Volume Descriptor (preceeded by \001)
34817:CD001 ... El Torito Boot Record (preceeded by \000)
36865:CD001 ... Joliet Volume Descrriptor (preceeded by \002)
38913:CD001 ... Volume Descriptor Set Terminator (preceeded by \377)
3935025:CD001 ... is inside data file /boot/grub/efi.img
(which serves as EFI boot partition)
7176356:CD001 ... is inside data file /boot/grub/x86_64-efi/udf.mod
11657521:CD001 ... is inside data file /EFI/boot/grubx64.efi
(which serves as boot stage after the Secure Boot shim)
The file paths of the latter three were determined by
xorriso -indev debian-11.5.0-amd64-netinst.iso \
-find / -lba_range "$blockadr" 1 -exec report_lba --
with block_adr = floor(3935025/2048) = 1921, or 3504, or 5692.
Each of the files probably contains code which wants to identify ISO 9660.
Have a nice day :)
Thomas
Reply to: