diff options
author | Renato Botelho <renato@netgate.com> | 2018-09-18 13:34:21 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2018-09-18 13:35:32 -0300 |
commit | 635ea24ecea4d2c866c2d16e2ca9b92eda0b7d93 (patch) | |
tree | 07bf2eac75193a2789d69cfa995f5a01d1e13eb9 /src/etc | |
parent | d43485a9bc0fd7c5174090949290e4fc8100d565 (diff) | |
download | pfsense-635ea24ecea4d2c866c2d16e2ca9b92eda0b7d93.zip pfsense-635ea24ecea4d2c866c2d16e2ca9b92eda0b7d93.tar.gz |
Fix #8911: Keep configured pkg repository when restoring config
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 5462a6f..50d3be6 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -934,10 +934,29 @@ function restore_config_section($section_name, $new_contents) { if ($section_xml === -1) { return false; } + + /* Save current pkg repo to re-add on new config */ + unset($pkg_repo_conf_path); + if ($section_name == "system" && + isset($config['system']['pkg_repo_conf_path'])) { + $pkg_repo_conf_path = $config['system']['pkg_repo_conf_path']; + } + $config[$section_name] = &$section_xml; if (file_exists("{$g['tmp_path']}/config.cache")) { unlink("{$g['tmp_path']}/config.cache"); } + + /* Restore previously pkg repo configured */ + if ($section_name == "system") { + if (isset($pkg_repo_conf_path)) { + $config['system']['pkg_repo_conf_path'] = + $pkg_repo_conf_path; + } elseif (isset($config['system']['pkg_repo_conf_path'])) { + unset($config['system']['pkg_repo_conf_path']); + } + } + write_config(sprintf(gettext("Restored %s of config file (maybe from CARP partner)"), $section_name)); disable_security_checks(); return true; |