Yeah, I had a bit of trouble with this one too. Although functions.php is supposed to act like a plugin, some of the plugin actions ( like the key register_activation_hook) don't work.
One workaround I used was to check for a database variable, if it's not found (which it wouldn't be if the theme was just installed), then do all your actions, else do nothing. The code was something like:
$check = get_option('theme_name_activation_check');
if ( $check != "set" ) {
// DO INITIALISATION STUFF
// Add marker so it doesn't run in future
add_option('theme_name_activation_check', "set");
}
Then, to make sure that it all happens again should the theme be de-activated and re-activated, you can use the theme_switch action.
function delete_stuff() {
delete_option('theme_name_activation_check');
}
add_action('switch_theme', 'delete_stuff');
Not pretty, but it works. If anyone has any better suggestions, I would also really love to hear them...