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

Re: [rhn-users] Bootstrapping RPM - how?



On Wed, May 14, 2003 at 04:00:27PM +0200, Graham Leggett wrote:
> Hi all,
> 
> While trying to upgrade glibc I have managed to trash RPM - it segfaults 
> every time you try and run rpm, so I cannot use rpm to upgrade itself.
> 
> I need a binary statically built version of RPM to try and recover my 
> system - anyone know where I can get such a thing? I tried ftp.rpm.org, 
> but all their files are distributed as, you guessed it, RPM files.
> 
> Any clues?

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


73 de Jeff

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




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