Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2013 05:12:08 -0600
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        Tim Kientzle <kientzle@FreeBSD.org>, freebsd-current Current <freebsd-current@FreeBSD.org>
Subject:   Re: Cross-architecture package installs
Message-ID:  <20130210111208.GC80454@lor.one-eyed-alien.net>
In-Reply-To: <1360156822.93359.575.camel@revolution.hippie.lan>
References:  <4703DEB0-E2DC-403E-9F14-DE968CBE4921@freebsd.org> <1360156822.93359.575.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--XWOWbaMNXpFDWE00
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 06, 2013 at 06:20:22AM -0700, Ian Lepore wrote:
> On Tue, 2013-02-05 at 22:34 -0800, Tim Kientzle wrote:
> > I'm working on tools to build ARM system images.
> > Usually, these tools run on x86, which creates a problem
> > for packages.
> >=20
> > I would like to install packages onto the image as it's built.
> > So I've been experimenting with variations of
> >    pkg -c <DESTDIR> add <package files>
> >=20
> > I'm running into a few problems but I think they can all be
> > solved.  Only the first is critical; the rest are relatively
> > minor annoyances.
> >=20
> > 1) Pre-install/post-install scripts.
> >=20
> >     These obviously don't work since the DESTDIR
> >     is for a different architecture.
> >=20
> >     At least for post-install, it should be possible to
> >     record which packages still need their post-install
> >     scripts run and arrange to run them after first
> >     boot.  I'm picturing an rc.d script that invokes pkg
> >     with appropriate options to find all packages
> >     that still need their post-install run and runs them.
> >=20
> >     This won't work for pre-install, but those are rarer
> >     and we can hopefully work around them on a
> >     case-by-case basis.
> >=20
> > 2) The chroot happens before opening the package files.
> >=20
> >     It's possible to work around this by copying all of the
> >     package files into DESTDIR first, but that's both
> >     time-consuming and rather awkward.  (And quite
> >     tricky if you're installing directly onto a mounted
> >     image that has very little free space.)
> >=20
> >     It should be feasible to open the package files first
> >     and then chroot.  Then the actual installation still
> >     happens entirely inside DESTDIR.
> >=20
>=20
> If you have a directory full of the package files, you can nullfs-mount
> it within the chroot rather than copying its contents in.  Nullfs mounts
> are great for crossing chroot barriers in such situations.
>=20
> Using them does make your scripts more complex, because you need abort
> and exit handling in the scripts to undo the mounts no matter what kind
> of exit the script encounters.  If you don't, you end up leaving nullfs
> mounts that make later things fail (such as running the script again, or
> trying to clean/remove a chroot tree).

I'd rather avoid nullfs since it requires root or at least enabling user
mounts.

If one wanted to avoid opening all packages to start off, just opening
the package directory and using dirfd() and openat() to do opens later
could also work.  Without looking at the pkg code it might require
fewer changes to the existing code flow.

-- Brooks

--XWOWbaMNXpFDWE00
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iD8DBQFRF4CHXY6L6fI4GtQRAnMMAJwPIY3JHKWlKqrZARliJ68/K2l88wCfXkgO
H4A89ATPEMzAYqauLnMyUWQ=
=ggUP
-----END PGP SIGNATURE-----

--XWOWbaMNXpFDWE00--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130210111208.GC80454>