summaryrefslogtreecommitdiffstats
path: root/etc/phpshellsessions/installpkg
blob: 30228abc0efbb7aaf69db1261dce94e82ac93bfa (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
34
35
36
37
38
39
require_once("config.inc");
require_once("util.inc");
require_once("pkg-utils.inc");

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

if(is_array($command_split))
	$args = array_slice($command_split, 2);
else
	$args = array_slice($argv, 3);

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

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

echo "Trying to fetch package info...";
$pkg_info = get_pkg_info();
if ($pkg_info) {
	echo " Done.\n";
} else {
	$xmlrpc_base_url = get_active_xml_rpc_base_url();
	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";
	return;
}

$static_output = "";
$pkg_interface = "console";

if (empty($pkg_info[$pkg_name]))
	echo "\nPackage not found.\n";
elseif ($install_type == "normal")
	install_package($pkg_name, $pkg_info[$pkg_name], true);
elseif ($install_type == "xmlonly")
	install_package_xml($pkg_name);
else
	echo "Invalid install type. Valid values are: normal, xmlonly.\n";

echo "\nDone.\n";
OpenPOWER on IntegriCloud