diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-04-30 21:57:39 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-04-30 21:57:39 +0000 |
commit | f898cf33c15a03ddbace5893531c3db4e180c270 (patch) | |
tree | 1c30c2a1e7a885c017963555267f403272cb2711 /etc/inc/pkg-utils.inc | |
parent | a902a5d77e5b47374caba0115e9823b61a19fcd7 (diff) | |
download | pfsense-f898cf33c15a03ddbace5893531c3db4e180c270.zip pfsense-f898cf33c15a03ddbace5893531c3db4e180c270.tar.gz |
Install the package, deinstall and reinstall to ensure it is in a proper state.
Diffstat (limited to 'etc/inc/pkg-utils.inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 422e1cb..ffab85d 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -181,7 +181,8 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu $package = $config['installedpackages']['package'][$pkg_id]; if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { log_error("The {$package['name']} package is missing required dependencies and must be reinstalled." . $package['configurationfile']); - delete_package_xml($package['name']); + install_package($package['name']); + uninstall_package_from_name($package['name']); install_package($package['name']); return; } @@ -229,6 +230,13 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu } } +function uninstall_package_from_name($pkg_name) { + $id = get_pkg_id($pkg_name); + $todel = substr(reverse_strrchr($config['installedpackages']['package'][$id]['depends_on_package'], "."), 0, -1); + delete_package($todel, $pkg_name); + delete_package_xml($pkg_name); +} + function force_remove_package($pkg_name) { global $config; delete_package_xml($pkg_name); @@ -269,7 +277,8 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { require_once($include_file); } else { log_error("Could not locate {$include_file}."); - delete_package_xml($package['name']); + install_package($package['name']); + uninstall_package_from_name($package['name']); install_package($package['name']); } } @@ -289,7 +298,8 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { if(!file_exists("/usr/local/pkg/" . $item)) { file_notice($package['name'], "The {$package['name']} package is missing required dependencies and must be reinstalled.", "Packages", "/pkg_mgr_install.php?mode=reinstallpkg&pkg={$package['name']}", 1); log_error("Could not find {$item}. Reinstalling package."); - delete_package_xml($pkg_name); + install_package($pkg_name); + uninstall_package_from_name($pkg_name); install_package($pkg_name); } else { $item_config = parse_xml_config_pkg("/usr/local/pkg/" . $item, "packagegui"); |