diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-02-06 20:36:12 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-02-06 20:36:12 +0000 |
commit | 7bbfe0077567b5c1f042aec9d2ced213146e078d (patch) | |
tree | 56afbd078176820d2134285a2471972a5b4660a5 /etc/inc | |
parent | 5576c6f38370025979df33b6e2c70a219cda92db (diff) | |
download | pfsense-7bbfe0077567b5c1f042aec9d2ced213146e078d.zip pfsense-7bbfe0077567b5c1f042aec9d2ced213146e078d.tar.gz |
Break the stalemate for invalid packages by removing them (force deinstall).
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 7663746..03dda22 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -159,7 +159,9 @@ 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."); + log_error("The {$package['name']} package is missing required dependencies and must be reinstalled. Deinstalling."); + unset($config['installedpackages']['package'][$pkg_id]); + write_config(); return; } $pkg_xml = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui"); @@ -206,6 +208,11 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu } } +function force_remove_package($pkg_name) { + global $config; + delete_package_xml($pkg_name); +} + /* * sync_package($pkg_name, $sync_depends = true, $show_message = false) Force a package to setup its configuration and rc.d files. */ @@ -222,17 +229,17 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { return; // No package belongs to the pkg_id passed to this function. } if (is_array($config['installedpackages']['package'][$pkg_id])) - $package = $config['installedpackages']['package'][$pkg_id]; + $package = $config['installedpackages']['package'][$pkg_id]; else - return; /* empty package tag */ + return; /* empty package tag */ if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - file_notice($package['name'], "The {$package['name']} package is missing its configuration file and must be reinstalled.", "Packages", "/pkg_mgr_install.php?mode=reinstallpkg&pkg={$package['name']}", 1); + log_error("The {$package['name']} package is missing its configuration file and must be reinstalled."); + force_remove_package($package['name']); } else { $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui"); /* Bring in package include files */ - if (isset($pkg_config['include_file']) && $pkg_config['include_file'] != "" -) { + if (isset($pkg_config['include_file']) && $pkg_config['include_file'] != "") { $include_file = $pkg_config['include_file']; if (file_exists('/usr/local/pkg/' . $include_file)) require_once('/usr/local/pkg/' . $include_file); |