summaryrefslogtreecommitdiff
path: root/pear/scripts/pearcmd-install.php
blob: 4a4a349aefdf5262e8c9a9ab69d18959b48d32ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

include_once 'PEAR/Installer.php';
$pkgfile = $cmdargs[0];
$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
$installer->setErrorHandling(PEAR_ERROR_DIE,
                             basename($pkgfile) . ": %s\n");
$installer->debug = $verbose;
$install_options = array();
if ($command == 'upgrade') {
    $install_options['upgrade'] = true;
}
foreach ($cmdopts as $opt) {
    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;
    }
}
if ($installer->install($pkgfile, $install_options, $config)) {
    print "install ok\n";
} else {
    print "install failed\n";
}

?>