diff options
author | Stig Bakken <ssb@php.net> | 2001-12-12 01:35:03 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2001-12-12 01:35:03 +0000 |
commit | aef2b692c1873f2fef239d1ded5d54d01fd4b1e0 (patch) | |
tree | 9b619ded3fca09cd716249e21943c8099f58dcc2 /pear/scripts | |
parent | 035cf39d344414a46c45b0d8bede7f017d7879c6 (diff) | |
download | php-git-aef2b692c1873f2fef239d1ded5d54d01fd4b1e0.tar.gz |
* implemented "upgrade"
* report install/uninstall errors
Diffstat (limited to 'pear/scripts')
-rw-r--r-- | pear/scripts/pear.in | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in index 1e12897255..3782481b0c 100644 --- a/pear/scripts/pear.in +++ b/pear/scripts/pear.in @@ -29,9 +29,7 @@ command structure: ** 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: @@ -153,8 +151,9 @@ $rest = array_slice($options[1], 2); $command_options = array( "list-installed" => "v", - "install" => "r", - "uninstall" => "r", + "install" => "fr", + "uninstall" => "fr", + "upgrade" => "fr", ); if (isset($command_options[$command])) { @@ -175,7 +174,7 @@ 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); @@ -183,17 +182,28 @@ switch ($command) { 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; } @@ -208,12 +218,20 @@ switch ($command) { $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; } // }}} @@ -396,4 +414,5 @@ function heading($text) * indent-tabs-mode: nil * End: */ + ?> |