2000-12-06 02:52:37 +00:00
|
|
|
#!@prefix@/bin/php -q
|
2000-07-17 22:52:08 +00:00
|
|
|
<?php // -*- C++ -*-
|
|
|
|
|
2000-07-24 23:55:34 +00:00
|
|
|
require_once "PEAR.php";
|
|
|
|
require_once "PEAR/Installer.php";
|
2000-07-17 22:52:08 +00:00
|
|
|
|
2001-01-08 02:45:30 +00:00
|
|
|
error_reporting(7);
|
2000-07-17 22:52:08 +00:00
|
|
|
|
2001-01-08 02:45:30 +00:00
|
|
|
$stderr = fopen("php://stderr", "w");
|
|
|
|
|
|
|
|
$debug = 1;
|
|
|
|
$optind = 1;
|
|
|
|
|
|
|
|
while ($optind < $argc && $argv[$optind][0] == "-") {
|
|
|
|
switch (substr($argv[$optind], 1)) {
|
|
|
|
case "v":
|
|
|
|
$debug = (int)$argv[++$optind];
|
|
|
|
break;
|
|
|
|
case "-":
|
|
|
|
$optind++;
|
|
|
|
break 2;
|
|
|
|
default:
|
|
|
|
fputs($stderr, "Unknown option: $argv[$optind]\n");
|
|
|
|
/* fall through */
|
|
|
|
case "?":
|
|
|
|
case "h":
|
|
|
|
usage();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$optind++;
|
|
|
|
}
|
|
|
|
|
|
|
|
$pkgfile = $argv[$optind];
|
2000-07-17 22:52:08 +00:00
|
|
|
|
|
|
|
if (!$pkgfile) {
|
2001-01-08 02:45:30 +00:00
|
|
|
usage();
|
2000-07-17 22:52:08 +00:00
|
|
|
}
|
|
|
|
|
2000-07-24 23:55:34 +00:00
|
|
|
$p = new PEAR_Installer();
|
2001-01-08 02:45:30 +00:00
|
|
|
$p->debug = $debug;
|
2000-07-24 23:55:34 +00:00
|
|
|
$p->install($pkgfile);
|
|
|
|
|
2001-01-08 02:45:30 +00:00
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
global $stderr;
|
|
|
|
fputs($stderr,
|
|
|
|
"Usage: pear [-v n] [-h] <package>\n".
|
|
|
|
"Options:\n".
|
|
|
|
" -v set verbosity level to <n> (0-2, default 1)\n".
|
|
|
|
" -h display help/usage (this message)\n");
|
|
|
|
fclose($stderr);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2000-07-17 22:52:08 +00:00
|
|
|
?>
|