Project

General

Profile

Download (1.12 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

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

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

    
18
echo "Trying to fetch package info...";
19
$pkg_info = get_pkg_info();
20
if ($pkg_info) {
21
	echo " Done.\n";
22
} else {
23
	$xmlrpc_base_url = get_active_xml_rpc_base_url();
24
	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";
25
	return;
26
}
27

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

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

    
41
echo "\nDone.\n";
(11-11/18)