[CentOS] Building a C5 chroot on a C6 machine

Fri Dec 14 19:19:30 UTC 2012
Stephen Harris <lists at spuddy.org>

On Fri, Dec 14, 2012 at 07:58:17PM +0100, Nicolas Thierry-Mieg wrote:
> Stephen Harris wrote:

> > The rpm database is in the format of C6, so the C5 programs can't
> > read it!

> perhaps if you kept the rpms that were installed by yum, you could
> rpm -i --justdb *.rpm
> within your chroot.
> If necessary first remove the rpm database and rpm --initdb or some such.

Interesting idea!

  yum --setopt=keepcache=1 --disablerepo=* --enablerepo=c5* -y --installroot=$ROOT install $rpms

  # Fix up RPM database
  rm $ROOT/var/lib/rpm/*
  chroot $ROOT /bin/rpm --initdb
  chroot $ROOT /bin/rpm -i --justdb '/var/cache/yum/*/packages/*.rpm'

And y'know what?  it worked!

Very good idea.  Thanks!