On Sun, 19 Aug 2001, Greg wrote:
> How do you figure out how many bytes of an RPM is header?
Slackware comes with a little program called "rpmoffset" that searches
an RPM for the beginning of the gzip data, and prints the necessary
offset.
If you don't have rpmoffset, then you can make due with od:
od -c filename.rpm | less
This prints an ASCII-and-octal dump of the RPM file, which you can search
for the gzip signature with less's search command:
/037 213
As long as the gzip signature doesn't straddle a line break (most of the
time it won't), this should position the beginning of the gzip data at the
top of the screen. Take the number in the left-hand column, and add the
number of extra bytes between the left hand column and the "037" byte.
This gives you the file offset in octal.
Perl can easily convert the number to decimal:
perl -e 'print 0(number), "\n"'
where "(number)" is the number you got from od. The leading 0 in the
print command is to make sure Perl knows you're giving it an octal number.
- Neil Parker, [EMAIL PROTECTED]
P.S. The byte immediately following the "037 213" in od's output is
almost always "\b". If your first search turns up something different
after the "037 213", then you probably haven't found the true start of the
gzip data. Repeat the search by pressing "n".