Gentoo install functions

It works ... it's also ugly and ever so slightly naive in places.
I considered junking it a couple of times, but it's not as bad as I initially feared so I'm throwing it up for comment.