diff options
-rw-r--r-- | etc/inc/pfsense-utils.inc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index db2fae0..193bca3 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -915,4 +915,26 @@ function check_firmware_version($tocheck = "all", $return_php = true) { return $raw_versions; } +/* + * fetch_latest_pkg_config: download the latest pkg_config.xml to /tmp/ directory + */ +function fetch_latest_pkg_config() { + global $g; + global $config; + if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) { + $pkg_config_location = $g['pkg_config_location']; + $pkg_config_base_url = $g['pkg_config_base_url']; + if(isset($config['system']['alt_pkgconfig_url']['enabled'])) { + $pkg_config_location = $config['system']['alt_pkgconfig_url']['pkgconfig_base_url'] . $config['system']['alt_pkgconfig_url']['pkgconfig_filename']; + $pkg_config_base_url = $config['system']['alt_pkgconfig_url']['pkgconfig_base_url']; + } + mwexec("/usr/bin/fetch -o {$g['tmp_path']}/pkg_config.xml {$pkg_config_location}"); + if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) { + print_info_box_np("Could not download pkg_config.xml from " . $pkg_config_base_url . ". Check your DNS settings."); + die; + } + } + return; +} + ?> |