Re: [SLUG] Premier TBAD Mtg. ANNOUNCEMENT

From: Paul M Foster (paulf@quillandmouse.com)
Date: Sat Mar 04 2006 - 11:48:14 EST


Daniel Jarboe wrote:

> On 3/4/06, Robert Snyder <robertsnyder@gmail.com> wrote:
>
>>On 3/4/06, Paul M Foster <paulf@quillandmouse.com> wrote:
>>
>>>Tarballs, .debs and .rpms are "similar" only in the barest sense. And
>>>.deb files are "ar" archive files which may *contain* tarballs. RPM
>>>files use a format which can only be unpacked using several tools at
>>>once (assuming you're not using rpm itself to unpack them).
>
>
> Small nit, but at what number does something become "several"? Two?
>

Small script from an email on redhat.com:

You can extract whatever you need from any rpm package by doing

        /usr/lib/rpm/rpm2cpio.sh foo*.rpm | cpio -dim

Here's the teensy script:

========================================================================
#!/bin/sh

pkg=$1
if [ "$pkg" = "" -o ! -e "$pkg" ]; then
     echo "no package supplied" 1>&2
    exit 1
fi

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`

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`

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

dd if=$pkg ibs=$o skip=1 2>/dev/null | gunzip

Of course, this is *far* easier using RPM tools. My point was that an
RPM file isn't decodable with a single tool, unless you're using RPM's
tools. Not a judgement either way. Just a comment on package formats.

> rpm2cpio | cpio
>
> Effectively an rpm package is a lead/header, signiature, and payload.
> When it comes down to it, it's not horrendously different from other
> archive formats, so not sure where you are getting this several tools
> idea. Except maybe that there is more than one way to do it...
> Slackers might prefer, rpm2targz | tar (Slack's alien is basically an
> rpm2targz | maketgz).
>
> As for a deb "may *contain* tarballs", doesn't the deb file standard
> _require_ the ar to have the data/files packed in a tgz within the ar,
> and any control information in an additional tgz? Otherwise it's not
> a valid deb. So with deb you are also looking at two tools to get at
> the packaged files... ar | tar.
>

Agreed. A .deb file will contain two tarballs and a text file.

-- 
Paul M. Foster
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:30:28 EDT