[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: rpmarchive broken?



On Sat, Feb 10, 2001 at 01:37:53AM -0500, Jody McIntyre wrote:
> Has anyone used the rpmarchive tool recently?  The one in the tools directory
> of rpm-4.0-7x does not seem to work.  It extracts a small (18 to 322
> bytes in the examples I have tried) piece of data that seems to have nothing
> to do with the RPM it was extracted from.  Are there any known problems with
> this tool or should it work?
> 

I believe you want to use /usr/bin/rpm2cpio, not rpmarchive, if you're
trying to extract the payload from an rpm package.

In fact, here's a shell script version of rpm2cpio/rpmarchive:

#!/bin/sh

pkg=$1

leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "sig il: $il dl: $dl"

sigsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \% 8 \) + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "hdr il: $il dl: $dl"

hdrsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $hdrsize`

dd if=$pkg ibs=1 skip=$o | gunzip | cpio -itv


73 de Jeff

-- 
Jeff Johnson	ARS N3NPQ
jbj@jbj.org	(jbj@redhat.com)
Chapel Hill, NC





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []