Other distros (was RE: Waxing Philosophical)

Michal Jaegermann michal at ellpspace.math.ualberta.ca
Tue Oct 5 17:39:04 UTC 2004


On Tue, Oct 05, 2004 at 10:29:17AM -0400, Allen Ziegenfus wrote:
> On the fine day of Mon, 4 Oct 2004 22:38:02 -0600
> Michal Jaegermann <michal at ellpspace.math.ualberta.ca> said very
> eloquently:
> 
> > On Mon, Oct 04, 2004 at 10:31:09PM -0400, Allen Ziegenfus wrote:
> > > 
> > > Is it possible to do a chroot install of Fedora? 
> > 
> > You mean installing on file system(s) different from ones where you
> > are starting to operate?
> 
> I guess I really meant was can you install Fedora from another existing
> Linux distribution.

Sure.  This is always possible.  As Mike will likely tell you this is a
preferred method of installing "Alpha Core" for now unless you are brave
and/or want to run into troubles and solve them. :-)

In current versions of rpm you can find /usr/lib/rpm/rpm2cpio.sh
Oh, well, here it is in a full glory. :-)  It writes cpio data
on stdout.

#!/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`
# 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=$o skip=1 2>/dev/null | gunzip

You may actually need another variant for rpm packages using bzip2
compression or you may want to make the above a bit smarter and make it
to check which decompressor to use.

Armed with anything which will run the above and cpio you can unpack
any rpm package on any file system you desire.  Fixing up your rpm
database can be done later with a help of '--justdb' option.
Of course if you are able to run rpm then you can simply call it with
'--root=...' and save yourself an extra work.

   Michal




More information about the axp-list mailing list