Since the issue of installing common *NiX shell tools and their assorted runtime dependencies arises in the early stages of the AppleTV development effort, it might make a lot of sense to get an up-to-date, native DarwinPorts / MacPorts bootstrap going. That way, one can be sure to generate exactly the kinds of binaries that are needed, no SSE3-specific, PowerPC-only or oversized fat binaries.
Obviously, this rough guide should be gradually fleshed out, time permitting, but the basic steps involved include:
1. fetch the current MacPorts Release Candidate 2 source tarball using /usr/bin/curl:
2. Extract it to a suitable location with plenty of free disk space. We are going to be using the Media partiton in our example. The familiar MacPorts /opt/local filesystem hierarchy will be provided by a series of symbolic links.
$ mkdir -p /mnt/opt/local
$ sudo ln -s /mnt/opt /opt
$ cd /opt/local
$ tar xzvf MacPorts-1.4.0-rc2.tar.gz
3. If you haven't done so already, install Apple's Developer Tools for OSX, more specifically the gcc3/gcc4/as/cctools packages. The full XCode IDE isn't really needed at this point, if ever.
4. Satisfy initial MacPorts bootstrap build dependencies by verifying their existence on the AppleTV OSBoot partition. Take special care of the tcl(sh) path as explained in the ./configure --help section listed below. (This section needs more work!)
5. Bootstrap the MacPorts environment using its supplied GNU Autoconf/Automake script infrastructure
$ cd /opt/local/MacPorts-1.4.0-rc2
$ ./configure --help
$ make install