Installing Fink to access open-source apps on an AppleTV

Filed under: AppleTV — lars @ 04:23:11 am

I was recently able to enable ssh on my new AppleTV. One of the first things I wanted to do was to be able to play with it as a unix box and set up some standard open-source software on it. It seems there are a couple of package managers for opensource software on OS-X: Fink and MacPorts. However, as a non-Mac person, it took me some time to figure out how to install these on the cut-down unix environment provided by the AppleTV, and I had better luck setting up Fink. Below are the steps I used.

Note, this does not cover the installation of dev-tools so will only allow the install of fink's binary packages (Will hopefully write that process up later).

Pre-requisites:

  • Darwin x86 8.01 ISO (I used darwinx86-801.iso)
  • Fink intel installer (I used Fink-0.8.1-Intel-Installer.dmg)
  • An ssh-enabled AppleTv
  • OS-X /usr/bin/manpath command (optional)

The process:

  1. Mount the Darwin ISO so you can access it's files (on windows, use something like DaemonTools). We're going to need some files from it later (commands that are missing on the AppleTV).

  2. Use a program like WinSCP or FileZilla to connect to your AppleTV (username/password is frontrow/frontrow). First of all, it will help to have some basic unix-commands available that are missing on the AppleTV by default, such as 'vi' (text-editor), 'curl' (downloader, like wget) and while you're at it, 'top' (system monitor - not needed by fink but very handy all the same). These can be copied from the /usr/bin directory of the Darwin ISO, and for now just drop them in the your default/home directory (should be /Users/frontrow).

  3. Create a directory called "Install_Fink" in your default/home directory on your AppleTV. Transfer the file Fink-0.8.1-Intel-Installer.dmg to this directory (You can use scp or FileZilla to do this)

  4. Connect to your AppleTV using SSH (again, as frontrow/frontrow). You should start out in the frontrow user's home directory (and you can always get back there using the command: cd ~). Then change into the Install_Fink directory:
    cd Install_Fink/
  5. Now we're going to mount the .dmg file we copied in here earlier so that we can access the files inside:
    hdiutil mount Fink-0.8.1-Intel-Installer.dmg
  6. Now we're going to copy the files out of this .dmg and into a new directory under Install_Fink (as I had trouble running the installer directly from the mounted .dmg)
    mkdir Fink-0.8.1-Intel-Installer
    cd Fink-0.8.1-Intel-Installer
    sudo cp -R /Volumes/Fink-0.8.1-Intel-Installer/ .
  7. Now we're finished with the .dmg file's contents, we can detach it from the filesystem:
    hdiutil detach /Volumes/Fink-0.8.1-Intel-Installer/
  8. Now we're ready to install Fink. We first have to remount the root file-system as writable (as this is read-only by default on the AppleTV):
    sudo mount -o remount,rw /dev/disk0s3 /
  9. Before we kick-off the fink install, let's take this opportunity to drop the extra unix commands (vi, curl and top) into the correct place to be executed. We need to set their permissions to be executable too:

    sudo cp vi /usr/bin
    sudo chmod +x /usr/bin/vi
    sudo cp curl /usr/bin
    sudo chmod +x /usr/bin/curl
    sudo cp top /usr/bin
    sudo chmod +x /usr/bin/top
  10. Now, finally, we run the installer we copied from inside the .dmg file, using a command called 'installer'

    sudo installer -dumplog -pkg Fink\ 0.8.1-Intel\ Installer.pkg -target "/"

    You should have about 20-30 lines of output, with a line near the end saying the install was successful.

  11. Now there's one last step we need to perform before Fink is ready to use. Fink requires some environment variables to be set up before it will work properly. To do this, it provides a path-setup script that adds a line (that calls an init script) to your .profile file in your home directory. Unfortunately, Fink's automatic setup script seems to rely on a bunch of OS-X commands (printenv, basename, osascript, manpath in /usr/bin, possibly more) that appear to be missing from the OS on the AppleTV. So I took a look at the instructions on setting up this path manually: http://www.finkproject.org/doc/users-guide/install.php#setup

  12. First we need to ensure that we have everything on our Apple-TV required to run Fink's init.sh script. We can do this by attempting to run it from the command-line:
    . /sw/bin/init.sh 

    If you get no errors, then things are looking good. (Note: You may get an error about the 'manpath' command being missing. This doesn't *appear* to cause major issues. I had trouble using the manpath command from Darwin, but apparently the OS-X one will work).

  13. Next, use the following commands to edit your .profile file.

    cd ~
    vi .profile

    And add this line to the file:

    . /sw/bin/init.sh

    (In vi, you use i to go into 'insert' mode (so you can type), and <esc>wq<enter> to save and exit.)

    This will ensure that the required environment variables are created whenever you login with ssh.

  14. Now we can follow Fink's setup instructions here: http://www.finkproject.org/download/index.php?phpLang=en - by running:
    fink scanpackages; fink index
    sudo apt-get update
    sudo apt-get install fink
    This will ensure that Fink and it's list of packages is up-to-date.

  15. To test that it's working ok, you might want to try installing a couple of simple packages. First, I installed links - a lynx-like text based web browser:
    fink install links
    And then I installed wget, a command for downloading files from http or ftp servers (a bit like OS-X's curl):
    fink install wget
    And all seemed to work well! I can't guarantee that every Fink package is going to install properly using the above steps, but it seems like a good start.

You might want to check out the following links to continue from here:

Using Fink: http://www.finkproject.org/doc/bundled/usage.php
Fink Usage FAQ's: http://finkproject.org/faq/usage-fink.php

In a later post, I'll hopefully manage to install Apple's DevTools so that we can try some unstable packages and also building from source.

Good luck!

Comments

  • runelind
    It seems like the newer versions of appleTV comes with a stripped down version of Perl. I can't find things like Find.pm, strict.pm and Config.pm. Working on figuring out where I can get those files other than a Tiger OS X install.

    Comment by runelind [Visitor] — 02/16/09 @ 14:54

  • lars
    Sorry, I'm not sure, haven't messed about with perl much on the AppleTV. I prefer Python: http://wiki.awkwardtv.org/wiki/Python

    Comment by lars [Member] — 02/20/09 @ 06:31

Leave a comment

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>


Options:
(Line breaks become <br />)
(Set cookies for name, email & url)




powered by  b2evolution