diff options
author | Renato Botelho <renato@netgate.com> | 2015-07-01 10:58:27 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-01 10:58:27 -0300 |
commit | 5e51b5b9be9997b203e6a43c9518706d7e7eae4e (patch) | |
tree | 5517e9ff519f46ebf8e79b9ae7ceafe8b2f62ad4 /etc/phpshellsessions | |
parent | fad3ad5973356a8d2526697d5a96782b8697cf14 (diff) | |
download | pfsense-5e51b5b9be9997b203e6a43c9518706d7e7eae4e.zip pfsense-5e51b5b9be9997b203e6a43c9518706d7e7eae4e.tar.gz |
Simplify logic and use correct calls for install_package
Diffstat (limited to 'etc/phpshellsessions')
-rw-r--r-- | etc/phpshellsessions/installpkg | 17 | ||||
-rw-r--r-- | etc/phpshellsessions/uninstallpkg | 16 |
2 files changed, 12 insertions, 21 deletions
diff --git a/etc/phpshellsessions/installpkg b/etc/phpshellsessions/installpkg index 07ff879..1ac71bf 100644 --- a/etc/phpshellsessions/installpkg +++ b/etc/phpshellsessions/installpkg @@ -5,13 +5,12 @@ require_once("pkg-utils.inc"); global $g, $config, $argv, $command_split; if (is_array($command_split)) { - $args = array_slice($command_split, 2); + $args = array_slice($command_split, 1); } else { - $args = array_slice($argv, 3); + $args = array_slice($argv, 2); } $pkg_name = $args[0]; -$install_type = empty($args[1]) ? "normal" : $args[1]; echo "Installing package \"{$pkg_name}\"...\n"; @@ -20,8 +19,7 @@ $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"; + echo "\n" . gettext(' >>> Unable to get pkg info.') . "\n"; return; } @@ -30,12 +28,9 @@ $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"; + return; } +install_package($pkg_name); + echo "\nDone.\n"; diff --git a/etc/phpshellsessions/uninstallpkg b/etc/phpshellsessions/uninstallpkg index fa4cee2..9030e56 100644 --- a/etc/phpshellsessions/uninstallpkg +++ b/etc/phpshellsessions/uninstallpkg @@ -5,13 +5,12 @@ require_once("pkg-utils.inc"); global $g, $config, $argv, $command_split; if (is_array($command_split)) { - $args = array_slice($command_split, 2); + $args = array_slice($command_split, 1); } else { - $args = array_slice($argv, 3); + $args = array_slice($argv, 2); } $pkg_name = $args[0]; -$remove_type = empty($args[1]) ? "normal" : $args[1]; $pkg_info = array(); echo "Removing package \"{$pkg_name}\"...\n"; @@ -27,12 +26,9 @@ $pkg_interface = "console"; if (empty($pkg_info)) { echo "\nPackage not installed.\n"; -} elseif ($remove_type == "normal") { - uninstall_package($pkg_name); -} elseif ($remove_type == "xmlonly") { - delete_package_xml($pkg_name); -} else { - echo "Invalid removal type. Valid values are: normal, xmlonly.\n"; + return; } -echo "\nDone.\n";
\ No newline at end of file +uninstall_package($pkg_name); + +echo "\nDone.\n"; |