Automatic plugin/theme installation and updating without access to Dashboard ...

This is really a general question.

I am managing a number of WP installations - separate installations not multisites under different users, different databases, different prefixes etc. on a Ubuntu 10.04 platfrom. Each has a different set of (mainly WPMUDEV) plugins and themes. I have full shell access (ie as root, www-data or whatever is necessary) to all trees.

Clearly if I copy a new plugin or theme into the plugins or themes directory under wp-content and correct the ownership/group access, that plugin or theme immediately becomes visible as a deactivated item.

I have two questions:

1) How to install the plugin/theme and automatically activate it. Is there a way of using the WP installation from a shell?

2) How to update the plugin/theme in a similar way?