diff options
author | Renato Botelho <renato@netgate.com> | 2016-04-05 19:50:10 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-04-05 19:50:10 -0300 |
commit | a90f1c9b12c4d31ea845fa04188e599ba28dbaf1 (patch) | |
tree | c7332c7aef82031cac8a9ce8d7dea3d1e5bf9611 /src/usr/local/www/system_update_settings.php | |
parent | a35bf546b57558535e3fc1958cf3fb2b4d18ade7 (diff) | |
download | pfsense-a90f1c9b12c4d31ea845fa04188e599ba28dbaf1.zip pfsense-a90f1c9b12c4d31ea845fa04188e599ba28dbaf1.tar.gz |
Rework the way repo packages work
- Distribute only a single pfSense-repo package containing all templates
- Create a symlink pointing to selected repo
- Do not limit it only to pfSense-repo and pfSense-repo-devel
Diffstat (limited to 'src/usr/local/www/system_update_settings.php')
-rw-r--r-- | src/usr/local/www/system_update_settings.php | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/src/usr/local/www/system_update_settings.php b/src/usr/local/www/system_update_settings.php index d99ea9a..8c7a6f2 100644 --- a/src/usr/local/www/system_update_settings.php +++ b/src/usr/local/www/system_update_settings.php @@ -64,7 +64,10 @@ require("guiconfig.inc"); require("pkg-utils.inc"); +$repos = pkg_list_repos(); + if ($_POST) { + // Set the firmware branch, but only if we are not using it already if ($_POST['fwbranch']) { if (($_POST['fwbranch'] == "development") && !is_pkg_installed($g['product_name'] . "-repo-devel")) { @@ -87,10 +90,21 @@ if ($_POST) { } elseif (isset($config['system']['gitsync']['synconupgrade'])) { unset($config['system']['gitsync']['synconupgrade']); } + $config['system']['gitsync']['repositoryurl'] = $_POST['repositoryurl']; $config['system']['gitsync']['branch'] = $_POST['branch']; + foreach ($repos as $repo) { + if ($repo['name'] == $_POST['fwbranch']) { + $config['system']['pkg_repo_conf_path'] = $repo['path']; + pkg_switch_repo($repo['path']); + break; + } + } + write_config(); + + $savemsg = gettext("Changes have been saved successfully"); } $curcfg = $config['system']['firmware']; @@ -103,6 +117,32 @@ if (file_exists("{$g['tmp_path']}/manifest")) { $preset_urls_split = explode("\n", file_get_contents("{$g['tmp_path']}/manifest")); } +// Create an array of repo names and descriptions to populate the "Branch" selector +function build_repo_list() { + global $repos; + + $list = array(); + + foreach ($repos as $repo) { + $list[$repo['name']] = $repo['descr']; + } + + return($list); +} + +function get_repo_name($path) { + global $repos; + + foreach ($repos as $repo) { + if ($repo['path'] == $path) { + return $repo['name']; + } + } + + /* Default */ + return $repos[0]['name']; +} + include("head.inc"); if ($input_errors) { @@ -125,22 +165,15 @@ $section = new Form_Section('Firmware Branch'); $section->addInput(new Form_Select( fwbranch, 'Branch', - (is_pkg_installed($g['product_name'] . "-repo")) ? "stable":"development", - ["stable" => gettext("Stable"), "development" => gettext("Development")] + get_repo_name($config['system']['pkg_repo_conf_path']), + build_repo_list() ))->setHelp('Please select the stable, or the development branch from which to update the system firmware. ' . ' <br />' . 'Use of the development version is at your own risk!'); $form->add($section); $section = new Form_Section('Updates'); -/* -$section->addInput(new Form_Checkbox( - 'allowinvalidsig', - 'Unsigned images', - 'Allow auto-update firmware images with a missing or invalid digital signature to be used', - isset($curcfg['allowinvalidsig']) - )); -*/ + $section->addInput(new Form_Checkbox( 'disablecheck', 'Dashboard check', |