** list not-installed packages
** list upgrades
-** list packages by author
-** list packages by category
-** list packages by state
+** list packages (by author/category/state)
* operations on package files:
$command_options = array(
"list-installed" => "v",
- "install" => "r",
- "uninstall" => "r",
+ "install" => "fr",
+ "uninstall" => "fr",
+ "upgrade" => "fr",
);
if (isset($command_options[$command])) {
switch ($command) {
// {{{ install
- case 'install': {
+ case 'install': case 'upgrade': {
include_once 'PEAR/Installer.php';
$pkgfile = $cmdargs[0];
$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
basename($pkgfile) . ": %s\n");
$installer->debug = $verbose;
$install_options = array();
+ if ($command == 'upgrade') {
+ $install_options['upgrade'] = true;
+ }
foreach ($cmdopts as $opt) {
- if ($opt[0] == 'r') {
- // This option is for use by rpm and other package
- // tools that can install files etc. by itself, but
- // still needs to register the package as installed in
- // PEAR's local registry.
- $install_options['register_only'] = true;
+ switch ($opt[0]) {
+ case 'r':
+ // This option is for use by rpm and other package
+ // tools that can install files etc. by itself, but
+ // still needs to register the package as installed in
+ // PEAR's local registry.
+ $install_options['register_only'] = true;
+ break;
+ case 'f':
+ $install_options['force'] = true;
+ break;
}
}
- $installer->install($pkgfile, $install_options);
- print "install ok\n";
+ if ($installer->install($pkgfile, $install_options)) {
+ print "install ok\n";
+ } else {
+ print "install failed\n";
+ }
break;
}
$installer->debug = $verbose;
$uninstall_options = array();
foreach ($cmdopts as $opt) {
- if ($opt[0] == 'r') {
- $uninstall_options['register_only'] = true;
+ switch ($opt[0]) {
+ case 'r':
+ $uninstall_options['register_only'] = true;
+ break;
+ case 'f':
+ $uninstall_options['force'] = true;
+ break;
}
}
- $installer->uninstall($pkgfile, $uninstall_options);
- print "uninstall ok\n";
+ if ($installer->uninstall($pkgfile, $uninstall_options)) {
+ print "uninstall ok\n";
+ } else {
+ print "uninstall failed\n";
+ }
break;
}
// }}}
* indent-tabs-mode: nil
* End:
*/
+
?>