[Libguestfs] febootstrap and zypper

Richard W.M. Jones rjones at redhat.com
Thu Nov 29 21:02:34 UTC 2012


On Thu, Nov 29, 2012 at 09:18:23PM +0100, Olaf Hering wrote:
> On Mon, Oct 08, Richard W.M. Jones wrote:
> 
> > On Mon, Oct 08, 2012 at 08:50:47PM +0200, Olaf Hering wrote:
> > > On Mon, Oct 08, Richard W.M. Jones wrote:
> > > 
> > > > But out of interest, how are you creating this appliance?  I thought
> > > > we'd ripped out support for old-style appliances from the rest of the
> > > > toolchain ...
> > > 
> > > I use mkinitrd to pull in all tools and run guestfsd instead of
> > > /sysroot/sbin/init. This allows me to build the package automated as
> > > unprivileged user in the buildsystem. Creating a loop file requires
> > > root, which is cumbersome in the openSuSE buildservice.
> > 
> > BTW, febootstrap (which is what we use) runs unprivileged and should
> > be able to process SuSE rpms.  However it does require yum, not
> > zypper, but that's probably easy to fix if zypper has a way to take a
> > list of package names and resolve all the dependencies without needing
> > root and without needing to install any packages.
> 
> I just looked at this.
> 
> Does febootstrap do some sort of unrpm? Does it call %pre/%post install
> scripts? 

Not sure what unrpm is, but it does unpack the RPM (using rpm2cpio).
It does *not* call %pre or %post scripts.

> zypper alone can not be used because it calls rpm, which does chroot.
> It can however download the required rpms and place them into a
> directory:
> 
> zypper \
>         --verbose \
>         --verbose \
>         --gpg-auto-import-keys \
>         --root /dev/shm/${LOGNAME} \
>         --reposd-dir /etc/zypp/repos.d \
>         --pkg-cache-dir /dev/shm/${LOGNAME}--pkg-cache-dir \
>         --non-interactive \
>         install \
>         --auto-agree-with-licenses \
>         --no-recommends \
>         --download-only \
>         kernel-default
> 
> So what do you suggest to do on a system with zypper/libzypp?

This sounds fine.  This is basically the same as what this horrible
bit of Python code does:

https://github.com/libguestfs/febootstrap/blob/master/src/febootstrap_yum_rpm.ml#L39

followed by the call to yumdownloader.

As long as the above zypper command doesn't need root, it should
all just work fine.

My suggestion is to take the current febootstrap_yum_rpm.ml file,
rename it and modify it.  The 'yum_rpm_resolve_dependencies_and_download'
function (renamed) should end up being considerably shorter.

BTW we found it was useful to be able to pass a yum configuration file
through to the yum-rpm package handler.  That's the purpose of the
yum_config global variable.  It is set in febootstrap_cmdline.ml.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list