Revision 093441f0
Added by Colin Smith about 20 years ago
etc/inc/pkg-utils.inc | ||
---|---|---|
146 | 146 |
if(!isset($config['installedpackages']['package'][$pkg_id])) return; // No package belongs to the pkg_id passed to this function. |
147 | 147 |
} |
148 | 148 |
$package = $config['installedpackages']['package'][$pkg_id]; |
149 |
if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { // If the package's config file doesn't exist, log an error and fetch it.
|
|
150 |
log_error("Fetching missing configuration XML for " . $package['name']);
|
|
151 |
mwexec("/usr/bin/fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']);
|
|
152 |
}
|
|
153 |
$pkg_xml = parse_xml_config("/usr/local/pkg/" . $package['configurationfile'], "packagegui");
|
|
149 |
if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { |
|
150 |
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);
|
|
151 |
return;
|
|
152 |
}
|
|
153 |
$pkg_xml = parse_xml_config("/usr/local/pkg/" . $package['configurationfile'], "packagegui");
|
|
154 | 154 |
if($pkg_xml['additional_files_needed'] != "") { |
155 | 155 |
foreach($pkg_xml['additional_files_needed'] as $item) { |
156 | 156 |
if (($return_nosync == 0) && (isset($item['nosync']))) continue; // Do not return depends with nosync set if not required. |
... | ... | |
163 | 163 |
$prefix = "/usr/local/pkg/"; |
164 | 164 |
} |
165 | 165 |
if(!file_exists($prefix . $pkg_name)) { |
166 |
log_error("Fetching missing dependency (" . $depend_name . ") for " . $pkg_name); |
|
167 |
mwexec("/usr/local/bin/fetch -o " . $prefix . $depend_file . " " . $item['name']['0']); |
|
168 |
if($item['chmod'] != "") |
|
169 |
chmod($prefix . $depend_file, $item['chmod']); // Handle chmods. |
|
166 |
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); |
|
170 | 167 |
} |
171 | 168 |
switch ($format) { |
172 | 169 |
case "files": |
... | ... | |
215 | 212 |
} |
216 | 213 |
$package = $config['installedpackages']['package'][$pkg_id]; |
217 | 214 |
if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { |
218 |
//if($show_message == true) print "(f)"; Don't mess with this until the package system has settled.
|
|
219 |
log_error("Fetching missing configuration XML for " . $package['name']);
|
|
220 |
mwexec("/usr/bin/fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']);
|
|
221 |
}
|
|
222 |
$pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui");
|
|
223 |
if(isset($pkg_config['nosync'])) continue;
|
|
224 |
//if($show_message == true) print "Syncing " . $pkg_name;
|
|
225 |
if($pkg['custom_php_global_functions'] <> "")
|
|
226 |
eval($pkg['custom_php_global_functions']);
|
|
227 |
if($pkg_config['custom_php_command_before_form'] <> "")
|
|
228 |
eval($pkg_config['custom_php_command_before_form']);
|
|
229 |
if($pkg_config['custom_php_resync_config_command'] <> "")
|
|
230 |
eval($pkg_config['custom_php_resync_config_command']);
|
|
231 |
if($sync_depends == true) {
|
|
232 |
$depends = get_pkg_depends($pkg_name, ".xml", "files", 1); // Call dependency handler and do a little more error checking.
|
|
233 |
if(is_array($depends)) {
|
|
234 |
foreach($depends as $item) {
|
|
235 |
$item_config = parse_xml_config_pkg("/usr/local/pkg/" . $item, "packagegui"); |
|
236 |
if(isset($item_config['nosync'])) continue; |
|
237 |
if($item_config['custom_php_command_before_form'] <> "") { |
|
238 |
eval($item_config['custom_php_command_before_form']); |
|
239 |
} |
|
240 |
if($item_config['custom_php_resync_config_command'] <> "") { |
|
241 |
eval($item_config['custom_php_resync_config_command']); |
|
242 |
} |
|
243 |
if($show_message == true) print " " . $item_config['name']; |
|
244 |
} |
|
245 |
} |
|
246 |
}
|
|
247 |
// if($show_message == true) print ".";
|
|
215 |
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);
|
|
216 |
} else {
|
|
217 |
$pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui");
|
|
218 |
if(isset($pkg_config['nosync'])) continue;
|
|
219 |
if($pkg['custom_php_global_functions'] <> "")
|
|
220 |
eval($pkg['custom_php_global_functions']);
|
|
221 |
if($pkg_config['custom_php_command_before_form'] <> "")
|
|
222 |
eval($pkg_config['custom_php_command_before_form']);
|
|
223 |
if($pkg_config['custom_php_resync_config_command'] <> "")
|
|
224 |
eval($pkg_config['custom_php_resync_config_command']);
|
|
225 |
if($sync_depends == true) {
|
|
226 |
$depends = get_pkg_depends($pkg_name, ".xml", "files", 1); // Call dependency handler and do a little more error checking.
|
|
227 |
if(is_array($depends)) {
|
|
228 |
foreach($depends as $item) {
|
|
229 |
if(!file_exists("/usr/local/pkg" . $item)) {
|
|
230 |
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);
|
|
231 |
} else {
|
|
232 |
$item_config = parse_xml_config_pkg("/usr/local/pkg/" . $item, "packagegui");
|
|
233 |
if(isset($item_config['nosync'])) continue;
|
|
234 |
if($item_config['custom_php_command_before_form'] <> "") {
|
|
235 |
eval($item_config['custom_php_command_before_form']);
|
|
236 |
}
|
|
237 |
if($item_config['custom_php_resync_config_command'] <> "") {
|
|
238 |
eval($item_config['custom_php_resync_config_command']);
|
|
239 |
}
|
|
240 |
if($show_message == true) print " " . $item_config['name'];
|
|
241 |
}
|
|
242 |
}
|
|
243 |
}
|
|
244 |
}
|
|
248 | 245 |
} |
249 | 246 |
|
250 | 247 |
/* |
Also available in: Unified diff
File notices if package information isn't found.