Revision 5e51b5b9
Added by Renato Botelho about 10 years ago
etc/phpshellsessions/installpkg | ||
---|---|---|
5 | 5 |
global $g, $config, $argv, $command_split; |
6 | 6 |
|
7 | 7 |
if (is_array($command_split)) { |
8 |
$args = array_slice($command_split, 2);
|
|
8 |
$args = array_slice($command_split, 1);
|
|
9 | 9 |
} else { |
10 |
$args = array_slice($argv, 3);
|
|
10 |
$args = array_slice($argv, 2);
|
|
11 | 11 |
} |
12 | 12 |
|
13 | 13 |
$pkg_name = $args[0]; |
14 |
$install_type = empty($args[1]) ? "normal" : $args[1]; |
|
15 | 14 |
|
16 | 15 |
echo "Installing package \"{$pkg_name}\"...\n"; |
17 | 16 |
|
... | ... | |
20 | 19 |
if ($pkg_info) { |
21 | 20 |
echo " Done.\n"; |
22 | 21 |
} 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"; |
|
22 |
echo "\n" . gettext(' >>> Unable to get pkg info.') . "\n"; |
|
25 | 23 |
return; |
26 | 24 |
} |
27 | 25 |
|
... | ... | |
30 | 28 |
|
31 | 29 |
if (empty($pkg_info[$pkg_name])) { |
32 | 30 |
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"; |
|
31 |
return; |
|
39 | 32 |
} |
40 | 33 |
|
34 |
install_package($pkg_name); |
|
35 |
|
|
41 | 36 |
echo "\nDone.\n"; |
etc/phpshellsessions/uninstallpkg | ||
---|---|---|
5 | 5 |
global $g, $config, $argv, $command_split; |
6 | 6 |
|
7 | 7 |
if (is_array($command_split)) { |
8 |
$args = array_slice($command_split, 2);
|
|
8 |
$args = array_slice($command_split, 1);
|
|
9 | 9 |
} else { |
10 |
$args = array_slice($argv, 3);
|
|
10 |
$args = array_slice($argv, 2);
|
|
11 | 11 |
} |
12 | 12 |
|
13 | 13 |
$pkg_name = $args[0]; |
14 |
$remove_type = empty($args[1]) ? "normal" : $args[1]; |
|
15 | 14 |
$pkg_info = array(); |
16 | 15 |
|
17 | 16 |
echo "Removing package \"{$pkg_name}\"...\n"; |
... | ... | |
27 | 26 |
|
28 | 27 |
if (empty($pkg_info)) { |
29 | 28 |
echo "\nPackage not installed.\n"; |
30 |
} elseif ($remove_type == "normal") { |
|
31 |
uninstall_package($pkg_name); |
|
32 |
} elseif ($remove_type == "xmlonly") { |
|
33 |
delete_package_xml($pkg_name); |
|
34 |
} else { |
|
35 |
echo "Invalid removal type. Valid values are: normal, xmlonly.\n"; |
|
29 |
return; |
|
36 | 30 |
} |
37 | 31 |
|
38 |
echo "\nDone.\n"; |
|
32 |
uninstall_package($pkg_name); |
|
33 |
|
|
34 |
echo "\nDone.\n"; |
Also available in: Unified diff
Simplify logic and use correct calls for install_package