diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-02 23:08:31 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-02 23:08:31 +0000 |
commit | 7c603497904f316f977082756bbaaf0874994421 (patch) | |
tree | 9538e4b52ca84ce5f711353b861949e9d8b2750c | |
parent | e913e572d6b3298ba24fc0a8a5243287897d2cad (diff) | |
download | pfsense-7c603497904f316f977082756bbaaf0874994421.zip pfsense-7c603497904f316f977082756bbaaf0874994421.tar.gz |
Correctly sync package configurations on bootup.
-rw-r--r-- | etc/inc/pfsense-utils.inc | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index e8802a8..2b64fa6 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -486,7 +486,7 @@ function execute_command_return_output($command) { * convert_friendly_interface_to_real_interface_name($interface): convert WAN to FXP0 */ function convert_friendly_interface_to_real_interface_name($interface) { - return $config['interfaces'][$interface]['if']; + return $config['interfaces'][$interface]['if']; } /* @@ -517,49 +517,26 @@ function update_progress_bar($percent) { } /* - * resync_all_package_configs() Forces packages to setup their configuration and rc.d files - */ -function resync_all_package_configs() { - log_error("Resyncing configuration for all packages."); - if(!$config['installedpackages']['package']) return; - foreach($config['installedpackages']['package'] as $package) { - if(file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "pfsensepkgs"); - } else { - log_error("Fetching missing configuration XML for " . $package . "."); - mwexec("fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']); - $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "pfsensepkgs"); - } - if($pkg_config['custom_php_command_before_form'] <> "") eval($pkg_config['custom_php_command_before_form']); - if($pkg_config['custom_add_php_command'] <> "") eval($pkg_config['custom_add_php_command']); - if($pkg_config['custom_add_php_command_late'] <> "") eval($pkg_config['custom_add_php_command_late']); - if($pkg_config['custom_php_install_command'] <> "") eval($pkg_config['custom_php_install_command']); - // XXX: process template as well. - } -} - -/* * resync_all_package_configs_bootup() Force packages to setup their configuration and rc.d files at bootup. * This function also prints output to the terminal indicating progress. */ -function resync_all_package_configs_bootup() { +function resync_all_package_configs_bootup($show_message) { + global $config; log_error("Resyncing configuration for all packages."); - if(!$config['installedpackages']['package']) return; + if(!$config['installedpackages']['package']) return; foreach($config['installedpackages']['package'] as $package) { - if(file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "pfsensepkgs"); - } else { - log_error("Fetching missing configuration XML for " . $package . "."); - system("fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']); - $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "pfsensepkgs"); + if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { + log_error("Fetching missing configuration XML for " . $package); + system("/usr/bin/fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']); } - if($pkg_config['custom_php_command_before_form'] <> "") eval($pkg_config['custom_php_command_before_form']); + $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui"); + if($pkg_config['custom_php_command_before_form'] <> "") eval($pkg_config['custom_php_command_before_form']); if($pkg_config['custom_add_php_command'] <> "") eval($pkg_config['custom_add_php_command']); if($pkg_config['custom_add_php_command_late'] <> "") eval($pkg_config['custom_add_php_command_late']); if($pkg_config['custom_php_install_command'] <> "") eval($pkg_config['custom_php_install_command']); - // XXX: process template as well. - print "Synced " . $package . ".\n"; + if($pkg_config['custom_php_resync_config_command'] <> "") eval($pkg_config['custom_php_resync_config_command']); + if($show_message == true) print "Synced " . $package . ".\n"; } } |