Part of the problem with local/db/upgrade.php on a new install, is that it happens before the site is created. So if you want to do things like ... assign local caps to roles at SITE context, for example, you can't. I wrote a patch for admin/index.php to do a local_postinst to get around this. Not sure if it should go into upstream since I think Petr is looking at rewriting this for 2.0 anyway. Maybe we can have the hook in admin/index.php anyway in 1.9.x until that happens.