summaryrefslogtreecommitdiffstats
path: root/usr/local/www/pkg_mgr_install.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-10-14 19:32:16 +0000
committerErmal <eri@pfsense.org>2010-10-14 19:32:16 +0000
commit2c794549afddcf37947f0e4da5f1b8686f6068fc (patch)
treeee18f19911959768eef8e027a3753873175b9613 /usr/local/www/pkg_mgr_install.php
parentab0eced7edb4e5ee167b54b88d8c7c9a4320c0fc (diff)
downloadpfsense-2c794549afddcf37947f0e4da5f1b8686f6068fc.zip
pfsense-2c794549afddcf37947f0e4da5f1b8686f6068fc.tar.gz
Ticket #950. Correctly handle failures while installing packages which might leave stale information behind. Also do not try to startup services twice. Rename uninstall_package_from_name to uninstall_package because the operation on packages is only done through package names.
Diffstat (limited to 'usr/local/www/pkg_mgr_install.php')
-rwxr-xr-xusr/local/www/pkg_mgr_install.php36
1 files changed, 14 insertions, 22 deletions
diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php
index 5e17150..5c6ae56 100755
--- a/usr/local/www/pkg_mgr_install.php
+++ b/usr/local/www/pkg_mgr_install.php
@@ -128,8 +128,7 @@ conf_mount_rw();
switch($_GET['mode']) {
case "delete":
- $id = get_pkg_id($_GET['pkg']);
- uninstall_package_from_name($_GET['pkg']);
+ uninstall_package($_GET['pkg']);
update_status(gettext("Package deleted."));
$static_output .= "\n" . gettext("Package deleted.");
update_output_window($static_output);
@@ -141,34 +140,28 @@ switch($_GET['mode']) {
exit;
update_output_window(file_get_contents("/tmp/pkg_mgr_{$id}.log"));
break;
- case "reinstallpkg":
- $id = get_pkg_id(htmlspecialchars($_GET['pkg']));
- delete_package_xml(htmlspecialchars($_GET['pkg']));
- install_package(htmlspecialchars($_GET['pkg']));
- update_status(gettext("Package reinstalled."));
- $static_output .= "\n\n" . gettext("Package reinstalled.");
- start_service(htmlspecialchars($_GET['pkg']));
- update_output_window($static_output);
- filter_configure();
- break;
case "reinstallxml":
+ case "reinstallpkg":
delete_package_xml(htmlspecialchars($_GET['pkg']));
- install_package(htmlspecialchars($_GET['pkg']));
- $static_output .= "\n\n" . gettext("Package reinstalled.");
- start_service(htmlspecialchars($_GET['pkg']));
- update_output_window($static_output);
- filter_configure();
+ if (install_package(htmlspecialchars($_GET['pkg'])) < 0) {
+ update_status(gettext("Package reinstallation failed."));
+ $static_output .= "\n\n" . gettext("Package reinstallation failed.");
+ update_output_window($static_output);
+ } else {
+ update_status(gettext("Package reinstalled."));
+ $static_output .= "\n\n" . gettext("Package reinstalled.");
+ update_output_window($static_output);
+ filter_configure();
+ }
break;
case "installedinfo":
- $id = get_pkg_id(htmlspecialchars($_GET['pkg']));
if(file_exists("/tmp/{$_GET['pkg']}.info")) {
$filename = escapeshellcmd("/tmp/" . $_GET['pkg'] . ".info");
$status = file_get_contents($filename);
update_status($_GET['pkg'] . " " . gettext("installation completed."));
update_output_window($status);
- } else {
+ } else
update_output_window(sprintf(gettext("Could not find %s."), $_GET['pkg']));
- }
break;
case "reinstallall":
if ($config['installedpackages']['package'])
@@ -181,14 +174,13 @@ switch($_GET['mode']) {
$static_output = "";
if($pkgtodo['name']) {
update_output_window($static_output);
- uninstall_package_from_name($pkgtodo['name']);
+ uninstall_package($pkgtodo['name']);
install_package($pkgtodo['name']);
$pkg_id++;
}
}
update_status(gettext("All packages reinstalled."));
$static_output .= "\n\n" . gettext("All packages reinstalled.");
- start_service(htmlspecialchars($_GET['pkg']));
update_output_window($static_output);
filter_configure();
break;
OpenPOWER on IntegriCloud