dnschneid/crouton — pull request #231 by mmirg (2013-06-20 21:46:43+00:00)
Title: Preliminary attempt at hacking Gentoo support into the Croagh framework

This is a still relatively incomplete and broken attempt at implementing Gentoo support into the new Croagh framework.

Issues:

This currently supports installing either Gentoo or Funtoo only from stage 3 tarballs. It does not automatically grab a bootstrap tarball. This is at least in part because I don't have ARM hardware to test on and it is unclear to me what the appropriate installation sources would be for that architecture (putting aside the question of whether anyone would actually install this on ARM at all). Furthermore, an ordinary Gentoo installation necessitates that users explicitly select an installation source so it seemed reasonable to replicate that in the crouton context.

Installation (predictably) can take a very long time depending on what targets are selected. On a Chromebook Pixel, it takes on the order of an hour to install X11 with fairly aggressive compilation options (five threads and five simultaneous packages to compensate for merge i/o lag.) Power management in Chrome OS/Chromium OS also seems to have a fairly large effect on installation time as things seem to slow to a crawl when the screen is off and things are being throttled. I haven't quite wrapped my head around power management in Chrome OS yet, would the right way to avoid this be to install something like caffeine?

I have only modified three targets for installation at this time: core, x11 and keyboard. I suspect some of the other targets are easily adaptable but others less so. Package names are unfortunately inconsistent across different distributions, hence the ugly conditionals in the targets.

X11 is only partially functional as xprintidle is not available in Gentoo's portage tree. This is also the case for other packages, like touchegg and the shimmer project themes for Xfce. I'm not sure how best to deal with these packages. I noted that the Debian/Ubuntu cases deal with it by either manually compiling packages or using a PPA. There are portage overlays that provide xprintidle and touchegg, but I'm not confident that adding an unvetted overlay is a prudent choice for a common target like X11. Another option is that crouton provides a local overlay for Gentoo at install time that contains ebuilds for packages that we wish to provide. This is annoying because it requires someone to take on the role of a multiple package manager. Finally, we could compile those things manually in an ad-hoc fashion. The downside here is that there isn't a neat way of hooking that into portage that is analogous to making your own deb file in Debian. On a somewhat related note, Gentoo presently masks keylaunch in its stable tree requiring an ugly workaround that adds an interactive step to the installation process.

Gentoo also does not auto-detect video hardware for X11. My current approach is to echo the hardware using lspci and then prompt the user to manually enter a driver name. I suspect there's probably a way to automate this.

Sudo is not the standard method of privilege escalation in Gentoo, so I've added a step to set a root password upon first installation along with creating a new user. This is not clean as it means that should users fail to set the password, there isn't a way for them to do so as a regular user. They would have to log into the chroot specifying -u root.

Profiles are not automatically selected. Gentoo and Funtoo have diverged considerably on this point so trying to handle this would probably introduce some messy logic, perhaps to little practical end. Perhaps it is best to leave this to the users to decide. Maybe we could print this out in the tips at the end?