Project

General

Profile

Download (1.19 KB) Statistics
| Branch: | Tag: | Revision:
1
require_once("config.inc");
2
require_once("util.inc");
3
require_once("pkg-utils.inc");
4

    
5
global $g, $config, $argv, $command_split;
6

    
7
if(is_array($command_split))
8
	$args = array_slice($command_split, 2);
9
else
10
	$args = array_slice($argv, 3);
11

    
12
$pkg_name = $args[0];
13
$install_type = empty($args[1]) ? "normal" : $args[1];
14

    
15
echo "Installing package \"{$pkg_name}\"...\n";
16

    
17
echo "Trying to fetch package info...";
18
$pkg_info = get_pkg_info();
19
if ($pkg_info) {
20
	echo " Done.\n";
21
} else {
22
	$xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl'];
23
	echo "\n" . sprintf(gettext(' >>> Unable to communicate with %1$s. Please verify DNS and interface configuration, and that %2$s has functional Internet connectivity.'), $xmlrpc_base_url, $g['product_name']) . "\n";
24
	return;
25
}
26

    
27
$static_output = "";
28
$pkg_interface = "console";
29

    
30
if (empty($pkg_info[$pkg_name]))
31
	echo "\nPackage not found.\n";
32
elseif ($install_type == "normal")
33
	install_package($pkg_name, $pkg_info[$pkg_name], true);
34
elseif ($install_type == "xmlonly")
35
	install_package_xml($pkg_name);
36
else
37
	echo "Invalid install type. Valid values are: normal, xmlonly.\n";
38

    
39
echo "\nDone.\n";
(9-9/16)